method public final android.graphics.Paint getPaint();
method public android.graphics.Shader.TileMode getTileModeX();
method public android.graphics.Shader.TileMode getTileModeY();
- method public android.content.res.ColorStateList getTint();
method public boolean hasAntiAlias();
method public boolean hasMipMap();
method public final boolean isAutoMirrored();
method public void setTileModeX(android.graphics.Shader.TileMode);
method public void setTileModeXY(android.graphics.Shader.TileMode, android.graphics.Shader.TileMode);
method public final void setTileModeY(android.graphics.Shader.TileMode);
- method public void setTint(android.content.res.ColorStateList);
- method public void setTintMode(android.graphics.PorterDuff.Mode);
}
public class ClipDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
method public android.graphics.ColorFilter getColorFilter();
method public android.graphics.drawable.Drawable.ConstantState getConstantState();
method public android.graphics.drawable.Drawable getCurrent();
+ method public android.graphics.Rect getDirtyBounds();
method public int getIntrinsicHeight();
method public int getIntrinsicWidth();
method public final int getLevel();
method public void setHotspotBounds(int, int, int, int);
method public final boolean setLevel(int);
method public boolean setState(int[]);
+ method public void setTint(android.content.res.ColorStateList, android.graphics.PorterDuff.Mode);
method public boolean setVisible(boolean, boolean);
method public void unscheduleSelf(java.lang.Runnable);
}
method public void draw(android.graphics.Canvas);
method public int getOpacity();
method public android.graphics.Paint getPaint();
- method public android.content.res.ColorStateList getTint();
method public void setAlpha(int);
method public void setColorFilter(android.graphics.ColorFilter);
method public void setTargetDensity(android.graphics.Canvas);
method public void setTargetDensity(android.util.DisplayMetrics);
method public void setTargetDensity(int);
- method public void setTint(android.content.res.ColorStateList);
- method public void setTintMode(android.graphics.PorterDuff.Mode);
}
public class PaintDrawable extends android.graphics.drawable.ShapeDrawable {
}
public class RippleDrawable extends android.graphics.drawable.LayerDrawable {
- method public android.graphics.Rect getDirtyBounds();
- method public android.content.res.ColorStateList getTint();
- method public void setTint(android.content.res.ColorStateList);
- method public void setTintMode(android.graphics.PorterDuff.Mode);
}
public class RotateDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PixelFormat;
+import android.graphics.PorterDuff;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
return mBitmapState.mPaint.getColorFilter();
}
- /**
- * Specifies a tint for this drawable.
- * <p>
- * Setting a color filter via {@link #setColorFilter(ColorFilter)} overrides
- * tint.
- *
- * @param tint Color state list to use for tinting this drawable, or null to
- * clear the tint
- */
- public void setTint(ColorStateList tint) {
- if (mBitmapState.mTint != tint) {
- mBitmapState.mTint = tint;
- computeTintFilter();
- invalidateSelf();
- }
+ @Override
+ public void setTint(ColorStateList tint, PorterDuff.Mode tintMode) {
+ mBitmapState.mTint = tint;
+ mBitmapState.mTintMode = tintMode;
+ computeTintFilter();
+ invalidateSelf();
}
/**
- * Returns the tint color for this drawable.
- *
- * @return Color state list to use for tinting this drawable, or null if
- * none set
+ * @hide only needed by a hack within ProgressBar
*/
public ColorStateList getTint() {
return mBitmapState.mTint;
}
/**
- * Specifies the blending mode used to apply tint.
- *
- * @param tintMode A Porter-Duff blending mode
- */
- public void setTintMode(Mode tintMode) {
- if (mBitmapState.mTintMode != tintMode) {
- mBitmapState.mTintMode = tintMode;
- computeTintFilter();
- invalidateSelf();
- }
- }
-
- /**
* @hide only needed by a hack within ProgressBar
*/
public Mode getTintMode() {
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
+import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.content.res.TypedArray;
* By default, this returns the full drawable bounds. Custom drawables may
* override this method to perform more precise invalidation.
*
- * @hide
+ * @return The dirty bounds of this drawable
*/
public Rect getDirtyBounds() {
return getBounds();
}
/**
+ * Specifies a tint and blending mode for this drawable.
+ * <p>
+ * Setting a color filter via {@link #setColorFilter(ColorFilter)} overrides
+ * tint.
+ *
+ * @param tint Color state list to use for tinting this drawable, or null to
+ * clear the tint
+ * @param tintMode A Porter-Duff blending mode
+ */
+ public void setTint(ColorStateList tint, PorterDuff.Mode tintMode) {}
+
+ /**
* Returns the current color filter, or {@code null} if none set.
*
* @return the current color filter, or {@code null} if none set
import android.graphics.NinePatch;
import android.graphics.Paint;
import android.graphics.PixelFormat;
+import android.graphics.PorterDuff;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
invalidateSelf();
}
- /**
- * Specifies a tint for this drawable.
- * <p>
- * Setting a color filter via {@link #setColorFilter(ColorFilter)} overrides
- * tint.
- *
- * @param tint Color state list to use for tinting this drawable, or null to
- * clear the tint
- */
- public void setTint(ColorStateList tint) {
- if (mNinePatchState.mTint != tint) {
- mNinePatchState.mTint = tint;
- computeTintFilter();
- invalidateSelf();
- }
- }
-
- /**
- * Returns the tint color for this drawable.
- *
- * @return Color state list to use for tinting this drawable, or null if
- * none set
- */
- public ColorStateList getTint() {
- return mNinePatchState.mTint;
- }
-
- /**
- * Specifies the blending mode used to apply tint.
- *
- * @param tintMode A Porter-Duff blending mode
- */
- public void setTintMode(Mode tintMode) {
- if (mNinePatchState.mTintMode != tintMode) {
- mNinePatchState.mTintMode = tintMode;
- computeTintFilter();
- invalidateSelf();
- }
+ @Override
+ public void setTint(ColorStateList tint, PorterDuff.Mode tintMode) {
+ mNinePatchState.mTint = tint;
+ mNinePatchState.mTintMode = tintMode;
+ computeTintFilter();
+ invalidateSelf();
}
private void computeTintFilter() {
return true;
}
- /**
- * Specifies a tint for drawing touch feedback ripples.
- *
- * @param tint Color state list to use for tinting touch feedback ripples,
- * or null to clear the tint
- */
- public void setTint(ColorStateList tint) {
- if (mState.mTint != tint) {
- mState.mTint = tint;
- invalidateSelf();
- }
- }
-
- /**
- * Returns the tint color for touch feedback ripples.
- *
- * @return Color state list to use for tinting touch feedback ripples, or
- * null if none set
- */
- public ColorStateList getTint() {
- return mState.mTint;
- }
-
- /**
- * Specifies the blending mode used to draw touch feedback ripples.
- *
- * @param tintMode A Porter-Duff blending mode
- */
- public void setTintMode(Mode tintMode) {
+ @Override
+ public void setTint(ColorStateList tint, Mode tintMode) {
+ mState.mTint = tint;
mState.setTintMode(tintMode);
invalidateSelf();
}
@Override
public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs, Theme theme)
throws XmlPullParserException, IOException {
- final TypedArray a = obtainAttributes(
- r, theme, attrs, R.styleable.RippleDrawable);
+ final TypedArray a = obtainAttributes(r, theme, attrs, R.styleable.RippleDrawable);
updateStateFromTypedArray(a);
a.recycle();
+ // Force padding default to STACK before inflating.
+ setPaddingMode(PADDING_MODE_STACK);
+
super.inflate(r, parser, attrs, theme);
setTargetDensity(r.getDisplayMetrics());
}
/**
+ * Specifies how layer padding should affect the bounds of subsequent
+ * layers. The default and recommended value for RippleDrawable is
+ * {@link #PADDING_MODE_STACK}.
+ *
+ * @param mode padding mode, one of:
+ * <ul>
+ * <li>{@link #PADDING_MODE_NEST} to nest each layer inside the
+ * padding of the previous layer
+ * <li>{@link #PADDING_MODE_STACK} to stack each layer directly
+ * atop the previous layer
+ * </ul>
+ * @see #getPaddingMode()
+ */
+ @Override
+ public void setPaddingMode(int mode) {
+ super.setPaddingMode(mode);
+ }
+
+ /**
* Initializes the constant state from the values in the typed array.
*/
private void updateStateFromTypedArray(TypedArray a) {
Drawable mMask;
boolean mPinned = false;
- public RippleState(
- RippleState orig, RippleDrawable owner, Resources res) {
+ public RippleState(RippleState orig, RippleDrawable owner, Resources res) {
super(orig, owner, res);
if (orig != null) {
mTintXfermode = orig.mTintXfermode;
mTintXfermodeInverse = orig.mTintXfermodeInverse;
mPinned = orig.mPinned;
- mMask = orig.mMask;
}
}
}
mState = ns;
+ mState.mMask = findDrawableByLayerId(R.id.mask);
+
mLayerState = ns;
if (ns.mNum > 0) {
if (needsTheme) {
applyTheme(theme);
}
-
- setPaddingMode(PADDING_MODE_STACK);
}
}