FileDocCategorySizeDatePackage
ScrimView.javaAPI DocAndroid 5.1 API3907Thu Mar 12 22:22:42 GMT 2015com.android.systemui.statusbar

ScrimView

public class ScrimView extends android.view.View
A view which can draw a scrim

Fields Summary
private int
mScrimColor
private boolean
mIsEmpty
private boolean
mDrawAsSrc
private float
mViewAlpha
private android.animation.ValueAnimator
mAlphaAnimator
private ValueAnimator.AnimatorUpdateListener
mAlphaUpdateListener
private android.animation.AnimatorListenerAdapter
mClearAnimatorListener
Constructors Summary
public ScrimView(android.content.Context context)


       
        this(context, null);
    
public ScrimView(android.content.Context context, android.util.AttributeSet attrs)

        this(context, attrs, 0);
    
public ScrimView(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr)

        this(context, attrs, defStyleAttr, 0);
    
public ScrimView(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr, int defStyleRes)

        super(context, attrs, defStyleAttr, defStyleRes);
    
Methods Summary
public voidanimateViewAlpha(float alpha, long durationOut, android.view.animation.Interpolator interpolator)

        if (mAlphaAnimator != null) {
            mAlphaAnimator.cancel();
        }
        mAlphaAnimator = ValueAnimator.ofFloat(mViewAlpha, alpha);
        mAlphaAnimator.addUpdateListener(mAlphaUpdateListener);
        mAlphaAnimator.addListener(mClearAnimatorListener);
        mAlphaAnimator.setInterpolator(interpolator);
        mAlphaAnimator.setDuration(durationOut);
        mAlphaAnimator.start();
    
public intgetScrimColor()

        return mScrimColor;
    
public booleanhasOverlappingRendering()

        return false;
    
protected voidonDraw(android.graphics.Canvas canvas)

        if (mDrawAsSrc || (!mIsEmpty && mViewAlpha > 0f)) {
            PorterDuff.Mode mode = mDrawAsSrc ? PorterDuff.Mode.SRC : PorterDuff.Mode.SRC_OVER;
            int color = mScrimColor;
            color = Color.argb((int) (Color.alpha(color) * mViewAlpha), Color.red(color),
                    Color.green(color), Color.blue(color));
            canvas.drawColor(color, mode);
        }
    
public voidsetDrawAsSrc(boolean asSrc)

        mDrawAsSrc = asSrc;
        invalidate();
    
public voidsetScrimColor(int color)

        if (color != mScrimColor) {
            mIsEmpty = Color.alpha(color) == 0;
            mScrimColor = color;
            invalidate();
        }
    
public voidsetViewAlpha(float alpha)

        if (mAlphaAnimator != null) {
            mAlphaAnimator.cancel();
        }
        mViewAlpha = alpha;
        invalidate();