Example usage for android.view Window FEATURE_INDETERMINATE_PROGRESS

List of usage examples for android.view Window FEATURE_INDETERMINATE_PROGRESS

Introduction

In this page you can find the example usage for android.view Window FEATURE_INDETERMINATE_PROGRESS.

Prototype

int FEATURE_INDETERMINATE_PROGRESS

To view the source code for android.view Window FEATURE_INDETERMINATE_PROGRESS.

Click Source Link

Document

Flag for indeterminate progress.

Usage

From source file:com.googlecode.android_scripting.activity.Main.java

protected void initializeViews() {
    LinearLayout layout = new LinearLayout(this);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    layout.setGravity(Gravity.CENTER_HORIZONTAL);
    TextView textview = new TextView(this);
    textview.setText(" PhpForAndroid " + version);
    ImageView imageView = new ImageView(this);
    imageView.setImageDrawable(getResources().getDrawable(R.drawable.pfa));
    layout.addView(imageView);/*w  ww  . j  av a 2 s.  c om*/
    mButton = new Button(this);
    mAboutButton = new Button(this);
    MarginLayoutParams marginParams = new MarginLayoutParams(LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT);
    final float scale = getResources().getDisplayMetrics().density;
    int marginPixels = (int) (MARGIN_DIP * scale + 0.5f);
    marginParams.setMargins(marginPixels, marginPixels, marginPixels, marginPixels);
    mButton.setLayoutParams(marginParams);
    mAboutButton.setLayoutParams(marginParams);
    layout.addView(textview);
    layout.addView(mButton);
    layout.addView(mAboutButton);

    mProgressLayout = new LinearLayout(this);
    mProgressLayout.setOrientation(LinearLayout.HORIZONTAL);
    mProgressLayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    mProgressLayout.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL);

    LinearLayout bottom = new LinearLayout(this);
    bottom.setOrientation(LinearLayout.HORIZONTAL);
    bottom.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    bottom.setGravity(Gravity.CENTER_VERTICAL);
    mProgressLayout.addView(bottom);

    TextView message = new TextView(this);
    message.setText("   In Progress...");
    message.setTextSize(20);
    message.setTypeface(Typeface.DEFAULT_BOLD);
    message.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    ProgressBar bar = new ProgressBar(this);
    bar.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

    bottom.addView(bar);
    bottom.addView(message);
    mProgressLayout.setVisibility(View.INVISIBLE);

    layout.addView(mProgressLayout);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setProgressBarIndeterminateVisibility(false);

    setContentView(layout);
}

From source file:org.appcelerator.titanium.TiBaseActivity.java

protected void setNavBarHidden(boolean hidden) {
    if (!hidden) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
            // Do not enable these features on Honeycomb or later since it will break the action bar.
            this.requestWindowFeature(Window.FEATURE_LEFT_ICON);
            this.requestWindowFeature(Window.FEATURE_RIGHT_ICON);
        }//w  w  w  .  j a  va 2 s .  c om

        this.requestWindowFeature(Window.FEATURE_PROGRESS);
        this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    } else {
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    }
}

From source file:android.support.v7.app.AppCompatDelegateImplV7.java

private void ensureSubDecor() {
    if (!mSubDecorInstalled) {
        final LayoutInflater inflater = LayoutInflater.from(mContext);

        if (!mWindowNoTitle) {
            if (mIsFloating) {
                // If we're floating, inflate the dialog title decor
                mSubDecor = (ViewGroup) inflater.inflate(R.layout.abc_dialog_title_material, null);
            } else if (mHasActionBar) {
                /**/*from w w  w.  j a va  2s.  co  m*/
                 * 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, 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
                mSubDecor = (ViewGroup) LayoutInflater.from(themedContext).inflate(R.layout.abc_screen_toolbar,
                        null);

                mDecorContentParent = (DecorContentParent) mSubDecor.findViewById(R.id.decor_content_parent);
                mDecorContentParent.setWindowCallback(getWindowCallback());

                /**
                 * Propagate features to DecorContentParent
                 */
                if (mOverlayActionBar) {
                    mDecorContentParent.initFeature(FEATURE_ACTION_BAR_OVERLAY);
                }
                if (mFeatureProgress) {
                    mDecorContentParent.initFeature(Window.FEATURE_PROGRESS);
                }
                if (mFeatureIndeterminateProgress) {
                    mDecorContentParent.initFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
                }
            }
        } else {
            if (mOverlayActionMode) {
                mSubDecor = (ViewGroup) inflater.inflate(R.layout.abc_screen_simple_overlay_action_mode, null);
            } else {
                mSubDecor = (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(mSubDecor, 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) mSubDecor)
                        .setOnFitSystemWindowsListener(new FitWindowsViewGroup.OnFitSystemWindowsListener() {
                            @Override
                            public void onFitSystemWindows(Rect insets) {
                                insets.top = updateStatusGuard(insets.top);
                            }
                        });
            }
        }

        if (mSubDecor == null) {
            throw new IllegalArgumentException("AppCompat does not support the current theme features");
        }

        if (mDecorContentParent == null) {
            mTitleView = (TextView) mSubDecor.findViewById(R.id.title);
        }

        // Make the decor optionally fit system windows, like the window's decor
        ViewUtils.makeOptionalFitsSystemWindows(mSubDecor);

        final ViewGroup decorContent = (ViewGroup) mWindow.findViewById(android.R.id.content);
        final ViewGroup abcContent = (ViewGroup) mSubDecor.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(mSubDecor);

        // 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) {
            ((FrameLayout) decorContent).setForeground(null);
        }

        // If a title was set before we installed the decor, propogate it now
        CharSequence title = getTitle();
        if (!TextUtils.isEmpty(title)) {
            onTitleChanged(title);
        }

        applyFixedSizeWindow();

        onSubDecorInstalled(mSubDecor);

        mSubDecorInstalled = true;

        // Invalidate if the panel menu hasn't been created before this.
        // Panel menu invalidation is deferred avoiding application onCreateOptionsMenu
        // being called in the middle of onCreate or similar.
        // A pending invalidation will typically be resolved before the posted message
        // would run normally in order to satisfy instance state restoration.
        PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, false);
        if (!isDestroyed() && (st == null || st.menu == null)) {
            invalidatePanelMenu(FEATURE_ACTION_BAR);
        }
    }
}

From source file:org.mariotaku.twidere.activity.support.UserProfileEditorActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    super.onCreate(savedInstanceState);
    final Intent intent = getIntent();
    final long accountId = intent.getLongExtra(EXTRA_ACCOUNT_ID, -1);
    if (!isMyAccount(this, accountId)) {
        finish();/*from   w w w .  j  a v  a  2s. c  o m*/
        return;
    }
    mAsyncTaskManager = TwidereApplication.getInstance(this).getAsyncTaskManager();
    mLazyImageLoader = TwidereApplication.getInstance(this).getImageLoaderWrapper();
    mAccountId = accountId;
    setContentView(R.layout.edit_user_profile);
    // setOverrideExitAniamtion(false);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    mProfileImageBannerLayout.setOnSizeChangedListener(this);
    mEditName.addTextChangedListener(this);
    mEditDescription.addTextChangedListener(this);
    mEditLocation.addTextChangedListener(this);
    mEditUrl.addTextChangedListener(this);
    mProfileImageView.setOnClickListener(this);
    mProfileBannerView.setOnClickListener(this);
    if (savedInstanceState != null && savedInstanceState.getParcelable(EXTRA_USER) != null) {
        final ParcelableUser user = savedInstanceState.getParcelable(EXTRA_USER);
        displayUser(user);
        mEditName.setText(savedInstanceState.getString(EXTRA_NAME, user.name));
        mEditLocation.setText(savedInstanceState.getString(EXTRA_LOCATION, user.location));
        mEditDescription.setText(savedInstanceState.getString(EXTRA_DESCRIPTION, user.description_expanded));
        mEditUrl.setText(savedInstanceState.getString(EXTRA_URL, user.url_expanded));
    } else {
        getUserInfo();
    }
}

From source file:de.vanita5.twittnuker.activity.support.UserProfileEditorActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    super.onCreate(savedInstanceState);
    final Intent intent = getIntent();
    final long accountId = intent.getLongExtra(EXTRA_ACCOUNT_ID, -1);
    if (!isMyAccount(this, accountId)) {
        finish();/*from  w  w  w. ja  va  2s.c  o  m*/
        return;
    }
    mAsyncTaskManager = TwittnukerApplication.getInstance(this).getAsyncTaskManager();
    mLazyImageLoader = TwittnukerApplication.getInstance(this).getImageLoaderWrapper();
    mAccountId = accountId;
    setContentView(R.layout.edit_user_profile);
    // setOverrideExitAniamtion(false);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    mProfileImageBannerLayout.setOnSizeChangedListener(this);
    mEditName.addTextChangedListener(this);
    mEditDescription.addTextChangedListener(this);
    mEditLocation.addTextChangedListener(this);
    mEditUrl.addTextChangedListener(this);
    mProfileImageView.setOnClickListener(this);
    mProfileBannerView.setOnClickListener(this);
    if (savedInstanceState != null && savedInstanceState.getParcelable(EXTRA_USER) != null) {
        final ParcelableUser user = savedInstanceState.getParcelable(EXTRA_USER);
        displayUser(user);
        mEditName.setText(savedInstanceState.getString(EXTRA_NAME, user.name));
        mEditLocation.setText(savedInstanceState.getString(EXTRA_LOCATION, user.location));
        mEditDescription.setText(savedInstanceState.getString(EXTRA_DESCRIPTION, user.description_expanded));
        mEditUrl.setText(savedInstanceState.getString(EXTRA_URL, user.url_expanded));
    } else {
        getUserInfo();
    }
}

From source file:au.org.intersect.faims.android.ui.activity.ShowModuleActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.activity_show_module);

    // inject faimsClient and serverDiscovery
    RoboGuice.getBaseApplicationInjector(this.getApplication()).injectMembers(this);

    // initialize server discovery
    serverDiscovery.setApplication(getApplication());

    // Need to register license for the map view before create an instance of map view
    CustomMapView.registerLicense(getApplicationContext());

    this.activityData = new ShowModuleActivityData();

    rotation = AnimationUtils.loadAnimation(this, R.anim.clockwise);
    rotation.setRepeatCount(Animation.INFINITE);

    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    syncAnimImage = (ImageView) inflater.inflate(R.layout.rotate, null);

    setupSync();/*w  w  w  . j a  v  a  2 s .  c  o m*/
    setupWifiBroadcast();
    setupModule();
    setProgressBarIndeterminateVisibility(false);

    // set file browser to reset last location when activity is created
    DisplayPrefs.setLastLocation(ShowModuleActivity.this, getModuleDir());

    busyDialog = new BusyDialog(this, getString(R.string.load_module_title),
            getString(R.string.load_module_message), null);
    busyDialog.show();

    new AsyncTask<Void, Void, Void>() {

        @Override
        protected void onPostExecute(Void result) {
            renderUI(savedInstanceState);
            busyDialog.dismiss();
        }

        @Override
        protected Void doInBackground(Void... params) {
            preRenderUI();
            return null;
        };

    }.execute();
}

From source file:org.fdroid.fdroid.AppDetails.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();//www  .  j a  va  2  s  .  co  m
    if (intent.hasExtra(EXTRA_FROM)) {
        setTitle(intent.getStringExtra(EXTRA_FROM));
    }

    packageManager = getPackageManager();

    installer = Installer.getActivityInstaller(this, packageManager, 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.");
        activeDownloadUrlString = previousData.urlString;
        if (activeDownloadUrlString != 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);
}

From source file:com.example.mydemos.view.RingtonePickerActivity.java

private void setViewPager() {
    // need cancel these feature in onCreate
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    final ActionBar bar = getActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    mViewPager = (ViewPager) findViewById(R.id.pager);
    //using TabsPageAdapter
    mTabsAdapter = new TabsPageAdapter(this, mViewPager);

    mViewPager.setAdapter(mTabsAdapter);
    mViewPager.setOnPageChangeListener(mTabsAdapter);

    ActionBar actionBar = this.getActionBar();
    Tab tab1 = actionBar.newTab();/*  www  . j  ava2s .com*/
    mTabsAdapter.addTab(tab1, TabContentFragment.class, null);
    Tab tab2 = actionBar.newTab();
    mTabsAdapter.addTab(tab2, TabContentFragment.class, null);
}

From source file:de.ub0r.android.callmeter.ui.Plans.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setTheme(Preferences.getTheme(this));
    Utils.setLocale(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.plans);//from ww  w .  ja  va2 s .com
    getSupportActionBar().setHomeButtonEnabled(true);

    SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(this);
    //noinspection ConstantConditions
    if (p.getAll().isEmpty()) {
        // show intro
        startActivity(new Intent(this, IntroActivity.class));
        // set date of recordings to beginning of last month
        Calendar c = Calendar.getInstance();
        c.set(Calendar.DAY_OF_MONTH, 0);
        c.add(Calendar.MONTH, -1);
        Log.i(TAG, "set date of recording: " + c);
        p.edit().putLong(Preferences.PREFS_DATE_BEGIN, c.getTimeInMillis()).apply();
    }

    pager = (ViewPager) findViewById(R.id.pager);

    prefsNoAds = DonationHelper.hideAds(this);
    mAdView = (AdView) findViewById(R.id.ads);
    mAdView.setVisibility(View.GONE);
    if (!prefsNoAds) {
        mAdView.loadAd(new AdRequest.Builder().build());
        mAdView.setAdListener(new AdListener() {
            @Override
            public void onAdLoaded() {
                mAdView.setVisibility(View.VISIBLE);
                super.onAdLoaded();
            }
        });
    } else {
        findViewById(R.id.cookieconsent).setVisibility(View.GONE);
    }

    initAdapter();
}