Example usage for android.view Window PROGRESS_INDETERMINATE_ON

List of usage examples for android.view Window PROGRESS_INDETERMINATE_ON

Introduction

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

Prototype

int PROGRESS_INDETERMINATE_ON

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

Click Source Link

Document

Flag for setting the progress bar's indeterminate mode on.

Usage

From source file:Main.java

public static void setSpinnerState(Activity a) {
    if (isMediaScannerScanning(a)) {
        // start the progress spinner
        a.getWindow().setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS, Window.PROGRESS_INDETERMINATE_ON);

        a.getWindow().setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);
    } else {//from   w w  w .  j  a  va  2 s.co  m
        // stop the progress spinner
        a.getWindow().setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS, Window.PROGRESS_VISIBILITY_OFF);
    }
}

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

@Override
void setSupportProgressBarIndeterminate(boolean indeterminate) {
    updateProgressBars(indeterminate ? Window.PROGRESS_INDETERMINATE_ON : Window.PROGRESS_INDETERMINATE_OFF);
}

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

/**
 * Progress Bar function. Mostly extracted from PhoneWindow.java
 *///from w ww  .  j a v  a2  s.co  m
private void updateProgressBars(int value) {
    ProgressBar circularProgressBar = getCircularProgressBar();
    ProgressBar 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:com.actionbarsherlock.internal.ActionBarSherlockCompat.java

@Override
public void setProgressBarIndeterminate(boolean indeterminate) {
    if (DEBUG)//from  w w w.j  av a2 s .  co m
        Log.d(TAG, "[setProgressBarIndeterminate] indeterminate: " + indeterminate);

    setFeatureInt(Window.FEATURE_PROGRESS,
            indeterminate ? Window.PROGRESS_INDETERMINATE_ON : Window.PROGRESS_INDETERMINATE_OFF);
}

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 w w .j a  v a  2s.  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:lewa.support.v7.app.ActionBarActivityDelegateBase.java

/**
 * Progress Bar function. Mostly extracted from PhoneWindow.java
 *//*  w ww  .ja  v  a  2 s .c  om*/
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 whether the horizontal progress bar in the title should be indeterminate (the circular
 * is always indeterminate)./*ww  w .  j  a va 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 indeterminate Whether the horizontal progress bar should be indeterminate.
 */
public final void setProgressBarIndeterminate(boolean indeterminate) {
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS,
            indeterminate ? Window.PROGRESS_INDETERMINATE_ON : Window.PROGRESS_INDETERMINATE_OFF);
}