Example usage for android.view Window FEATURE_PROGRESS

List of usage examples for android.view Window FEATURE_PROGRESS

Introduction

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

Prototype

int FEATURE_PROGRESS

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

Click Source Link

Document

Flag for the progress indicator feature.

Usage

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

@Override
public boolean requestWindowFeature(int featureId) {
    switch (featureId) {
    case FEATURE_ACTION_BAR:
        throwFeatureRequestIfSubDecorInstalled();
        mHasActionBar = true;//  w w w.j  a v a  2s . c o m
        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   www . j  av a  2 s.co 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 setProgressBarVisibility(boolean visible) {
    if (DEBUG)/*  w ww  . j a  va2s  . co m*/
        Log.d(TAG, "[setProgressBarVisibility] visible: " + visible);

    setFeatureInt(Window.FEATURE_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 ww  w.  j  a  v  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:com.actionbarsherlock.internal.ActionBarSherlockCompat.java

@Override
public void setProgressBarIndeterminate(boolean indeterminate) {
    if (DEBUG)//from   ww  w.j  a  v  a2s . 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

@Override
public void setProgress(int progress) {
    if (DEBUG)/*from   ww w  .  j a  v  a 2  s  .  c o m*/
        Log.d(TAG, "[setProgress] progress: " + progress);

    setFeatureInt(Window.FEATURE_PROGRESS, progress + Window.PROGRESS_START);
}

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 .ja va  2 s.c o m*/
    return mWindow.hasFeature(featureId);
}

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

@Override
public void setSecondaryProgress(int secondaryProgress) {
    if (DEBUG)//  w  w w. ja  va  2s. 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 onIntChanged(int featureId, int value) {
    if (featureId == Window.FEATURE_PROGRESS || featureId == Window.FEATURE_INDETERMINATE_PROGRESS) {
        updateProgressBars(value);/*from   w  w w  . ja  v  a2 s .c  o m*/
    }
}

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);
        }/*  w  ww .  j  a  va2  s.c  om*/
        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);
    }
}