Example usage for android.view Window PROGRESS_START

List of usage examples for android.view Window PROGRESS_START

Introduction

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

Prototype

int PROGRESS_START

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

Click Source Link

Document

Starting value for the (primary) progress.

Usage

From source file:com.andrewshu.android.reddit.threads.ThreadsListActivity.java

private void enableLoadingScreen() {
    if (Util.isLightTheme(mSettings.getTheme())) {
        findViewById(R.id.loading_light).setVisibility(View.VISIBLE);
        findViewById(R.id.loading_dark).setVisibility(View.GONE);
    } else {/* w ww .  ja v  a2s  .  c o  m*/
        findViewById(R.id.loading_light).setVisibility(View.GONE);
        findViewById(R.id.loading_dark).setVisibility(View.VISIBLE);
    }
    synchronized (THREAD_ADAPTER_LOCK) {
        if (mThreadsAdapter != null)
            mThreadsAdapter.mIsLoading = true;
    }
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_START);
}

From source file:lewa.support.v7.app.ActionBarActivityDelegateBase.java

/**
 * Progress Bar function. Mostly extracted from PhoneWindow.java
 *//*from ww  w .  jav  a2s  .c  o  m*/
private void updateProgressBars(int value) {
    ProgressBarICS circularProgressBar = getCircularProgressBar();
    ProgressBarICS horizontalProgressBar = getHorizontalProgressBar();

    if (value == Window.PROGRESS_VISIBILITY_ON) {
        if (mFeatureProgress) {
            int level = horizontalProgressBar.getProgress();
            int visibility = (horizontalProgressBar.isIndeterminate() || level < 10000) ? View.VISIBLE
                    : View.INVISIBLE;
            horizontalProgressBar.setVisibility(visibility);
        }
        if (mFeatureIndeterminateProgress) {
            circularProgressBar.setVisibility(View.VISIBLE);
        }
    } else if (value == Window.PROGRESS_VISIBILITY_OFF) {
        if (mFeatureProgress) {
            horizontalProgressBar.setVisibility(View.GONE);
        }
        if (mFeatureIndeterminateProgress) {
            circularProgressBar.setVisibility(View.GONE);
        }
    } else if (value == Window.PROGRESS_INDETERMINATE_ON) {
        horizontalProgressBar.setIndeterminate(true);
    } else if (value == Window.PROGRESS_INDETERMINATE_OFF) {
        horizontalProgressBar.setIndeterminate(false);
    } else if (Window.PROGRESS_START <= value && value <= Window.PROGRESS_END) {
        // We want to set the progress value before testing for visibility
        // so that when the progress bar becomes visible again, it has the
        // correct level.
        horizontalProgressBar.setProgress(value - Window.PROGRESS_START);

        if (value < Window.PROGRESS_END) {
            showProgressBars(horizontalProgressBar, circularProgressBar);
        } else {
            hideProgressBars(horizontalProgressBar, circularProgressBar);
        }
    }
}

From source file:android.app.Activity.java

/**
 * Sets the progress for the progress bars in the title.
 * <p>/*www . j  a v a2 s  .co m*/
 * In order for the progress bar to be shown, the feature must be requested
 * via {@link #requestWindowFeature(int)}.
 * 
 * @param progress The progress for the progress bar. Valid ranges are from
 *            0 to 10000 (both inclusive). If 10000 is given, the progress
 *            bar will be completely filled and will fade out.
 */
public final void setProgress(int progress) {
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, progress + Window.PROGRESS_START);
}