FileDocCategorySizeDatePackage
ProgressBarWrapper.javaAPI DocAndroid 5.1 API2255Thu Mar 12 22:22:52 GMT 2015com.android.ex.photo.views

ProgressBarWrapper

public class ProgressBarWrapper extends Object
This class wraps around two progress bars and is solely designed to fix a bug in the framework (b/6928449) that prevents a progress bar from gracefully switching back and forth between indeterminate and determinate modes.

Fields Summary
private final android.widget.ProgressBar
mDeterminate
private final android.widget.ProgressBar
mIndeterminate
private boolean
mIsIndeterminate
Constructors Summary
public ProgressBarWrapper(android.widget.ProgressBar determinate, android.widget.ProgressBar indeterminate, boolean isIndeterminate)

        mDeterminate = determinate;
        mIndeterminate = indeterminate;
        setIndeterminate(isIndeterminate);
    
Methods Summary
public voidsetIndeterminate(boolean isIndeterminate)

        mIsIndeterminate = isIndeterminate;

        setVisibility(mIsIndeterminate);
    
public voidsetMax(int max)

        mDeterminate.setMax(max);
    
public voidsetProgress(int progress)

        mDeterminate.setProgress(progress);
    
public voidsetVisibility(int visibility)

        if (visibility == View.INVISIBLE || visibility == View.GONE) {
            mIndeterminate.setVisibility(visibility);
            mDeterminate.setVisibility(visibility);
        } else {
            setVisibility(mIsIndeterminate);
        }
    
private voidsetVisibility(boolean isIndeterminate)

        mIndeterminate.setVisibility(isIndeterminate ? View.VISIBLE : View.GONE);
        mDeterminate.setVisibility(isIndeterminate ? View.GONE : View.VISIBLE);