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

NotificationBackgroundView

public class NotificationBackgroundView extends android.view.View
A view that can be used for both the dimmed and normal background of an notification.

Fields Summary
private android.graphics.drawable.Drawable
mBackground
private int
mClipTopAmount
private int
mActualHeight
Constructors Summary
public NotificationBackgroundView(android.content.Context context, android.util.AttributeSet attrs)

        super(context, attrs);
    
Methods Summary
private voiddraw(android.graphics.Canvas canvas, android.graphics.drawable.Drawable drawable)

        if (drawable != null) {
            drawable.setBounds(0, mClipTopAmount, getWidth(), mActualHeight);
            drawable.draw(canvas);
        }
    
public voiddrawableHotspotChanged(float x, float y)

        if (mBackground != null) {
            mBackground.setHotspot(x, y);
        }
    
protected voiddrawableStateChanged()

        drawableStateChanged(mBackground);
    
private voiddrawableStateChanged(android.graphics.drawable.Drawable d)

        if (d != null && d.isStateful()) {
            d.setState(getDrawableState());
        }
    
public intgetActualHeight()

        return mActualHeight;
    
public booleanhasOverlappingRendering()


        // Prevents this view from creating a layer when alpha is animating.
        return false;
    
protected voidonDraw(android.graphics.Canvas canvas)

        draw(canvas, mBackground);
    
public voidsetActualHeight(int actualHeight)

        mActualHeight = actualHeight;
        invalidate();
    
public voidsetClipTopAmount(int clipTopAmount)

        mClipTopAmount = clipTopAmount;
        invalidate();
    
public voidsetCustomBackground(android.graphics.drawable.Drawable background)
Sets a background drawable. As we need to change our bounds independently of layout, we need the notion of a background independently of the regular View background..

        if (mBackground != null) {
            mBackground.setCallback(null);
            unscheduleDrawable(mBackground);
        }
        mBackground = background;
        if (mBackground != null) {
            mBackground.setCallback(this);
        }
        invalidate();
    
public voidsetCustomBackground(int drawableResId)

        final Drawable d = mContext.getDrawable(drawableResId);
        setCustomBackground(d);
    
public voidsetRippleColor(int color)

        if (mBackground instanceof RippleDrawable) {
            RippleDrawable ripple = (RippleDrawable) mBackground;
            ripple.setColor(ColorStateList.valueOf(color));
        }
    
public voidsetState(int[] drawableState)

        mBackground.setState(drawableState);
    
public voidsetTint(int tintColor)

        if (tintColor != 0) {
            mBackground.setColorFilter(tintColor, PorterDuff.Mode.SRC_ATOP);
        } else {
            mBackground.clearColorFilter();
        }
        invalidate();
    
protected booleanverifyDrawable(android.graphics.drawable.Drawable who)

        return super.verifyDrawable(who) || who == mBackground;