Example usage for android.view Window PROGRESS_SECONDARY_START

List of usage examples for android.view Window PROGRESS_SECONDARY_START

Introduction

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

Prototype

int PROGRESS_SECONDARY_START

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

Click Source Link

Document

Lowest possible value for the secondary progress.

Usage

From source file:com.actionbarsherlock.internal.ActionBarSherlockCompat.java

@Override
public void setSecondaryProgress(int secondaryProgress) {
    if (DEBUG)/* w w w. j  a  va2 s. c  o m*/
        Log.d(TAG, "[setSecondaryProgress] secondaryProgress: " + secondaryProgress);

    setFeatureInt(Window.FEATURE_PROGRESS, secondaryProgress + Window.PROGRESS_SECONDARY_START);
}

From source file:com.actionbarsherlock.internal.ActionBarSherlockCompat.java

private void updateProgressBars(int value) {
    IcsProgressBar circularProgressBar = getCircularProgressBar(true);
    IcsProgressBar horizontalProgressBar = getHorizontalProgressBar(true);

    final int features = mFeatures;//getLocalFeatures();
    if (value == Window.PROGRESS_VISIBILITY_ON) {
        if ((features & (1 << Window.FEATURE_PROGRESS)) != 0) {
            int level = horizontalProgressBar.getProgress();
            int visibility = (horizontalProgressBar.isIndeterminate() || level < 10000) ? View.VISIBLE
                    : View.INVISIBLE;
            horizontalProgressBar.setVisibility(visibility);
        }//from  w ww.  j av a2 s . c o m
        if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0) {
            circularProgressBar.setVisibility(View.VISIBLE);
        }
    } else if (value == Window.PROGRESS_VISIBILITY_OFF) {
        if ((features & (1 << Window.FEATURE_PROGRESS)) != 0) {
            horizontalProgressBar.setVisibility(View.GONE);
        }
        if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0) {
            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);
        }
    } else if (Window.PROGRESS_SECONDARY_START <= value && value <= Window.PROGRESS_SECONDARY_END) {
        horizontalProgressBar.setSecondaryProgress(value - Window.PROGRESS_SECONDARY_START);

        showProgressBars(horizontalProgressBar, circularProgressBar);
    }
}

From source file:android.app.Activity.java

/**
 * Sets the secondary progress for the progress bar in the title. This
 * progress is drawn between the primary progress (set via
 * {@link #setProgress(int)} and the background. It can be ideal for media
 * scenarios such as showing the buffering progress while the default
 * progress shows the play progress./*from   w  ww  .  j a v  a 2  s.c o  m*/
 * <p>
 * In order for the progress bar to be shown, the feature must be requested
 * via {@link #requestWindowFeature(int)}.
 * 
 * @param secondaryProgress The secondary progress for the progress bar. Valid ranges are from
 *            0 to 10000 (both inclusive).
 */
public final void setSecondaryProgress(int secondaryProgress) {
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, secondaryProgress + Window.PROGRESS_SECONDARY_START);
}