List of usage examples for android.view Window FEATURE_PROGRESS
int FEATURE_PROGRESS
To view the source code for android.view Window FEATURE_PROGRESS.
Click Source Link
From source file:com.andrewshu.android.reddit.reddits.PickSubredditActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); CookieSyncManager.createInstance(getApplicationContext()); mSettings.loadRedditPreferences(this, mClient); setRequestedOrientation(mSettings.getRotation()); requestWindowFeature(Window.FEATURE_PROGRESS); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setTheme(mSettings.getTheme());//from ww w .jav a 2 s . com setContentView(R.layout.pick_subreddit_view); registerForContextMenu(getListView()); resetUI(null); mSubredditsList = cacheSubredditsList(mSubredditsList); if (CollectionUtils.isEmpty(mSubredditsList)) restoreLastNonConfigurationInstance(); if (CollectionUtils.isEmpty(mSubredditsList)) { new DownloadRedditsTask().execute(); } else { addFakeSubredditsUnlessSuppressed(); resetUI(new PickSubredditAdapter(this, mSubredditsList)); } }
From source file:in.shick.diode.reddits.PickSubredditActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mSubredditsList = new ArrayList<SubredditInfo>(); CookieSyncManager.createInstance(getApplicationContext()); mSettings.loadRedditPreferences(this, mClient); setRequestedOrientation(mSettings.getRotation()); requestWindowFeature(Window.FEATURE_PROGRESS); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setTheme(mSettings.getTheme());/* ww w. ja v a2s.co m*/ setContentView(R.layout.pick_subreddit_view); registerForContextMenu(getListView()); mSubredditsList = getCachedSubredditsList(); if (CollectionUtils.isEmpty(mSubredditsList)) restoreLastNonConfigurationInstance(); if (CollectionUtils.isEmpty(mSubredditsList)) { new DownloadRedditsTask().execute(); } else { resetUI(new PickSubredditAdapter(this, mSubredditsList)); } }
From source file:com.itude.mobile.mobbl.core.controller.MBViewManager.java
@Override protected void onCreate(android.os.Bundle savedInstanceState) { onPreCreate();//from w w w . j a v a 2s . c om _actionBarBuilder = constructActionBarBuilder(); _dialogManager = new MBDialogManager(this); _homeButtonHandler = new DefaultHomeButtonHandler(); /* * We store our default orientation. This will be used to determine how pages should be shown by default * See setOrientation */ _defaultScreenOrientation = getRequestedOrientation(); super.onCreate(null); supportRequestWindowFeature(Window.FEATURE_PROGRESS); supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); // makes sure the action bar is initialized (otherwise, the setProgressBar.. doesn't work) if (getSupportActionBar() != null) { setSupportProgressBarIndeterminateVisibility(false); } getDialogManager().addDialogChangeListener(this); _instance = this; MBApplicationController.getInstance().startController(); }
From source file:de.stkl.gbgvertretungsplan.activities.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) Log.d(LOG_TAG, "onCreate"); super.onCreate(savedInstanceState); supportRequestWindowFeature(Window.FEATURE_PROGRESS); supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); //supportRequestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); setContentView(R.layout.activity_main); mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager() .findFragmentById(R.id.navigation_drawer); // Set up the drawer. mNavigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); // restore instance state if (savedInstanceState != null) setProgressBarState(savedInstanceState.getBoolean(STATE_PROGRESSBAR_VISIBLE)); // tos//w ww. ja v a2 s . c o m final Context _this = this; final Eula eula = new Eula(this, new Eula.CallbackInterface() { @Override public void onAccept() { // get default account mDefaultAccount = Authenticator.getDefaultAccount(_this); if (mDefaultAccount == null) { // if no accounts exists, present the account creation activity to the user CreateAccountDialog dialog = new CreateAccountDialog(); dialog.show(getSupportFragmentManager(), "CreateAccountDialog"); } } @Override public void onDecline() { } }); if (eula.mustShow()) eula.show(); else { // get default account mDefaultAccount = Authenticator.getDefaultAccount(this); if (mDefaultAccount == null) { // if no accounts exists, present the account creation activity to the user CreateAccountDialog dialog = new CreateAccountDialog(); dialog.show(getSupportFragmentManager(), "CreateAccountDialog"); } } }
From source file:aarddict.android.ArticleViewActivity.java
@Override void initUI() {/* w w w . j a va2 s. c o m*/ this.scrollPositionsH = Collections.synchronizedMap(new HashMap<Article, ScrollXY>()); this.scrollPositionsV = Collections.synchronizedMap(new HashMap<Article, ScrollXY>()); loadAssets(); if (DeviceInfo.EINK_SCREEN) { useAnimation = false; setContentView(R.layout.eink_article_view); articleView = (ArticleView) findViewById(R.id.EinkArticleView); N2EpdController.n2MainActivity = this; EinkScreen.ResetController(2, articleView); // force full screen // refresh when changing // articles } // Setup animations only on non-eink screens else { useAnimation = true; fadeOutAnimation = new AlphaAnimation(1f, 0f); fadeOutAnimation.setDuration(600); fadeOutAnimation.setAnimationListener(new AnimationAdapter() { public void onAnimationEnd(Animation animation) { Button nextButton = (Button) findViewById(R.id.NextButton); nextButton.setVisibility(Button.GONE); } }); getWindow().requestFeature(Window.FEATURE_PROGRESS); setContentView(R.layout.article_view); articleView = (ArticleView) findViewById(R.id.ArticleView); } timer = new Timer(); backItems = Collections.synchronizedList(new LinkedList<HistoryItem>()); if (android.os.Build.VERSION.SDK_INT >= 11) { try { showFindDialogMethod = articleView.getClass().getMethod("showFindDialog", String.class, boolean.class); } catch (NoSuchMethodException e1) { Log.d(TAG, "showFindDialog method not found"); } } articleView.setOnScrollListener(new ArticleView.ScrollListener() { public void onScroll(int l, int t, int oldl, int oldt) { saveScrollPos(l, t); } }); articleView.getSettings().setJavaScriptEnabled(true); articleView.addJavascriptInterface(new SectionMatcher(), "matcher"); articleView.addJavascriptInterface(articleView, "scrollControl"); articleView.setWebChromeClient(new WebChromeClient() { @Override public boolean onJsAlert(WebView view, String url, String message, JsResult result) { Log.d(TAG + ".js", String.format("[%s]: %s", url, message)); result.cancel(); return true; } public void onProgressChanged(WebView view, int newProgress) { Log.d(TAG, "Progress: " + newProgress); setProgress(5000 + newProgress * 50); } }); articleView.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { Log.d(TAG, "Page finished: " + url); currentTask = null; String section = null; if (url.contains("#")) { LookupWord lookupWord = LookupWord.splitWord(url); section = lookupWord.section; if (backItems.size() > 0) { HistoryItem currentHistoryItem = backItems.get(backItems.size() - 1); HistoryItem h = new HistoryItem(currentHistoryItem); h.article.section = section; backItems.add(h); } } else if (backItems.size() > 0) { Article current = backItems.get(backItems.size() - 1).article; section = current.section; } if (!restoreScrollPos()) { goToSection(section); } updateNextButtonVisibility(); } @Override public boolean shouldOverrideUrlLoading(WebView view, final String url) { Log.d(TAG, "URL clicked: " + url); String urlLower = url.toLowerCase(); if (urlLower.startsWith("http://") || urlLower.startsWith("https://") || urlLower.startsWith("ftp://") || urlLower.startsWith("sftp://") || urlLower.startsWith("mailto:")) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(browserIntent); } else { if (currentTask == null) { currentTask = new TimerTask() { public void run() { try { Article currentArticle = backItems.get(backItems.size() - 1).article; try { Iterator<Entry> currentIterator = dictionaryService.followLink(url, currentArticle.volumeId); List<Entry> result = new ArrayList<Entry>(); while (currentIterator.hasNext() && result.size() < 20) { result.add(currentIterator.next()); } showNext(new HistoryItem(result)); } catch (ArticleNotFound e) { showMessage(getString(R.string.msgArticleNotFound, e.word.toString())); } } catch (Exception e) { StringBuilder msgBuilder = new StringBuilder( "There was an error following link ").append("\"").append(url) .append("\""); if (e.getMessage() != null) { msgBuilder.append(": ").append(e.getMessage()); } final String msg = msgBuilder.toString(); Log.e(TAG, msg, e); showError(msg); } } }; try { timer.schedule(currentTask, 0); } catch (Exception e) { Log.d(TAG, "Failed to schedule task", e); } } } return true; } }); final Button nextButton = (Button) findViewById(R.id.NextButton); nextButton.getBackground().setAlpha(180); nextButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (nextButton.getVisibility() == View.VISIBLE) { updateNextButtonVisibility(); nextArticle(); updateNextButtonVisibility(); } } }); articleView.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { updateNextButtonVisibility(); return false; } }); setProgressBarVisibility(true); }
From source file:ca.spencerelliott.mercury.Changesets.java
@Override public void onCreate(Bundle bundle) { super.onCreate(bundle); this.requestWindowFeature(Window.FEATURE_PROGRESS); this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.changesets); //Cancel any notifications previously setup NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); nm.cancel(1);//from w w w. j a va2 s .c o m //Create a new array list for the changesets changesets_list = new ArrayList<Map<String, ?>>(); changesets_data = new ArrayList<Beans.ChangesetBean>(); //Get the list view to store the changesets changesets_listview = (ListView) findViewById(R.id.changesets_list); TextView empty_text = (TextView) findViewById(R.id.changesets_empty_text); //Set the empty view changesets_listview.setEmptyView(empty_text); //Use a simple adapter to display the changesets based on the array list made earlier changesets_listview.setAdapter(new SimpleAdapter(this, changesets_list, R.layout.changeset_item, new String[] { COMMIT, FORMATTED_INFO }, new int[] { R.id.changesets_commit, R.id.changesets_info })); //Set the on click listener changesets_listview.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterview, View view, int position, long id) { Intent intent = new Intent(Changesets.this, ChangesetViewer.class); //Pass the changeset information to the changeset viewer Bundle params = new Bundle(); params.putString("changeset_commit_text", changesets_data.get(position).getTitle()); params.putString("changeset_changes", changesets_data.get(position).getContent()); params.putLong("changeset_updated", changesets_data.get(position).getUpdated()); params.putString("changeset_authors", changesets_data.get(position).getAuthor()); params.putString("changeset_link", changesets_data.get(position).getLink()); //params.putBoolean("is_https", is_https); intent.putExtras(params); startActivity(intent); } }); //Register the list view for opening the context menu registerForContextMenu(changesets_listview); //Get the intent passed by the program if (getIntent() != null) { //Check to see if this is a search window if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) { //Change the title of the activity and the empty text of the list so it looks like a search window this.setTitle(R.string.search_results_label); empty_text.setText(R.string.search_results_empty); //Retrieve the query the user entered String query = getIntent().getStringExtra(SearchManager.QUERY); //Convert the query to lower case query = query.toLowerCase(); //Retrieve the bundle data Bundle retrieved_data = getIntent().getBundleExtra(SearchManager.APP_DATA); //If the bundle was passed, grab the changeset data if (retrieved_data != null) { changesets_data = retrieved_data .getParcelableArrayList("ca.spencerelliott.mercury.SEARCH_DATA"); } //If we're missing changeset data, stop here if (changesets_data == null) return; //Create a new array list to store the changesets that were a match ArrayList<Beans.ChangesetBean> search_beans = new ArrayList<Beans.ChangesetBean>(); //Loop through each changeset for (Beans.ChangesetBean b : changesets_data) { //Check to see if any changesets match if (b.getTitle().toLowerCase().contains(query)) { //Get the title and date of the commit String commit_text = b.getTitle(); Date commit_date = new Date(b.getUpdated()); //Add a new changeset to display in the list view changesets_list.add(createChangeset( (commit_text.length() > 30 ? commit_text.substring(0, 30) + "..." : commit_text), b.getRevisionID() + " - " + commit_date.toLocaleString())); //Add this bean to the list of found search beans search_beans.add(b); } } //Switch the changeset data over to the changeset data that was a match changesets_data = search_beans; //Update the list in the activity list_handler.sendEmptyMessage(SUCCESSFUL); //Notify the activity that it is a search window is_search_window = true; //Stop loading here return; } //Get the data from the intent Uri data = getIntent().getData(); if (data != null) { //Extract the path in the intent String path_string = data.getEncodedPath(); //Split it by the forward slashes String[] split_path = path_string.split("/"); //Make sure a valid path was passed if (split_path.length == 3) { //Get the repository id from the intent repo_id = Long.parseLong(split_path[2].toString()); } else { //Notify the user if there was a problem Toast.makeText(this, R.string.invalid_intent, 1000).show(); } } } //Retrieve the changesets refreshChangesets(); }
From source file:cz.muni.fi.japanesedictionary.main.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); supportRequestWindowFeature(Window.FEATURE_PROGRESS); setContentView(R.layout.main_activity); setSupportProgressBarIndeterminate(true); mDatabase = new GlossaryReaderContract(getApplicationContext()); // Start out with a progress indicator. Log.i(LOG_TAG, "Controling saved instance ... "); if (savedInstanceState != null) { Log.i(LOG_TAG, "Saved instance ... "); mCurFilter = savedInstanceState.getString(MainActivity.SEARCH_TEXT); mLastTabId = savedInstanceState.getString(MainActivity.PART_OF_TEXT); if (mLastTabId == null || mLastTabId.length() == 0) { mLastTabId = "exact"; }//ww w.j a v a2s.c o m } Log.i(LOG_TAG, "Find ViewPager"); mPager = (ViewPager) findViewById(R.id.pager); /** Defining a listener for pageChange */ Log.i(LOG_TAG, "ViewPager listener setup"); ViewPager.SimpleOnPageChangeListener pageChangeListener = new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { getSupportActionBar().setSelectedNavigationItem(position); ResultFragmentList fragmentList = (ResultFragmentList) getSupportFragmentManager() .findFragmentByTag(getFragmentTag(mPager.getCurrentItem())); if (fragmentList != null) { fragmentList.search(mCurFilter); } super.onPageSelected(position); } }; Log.i(LOG_TAG, "ViewPager listener set"); mPager.setOnPageChangeListener(pageChangeListener); Log.i(LOG_TAG, "ViewPager create adapter"); PagerAdapter adapter = new MainPagerAdapter(getSupportFragmentManager()); Log.i(LOG_TAG, "ViewPager adapter set"); mPager.setAdapter(adapter); mPager.setPageMargin(getResources().getDimensionPixelSize(R.dimen.viewPager_margin)); if (mLastTabId == null || mLastTabId.length() == 0) { mLastTabId = "exact"; } setUpTabs(mLastTabId); SharedPreferences settings = getSharedPreferences(ParserService.DICTIONARY_PREFERENCES, 0); String dictionaryPath = settings.getString(Const.PREF_JMDICT_PATH, null); boolean waitingForConnection = settings.getBoolean("waitingForConnection", false); if (waitingForConnection && (dictionaryPath == null || !(new File(dictionaryPath)).exists())) { displayDownloadPrompt(); } mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); // Set the adapter for the list view List<DrawerItem> drawerItems = new ArrayList<DrawerItem>(); DrawerItem search = new DrawerItem().setName(getString(R.string.actionbar_search)) .setIconResource(android.R.drawable.ic_menu_search); drawerItems.add(search); drawerItems.add(new DrawerItem().setName(getString(R.string.menu_favorite_activity)) .setIconResource(R.drawable.rating_favorite)); drawerItems.add(new DrawerItem().setName(getString(R.string.last_seen)) .setIconResource(R.drawable.collections_view_as_list)); DrawerAdapter drawerAdapter = new DrawerAdapter(getApplicationContext()); drawerAdapter.setData(drawerItems); mDrawerList.setAdapter(drawerAdapter); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { Log.i(LOG_TAG, "Drawer change - close"); if (!ActivityCompat.invalidateOptionsMenu(MainActivity.this)) { onPrepareOptionsMenu(mMenu); } // creates call to onPrepareOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { Log.i(LOG_TAG, "Drawer change - open"); if (!ActivityCompat.invalidateOptionsMenu(MainActivity.this)) { onPrepareOptionsMenu(mMenu); } // creates call to onPrepareOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); // Set the list's click listener mDrawerList.setOnItemClickListener(new DrawerItemClickListenerMainActivity()); Log.i(LOG_TAG, "Checking saved instance"); if (savedInstanceState != null) { return; } mSearchVisible = true; Log.i(LOG_TAG, "Setting layout"); if (findViewById(R.id.detail_fragment) != null) { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); // two frames layout Log.i(LOG_TAG, "Setting info fragment"); DisplayTranslation displayTranslation = new DisplayTranslation(); ft.add(R.id.detail_fragment, displayTranslation, "displayFragment"); ft.commit(); } if (dictionaryPath == null || !(new File(dictionaryPath)).exists()) { displayDownloadPrompt(); } }
From source file:org.fox.ttrss.OnlineActivity.java
@Override public void onCreate(Bundle savedInstanceState) { ApiRequest.disableConnectionReuseIfNecessary(); // we use that before parent onCreate so let's init locally m_prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); setAppTheme(m_prefs);/* w w w .j a v a 2s . co m*/ super.onCreate(savedInstanceState); if (canUseProgress()) { requestWindowFeature(Window.FEATURE_PROGRESS); } //requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setProgressBarVisibility(false); setProgressBarIndeterminateVisibility(false); // SharedPreferences localPrefs = getSharedPreferences("localprefs", Context.MODE_PRIVATE); SharedPreferences localPrefs = getSharedPreferences("localprefs", Context.MODE_PRIVATE); boolean isOffline = localPrefs.getBoolean("offline_mode_active", false); Log.d(TAG, "m_isOffline=" + isOffline); setContentView(R.layout.login); m_pullToRefreshAttacher = PullToRefreshAttacher.get(this); if (isOffline) { switchOfflineSuccess(); } else { if (!isAmazonDevice()) { checkTrial(false); } /* if (getIntent().getExtras() != null) { Intent i = getIntent(); } */ if (savedInstanceState != null) { m_offlineModeStatus = savedInstanceState.getInt("offlineModeStatus"); } m_headlinesActionModeCallback = new HeadlinesActionModeCallback(); } }
From source file:com.codeim.coxin.LoginActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { Log.d(TAG, "onCreate"); super.onCreate(savedInstanceState); // No Title bar requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_PROGRESS); mPreferences = PreferenceManager.getDefaultSharedPreferences(this); setContentView(R.layout.newlogin);/* w w w. ja v a2 s . c o m*/ mUsernameEdit = (EditText) findViewById(R.id.username_edit); mPasswordEdit = (EditText) findViewById(R.id.password_edit); mUsernameEdit.setText(""); mPasswordEdit.setText(""); //mWeibo = Weibo.getInstance(ConstantS.APP_KEY, ConstantS.REDIRECT_URL, ConstantS.SCOPE); // mUsernameEdit.setOnKeyListener(enterKeyHandler); mPasswordEdit.setOnKeyListener(enterKeyHandler); mSigninButton = (Button) findViewById(R.id.signin_button); mRegisterButton = (Button) findViewById(R.id.register_button); mBrowseButton = (Button) findViewById(R.id.browse_button); mWeiboSigninButton = (Button) findViewById(R.id.weibo_signin_button); if (savedInstanceState != null) { if (savedInstanceState.containsKey(SIS_RUNNING_KEY)) { if (savedInstanceState.getBoolean(SIS_RUNNING_KEY)) { Log.d(TAG, "Was previously logging in. Restart action."); doLogin(); } } } mSigninButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { doLogin(); } }); mRegisterButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(LoginActivity.this, RegisterActivity.class); startActivity(intent); // finish(); } }); // mBrowseButton.setOnClickListener(new View.OnClickListener() { // public void onClick(View v) { // Intent intent = new Intent(LoginActivity.this, BrowseActivity.class); // startActivity(intent); // // finish(); // } // }); // mWeiboSigninButton.setOnClickListener(new View.OnClickListener() { // // @Override // public void onClick(View v) { // mSsoHandler = new SsoHandler(LoginActivity.this, mWeibo); // mSsoHandler.authorize(new AuthDialogListener(), null); // } // }); }