List of usage examples for android.view Window FEATURE_INDETERMINATE_PROGRESS
int FEATURE_INDETERMINATE_PROGRESS
To view the source code for android.view Window FEATURE_INDETERMINATE_PROGRESS.
Click Source Link
From source file:com.jtechme.apphub.AppDetailsData.java
@Override protected void onCreate(Bundle savedInstanceState) { fdroidApp = (FDroidApp) getApplication(); fdroidApp.applyTheme(this); super.onCreate(savedInstanceState); // Must be called *after* super.onCreate(), as that is where the action bar // compat implementation is assigned in the ActionBarActivity base class. supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); Intent intent = getIntent();// w ww. j a va 2 s . c o m if (intent.hasExtra(EXTRA_FROM)) { setTitle(intent.getStringExtra(EXTRA_FROM)); } mPm = getPackageManager(); installer = Installer.getActivityInstaller(this, mPm, myInstallerCallback); // Get the preferences we're going to use in this Activity... ConfigurationChangeHelper previousData = (ConfigurationChangeHelper) getLastCustomNonConfigurationInstance(); if (previousData != null) { Utils.debugLog(TAG, "Recreating view after configuration change."); downloadHandler = previousData.downloader; if (downloadHandler != null) { Utils.debugLog(TAG, "Download was in progress before the configuration change, so we will start to listen to its events again."); } app = previousData.app; setApp(app); } else { if (!reset(getPackageNameFromIntent(intent))) { finish(); return; } } // Set up the list... adapter = new ApkListAdapter(this, app); // Wait until all other intialization before doing this, because it will create the // fragments, which rely on data from the activity that is set earlier in this method. setContentView(R.layout.app_details); getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Check for the presence of a view which only exists in the landscape view. // This seems to be the preferred way to interrogate the view, rather than // to check the orientation. I guess this is because views can be dynamically // chosen based on more than just orientation (e.g. large screen sizes). View onlyInLandscape = findViewById(R.id.app_summary_container); AppDetailsListFragment listFragment = (AppDetailsListFragment) getSupportFragmentManager() .findFragmentById(R.id.fragment_app_list); if (onlyInLandscape == null) { listFragment.setupSummaryHeader(); } else { listFragment.removeSummaryHeader(); } localBroadcastManager = LocalBroadcastManager.getInstance(this); // Check if a download is running for this app if (AsyncDownloaderFromAndroid.isDownloading(this, app.packageName) >= 0) { // call install() to re-setup the listeners and downloaders // the AsyncDownloader will not restart the download since the download is running, // and thus the version we pass to install() is not important refreshHeader(); refreshApkList(); final Apk apkToInstall = ApkProvider.Helper.find(this, app.packageName, app.suggestedVercode); install(apkToInstall); } }
From source file:id.ridon.keude.AppDetailsData.java
@Override protected void onCreate(Bundle savedInstanceState) { fdroidApp = ((KeudeApp) getApplication()); fdroidApp.applyTheme(this); super.onCreate(savedInstanceState); // Must be called *after* super.onCreate(), as that is where the action bar // compat implementation is assigned in the ActionBarActivity base class. supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); if (getIntent().hasExtra(EXTRA_FROM)) { setTitle(getIntent().getStringExtra(EXTRA_FROM)); }//from w ww. j a v a2 s . co m mPm = getPackageManager(); installer = Installer.getActivityInstaller(this, mPm, myInstallerCallback); // Get the preferences we're going to use in this Activity... ConfigurationChangeHelper previousData = (ConfigurationChangeHelper) getLastCustomNonConfigurationInstance(); if (previousData != null) { Log.d(TAG, "Recreating view after configuration change."); downloadHandler = previousData.downloader; if (downloadHandler != null) { Log.d(TAG, "Download was in progress before the configuration change, so we will start to listen to its events again."); } app = previousData.app; setApp(app); } else { if (!reset(getAppIdFromIntent())) { finish(); return; } } // Set up the list... adapter = new ApkListAdapter(this, app); // Wait until all other intialization before doing this, because it will create the // fragments, which rely on data from the activity that is set earlier in this method. setContentView(R.layout.app_details); getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Check for the presence of a view which only exists in the landscape view. // This seems to be the preferred way to interrogate the view, rather than // to check the orientation. I guess this is because views can be dynamically // chosen based on more than just orientation (e.g. large screen sizes). View onlyInLandscape = findViewById(R.id.app_summary_container); AppDetailsListFragment listFragment = (AppDetailsListFragment) getSupportFragmentManager() .findFragmentById(R.id.fragment_app_list); if (onlyInLandscape == null) { listFragment.setupSummaryHeader(); } else { listFragment.removeSummaryHeader(); } // Spinner seems to default to visible on Android 4.0.3 and 4.0.4 // https://gitlab.com/fdroid/fdroidclient/issues/75 // Can't put this in onResume(), because that is called on return from asking // the user permission to use su (in which case we still want to show the // progress indicator after returning from that prompt). setSupportProgressBarIndeterminateVisibility(false); }
From source file:net.lp.actionbarpoirot.helpers.ActivityHelper.java
/** * Show the action bar circular (indeterminate) progress bar. *///ww w . j a v a 2s.co m public void requestProgressBar() { // Request progress bar mActivity.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); if (!UiUtilities.hasAcceptableNativeActionBar()) mActivity.requestWindowFeature(Window.FEATURE_NO_TITLE); mActivity.setProgressBarIndeterminateVisibility(true); }
From source file:android.support.v7ox.app.AppCompatDelegateImplV7.java
private ViewGroup createSubDecor() { TypedArray a = mContext.obtainStyledAttributes(R.styleable.AppCompatTheme); if (!a.hasValue(R.styleable.AppCompatTheme_windowActionBar_ox)) { a.recycle();/* w ww. ja v a 2 s.c o m*/ throw new IllegalStateException( "You need to use a Theme.AppCompat theme (or descendant) with this activity."); } if (a.getBoolean(R.styleable.AppCompatTheme_windowNoTitle_ox, false)) { requestWindowFeature(Window.FEATURE_NO_TITLE); } else if (a.getBoolean(R.styleable.AppCompatTheme_windowActionBar_ox, false)) { // Don't allow an action bar if there is no title. requestWindowFeature(FEATURE_SUPPORT_ACTION_BAR); } if (a.getBoolean(R.styleable.AppCompatTheme_windowActionBarOverlay_ox, false)) { requestWindowFeature(FEATURE_SUPPORT_ACTION_BAR_OVERLAY); } if (a.getBoolean(R.styleable.AppCompatTheme_windowActionModeOverlay_ox, false)) { requestWindowFeature(FEATURE_ACTION_MODE_OVERLAY); } mIsFloating = a.getBoolean(R.styleable.AppCompatTheme_android_windowIsFloating, false); a.recycle(); final LayoutInflater inflater = LayoutInflater.from(mContext); ViewGroup subDecor = null; if (!mWindowNoTitle) { if (mIsFloating) { // If we're floating, inflate the dialog title decor subDecor = (ViewGroup) inflater.inflate(R.layout.abc_dialog_title_material, null); // Floating windows can never have an action bar, reset the flags mHasActionBar = mOverlayActionBar = false; } else if (mHasActionBar) { /** * This needs some explanation. As we can not use the android:theme attribute * pre-L, we emulate it by manually creating a LayoutInflater using a * ContextThemeWrapper pointing to actionBarTheme. */ TypedValue outValue = new TypedValue(); mContext.getTheme().resolveAttribute(R.attr.actionBarTheme_ox, outValue, true); Context themedContext; if (outValue.resourceId != 0) { themedContext = new ContextThemeWrapper(mContext, outValue.resourceId); } else { themedContext = mContext; } // Now inflate the view using the themed context and set it as the content view subDecor = (ViewGroup) LayoutInflater.from(themedContext).inflate(R.layout.abc_screen_toolbar, null); mDecorContentParent = (DecorContentParent) subDecor.findViewById(R.id.decor_content_parent); mDecorContentParent.setWindowCallback(getWindowCallback()); /** * Propagate features to DecorContentParent */ if (mOverlayActionBar) { mDecorContentParent.initFeature(FEATURE_SUPPORT_ACTION_BAR_OVERLAY); } if (mFeatureProgress) { mDecorContentParent.initFeature(Window.FEATURE_PROGRESS); } if (mFeatureIndeterminateProgress) { mDecorContentParent.initFeature(Window.FEATURE_INDETERMINATE_PROGRESS); } } } else { if (mOverlayActionMode) { subDecor = (ViewGroup) inflater.inflate(R.layout.abc_screen_simple_overlay_action_mode, null); } else { subDecor = (ViewGroup) inflater.inflate(R.layout.abc_screen_simple, null); } if (Build.VERSION.SDK_INT >= 21) { // If we're running on L or above, we can rely on ViewCompat's // setOnApplyWindowInsetsListener ViewCompat.setOnApplyWindowInsetsListener(subDecor, new OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { final int top = insets.getSystemWindowInsetTop(); final int newTop = updateStatusGuard(top); if (top != newTop) { insets = insets.replaceSystemWindowInsets(insets.getSystemWindowInsetLeft(), newTop, insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); } // Now apply the insets on our view return ViewCompat.onApplyWindowInsets(v, insets); } }); } else { // Else, we need to use our own FitWindowsViewGroup handling ((FitWindowsViewGroup) subDecor) .setOnFitSystemWindowsListener(new FitWindowsViewGroup.OnFitSystemWindowsListener() { @Override public void onFitSystemWindows(Rect insets) { insets.top = updateStatusGuard(insets.top); } }); } } if (subDecor == null) { throw new IllegalArgumentException("AppCompat does not support the current theme features: { " + "windowActionBar: " + mHasActionBar + ", windowActionBarOverlay: " + mOverlayActionBar + ", android:windowIsFloating: " + mIsFloating + ", windowActionModeOverlay: " + mOverlayActionMode + ", windowNoTitle: " + mWindowNoTitle + " }"); } if (mDecorContentParent == null) { mTitleView = (TextView) subDecor.findViewById(R.id.title); } // Make the decor optionally fit system windows, like the window's decor ViewUtils.makeOptionalFitsSystemWindows(subDecor); final ViewGroup decorContent = (ViewGroup) mWindow.findViewById(android.R.id.content); final ContentFrameLayout abcContent = (ContentFrameLayout) subDecor .findViewById(R.id.action_bar_activity_content); // There might be Views already added to the Window's content view so we need to // migrate them to our content view while (decorContent.getChildCount() > 0) { final View child = decorContent.getChildAt(0); decorContent.removeViewAt(0); abcContent.addView(child); } // Now set the Window's content view with the decor mWindow.setContentView(subDecor); // Change our content FrameLayout to use the android.R.id.content id. // Useful for fragments. decorContent.setId(View.NO_ID); abcContent.setId(android.R.id.content); // The decorContent may have a foreground drawable set (windowContentOverlay). // Remove this as we handle it ourselves if (decorContent instanceof FrameLayout) { decorContent.setForeground(null); } abcContent.setAttachListener(new ContentFrameLayout.OnAttachListener() { @Override public void onAttachedFromWindow() { } @Override public void onDetachedFromWindow() { dismissPopups(); } }); return subDecor; }
From source file:org.junit4android.JunitTestRunnerActivity.java
/** * {@inheritDoc}/* w ww. j ava 2 s . co m*/ * * @see android.app.Activity#onCreate(android.os.Bundle) */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Progressbar in the status bar requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.junittestrunner); // wiring the listview with its adapter testListView = (ExpandableListView) findViewById(R.id.expandableListView); testListAdapter = new ExpandableTestListAdapter(); testListView.setAdapter(testListAdapter); startButton = (Button) findViewById(R.id.startButton); testNameTextView = (TextView) findViewById(R.id.suiteNameTextView); progressBar = (ProgressBar) findViewById(R.id.progressBar); testListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { JunitTestResult result = testListAdapter.getChild(groupPosition, childPosition); testResult4Detail = result; startActivity(new Intent(JunitTestRunnerActivity.this, TestResultDetailActivity.class)); return true; } }); registerForContextMenu(testListView); loadAutorunFlag(); try { testClass = loadTestClass(); testNameTextView.setText(testClass.getName()); } catch (Exception e) { startButton.setEnabled(false); Toast.makeText(JunitTestRunnerActivity.this, e.getClass().getSimpleName() + "\nwhen loading the test (suite):\n\"" + e.getMessage() + "\"", Toast.LENGTH_LONG).show(); testNameTextView.setSingleLine(false); testNameTextView.setText(e.getClass().getSimpleName() + ": " + e.getMessage()); testNameTextView.setTextColor(Color.RED); Log.e(LOGTAG, "Error loading the test class: ", e); } }
From source file:android.support.v7.app.AppCompatDelegateImplV7.java
@Override public boolean requestWindowFeature(int featureId) { switch (featureId) { case FEATURE_ACTION_BAR: throwFeatureRequestIfSubDecorInstalled(); mHasActionBar = true;/* ww w.j av a2s. com*/ return true; case FEATURE_ACTION_BAR_OVERLAY: throwFeatureRequestIfSubDecorInstalled(); mOverlayActionBar = true; return true; case FEATURE_ACTION_MODE_OVERLAY: throwFeatureRequestIfSubDecorInstalled(); mOverlayActionMode = true; return true; case Window.FEATURE_PROGRESS: throwFeatureRequestIfSubDecorInstalled(); mFeatureProgress = true; return true; case Window.FEATURE_INDETERMINATE_PROGRESS: throwFeatureRequestIfSubDecorInstalled(); mFeatureIndeterminateProgress = true; return true; } return mWindow.requestFeature(featureId); }
From source file:android.support.v7ox.widget.ActionBarOverlayLayout.java
@Override public void initFeature(int windowFeature) { pullChildren();//from w w w . j a va 2s. c o m switch (windowFeature) { case Window.FEATURE_PROGRESS: mDecorToolbar.initProgress(); break; case Window.FEATURE_INDETERMINATE_PROGRESS: mDecorToolbar.initIndeterminateProgress(); break; case AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR_OVERLAY: setOverlayMode(true); break; } }
From source file:com.actionbarsherlock.internal.ActionBarSherlockCompat.java
@Override public void setProgressBarIndeterminateVisibility(boolean visible) { if (DEBUG)//from w ww.java 2 s .c om Log.d(TAG, "[setProgressBarIndeterminateVisibility] visible: " + visible); setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS, visible ? Window.PROGRESS_VISIBILITY_ON : Window.PROGRESS_VISIBILITY_OFF); }
From source file:android.support.v7ox.app.AppCompatDelegateImplV7.java
@Override public boolean requestWindowFeature(int featureId) { featureId = sanitizeWindowFeatureId(featureId); if (mWindowNoTitle && featureId == FEATURE_SUPPORT_ACTION_BAR) { return false; // Ignore. No title dominates. }//from w w w . j av a2 s. c o m if (mHasActionBar && featureId == Window.FEATURE_NO_TITLE) { // Remove the action bar feature if we have no title. No title dominates. mHasActionBar = false; } switch (featureId) { case FEATURE_SUPPORT_ACTION_BAR: throwFeatureRequestIfSubDecorInstalled(); mHasActionBar = true; return true; case FEATURE_SUPPORT_ACTION_BAR_OVERLAY: throwFeatureRequestIfSubDecorInstalled(); mOverlayActionBar = true; return true; case FEATURE_ACTION_MODE_OVERLAY: throwFeatureRequestIfSubDecorInstalled(); mOverlayActionMode = true; return true; case Window.FEATURE_PROGRESS: throwFeatureRequestIfSubDecorInstalled(); mFeatureProgress = true; return true; case Window.FEATURE_INDETERMINATE_PROGRESS: throwFeatureRequestIfSubDecorInstalled(); mFeatureIndeterminateProgress = true; return true; case Window.FEATURE_NO_TITLE: throwFeatureRequestIfSubDecorInstalled(); mWindowNoTitle = true; return true; } return mWindow.requestFeature(featureId); }
From source file:android.support.v7ox.app.AppCompatDelegateImplV7.java
@Override public boolean hasWindowFeature(int featureId) { featureId = sanitizeWindowFeatureId(featureId); switch (featureId) { case FEATURE_SUPPORT_ACTION_BAR: return mHasActionBar; case FEATURE_SUPPORT_ACTION_BAR_OVERLAY: return mOverlayActionBar; case FEATURE_ACTION_MODE_OVERLAY: return mOverlayActionMode; case Window.FEATURE_PROGRESS: return mFeatureProgress; case Window.FEATURE_INDETERMINATE_PROGRESS: return mFeatureIndeterminateProgress; case Window.FEATURE_NO_TITLE: return mWindowNoTitle; }// ww w. j a va2 s.c o m return mWindow.hasFeature(featureId); }