public void setShadowDrawable(NinePatchDrawable shadowDrawable) { mShadowDrawable = shadowDrawable; if (mShadowDrawable != null) { mShadowDrawable.getPadding(mShadowPadding); } }
/** * Constructor. * * @param shadow 9-patch drawable used for drop shadow * @param castShadowForTransparentBackgroundItem Whether to cast shadows for transparent items */ public ItemShadowDecorator(@NonNull NinePatchDrawable shadow, boolean castShadowForTransparentBackgroundItem) { mShadowDrawable = shadow; mShadowDrawable.getPadding(mShadowPadding); mCastShadowForTransparentBackgroundItem = castShadowForTransparentBackgroundItem; }
private void setShadow(NinePatchDrawable shadow) { mShadow = shadow; mShadow.getPadding(mShadowPaddings); updateShadowBounds(); setWillNotDraw(false); }
private void updateNinePatchBounds(NinePatchDrawable ninePatch, int childLeft, int childTop, int childRight, int childBottom) { if (ninePatch == null) { return; } final Rect t = mTempRect; ninePatch.getPadding(t); ninePatch.setBounds( childLeft - t.left, childTop - t.top, childRight + t.right, childBottom + t.bottom); }
public ForegroundRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ForegroundRelativeLayout, defStyle, 0); final Drawable d = a.getDrawable(R.styleable.ForegroundRelativeLayout_foreground); if (d != null) { setForeground(d); } a.recycle(); if (this.getBackground() instanceof NinePatchDrawable) { final NinePatchDrawable npd = (NinePatchDrawable) this.getBackground(); mRectPadding = new Rect(); if (npd.getPadding(mRectPadding)) { mUseBackgroundPadding = true; } } }
public ForegroundLinearLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ForegroundLinearLayout, defStyle, 0); final Drawable d = a.getDrawable(R.styleable.ForegroundRelativeLayout_foreground); if (d != null) { setForeground(d); } a.recycle(); if (this.getBackground() instanceof NinePatchDrawable) { final NinePatchDrawable npd = (NinePatchDrawable) this.getBackground(); mRectPadding = new Rect(); if (npd.getPadding(mRectPadding)) { mUseBackgroundPadding = true; } } }