diff options
author | Alan Viverette <alanv@google.com> | 2014-07-28 16:02:55 -0700 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2014-08-06 15:42:10 -0700 |
commit | a426445dfdab43886dd894f2ba8a1d55bfcbb278 (patch) | |
tree | 80d37c447a2b37e310eb41ff73f5ecd4896c7e33 /core/java/android/widget/ImageView.java | |
parent | 33559c96ad4f2847ad2667c6035b8afe2afe2970 (diff) | |
download | frameworks_base-a426445dfdab43886dd894f2ba8a1d55bfcbb278.zip frameworks_base-a426445dfdab43886dd894f2ba8a1d55bfcbb278.tar.gz frameworks_base-a426445dfdab43886dd894f2ba8a1d55bfcbb278.tar.bz2 |
Separate tint and tintMode properties
BUG: 16054922
Change-Id: I820fb857b671faf9eb27612e470e820c5c4cd6b5
Diffstat (limited to 'core/java/android/widget/ImageView.java')
-rw-r--r-- | core/java/android/widget/ImageView.java | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java index 0881f3e..6a15078 100644 --- a/core/java/android/widget/ImageView.java +++ b/core/java/android/widget/ImageView.java @@ -175,7 +175,7 @@ public class ImageView extends View { mDrawableTint = a.getColorStateList(R.styleable.ImageView_tint); mHasDrawableTint = true; - applyDrawableTint(); + applyImageTint(); } final int alpha = a.getInt(com.android.internal.R.styleable.ImageView_drawableAlpha, 255); @@ -454,62 +454,63 @@ public class ImageView extends View { * <p> * Subsequent calls to {@link #setImageDrawable(Drawable)} will automatically * mutate the drawable and apply the specified tint and tint mode using - * {@link Drawable#setTint(ColorStateList, PorterDuff.Mode)}. + * {@link Drawable#setTintList(ColorStateList)}. * * @param tint the tint to apply, may be {@code null} to clear tint * * @attr ref android.R.styleable#ImageView_tint - * @see #getTint() - * @see Drawable#setTint(ColorStateList, PorterDuff.Mode) + * @see #getImageTintList() + * @see Drawable#setTintList(ColorStateList) */ - public void setTint(@Nullable ColorStateList tint) { + public void setImageTintList(@Nullable ColorStateList tint) { mDrawableTint = tint; mHasDrawableTint = true; - applyDrawableTint(); + applyImageTint(); } /** * @return the tint applied to the image drawable * @attr ref android.R.styleable#ImageView_tint - * @see #setTint(ColorStateList) + * @see #setImageTintList(ColorStateList) */ @Nullable - public ColorStateList getTint() { + public ColorStateList getImageTintList() { return mDrawableTint; } /** * Specifies the blending mode used to apply the tint specified by - * {@link #setTint(ColorStateList)}} to the image drawable. The default + * {@link #setImageTintList(ColorStateList)}} to the image drawable. The default * mode is {@link PorterDuff.Mode#SRC_ATOP}. * * @param tintMode the blending mode used to apply the tint, may be * {@code null} to clear tint * @attr ref android.R.styleable#ImageView_tintMode - * @see #getTintMode() - * @see Drawable#setTint(ColorStateList, PorterDuff.Mode) + * @see #getImageTintMode() + * @see Drawable#setTintMode(PorterDuff.Mode) */ - public void setTintMode(@Nullable PorterDuff.Mode tintMode) { + public void setImageTintMode(@Nullable PorterDuff.Mode tintMode) { mDrawableTintMode = tintMode; - applyDrawableTint(); + applyImageTint(); } /** * @return the blending mode used to apply the tint to the image drawable * @attr ref android.R.styleable#ImageView_tintMode - * @see #setTintMode(PorterDuff.Mode) + * @see #setImageTintMode(PorterDuff.Mode) */ @Nullable - public PorterDuff.Mode getTintMode() { + public PorterDuff.Mode getImageTintMode() { return mDrawableTintMode; } - private void applyDrawableTint() { + private void applyImageTint() { if (mDrawable != null && mHasDrawableTint) { mDrawable = mDrawable.mutate(); - mDrawable.setTint(mDrawableTint, mDrawableTintMode); + mDrawable.setTintList(mDrawableTint); + mDrawable.setTintMode(mDrawableTintMode); } } @@ -801,7 +802,7 @@ public class ImageView extends View { d.setLevel(mLevel); mDrawableWidth = d.getIntrinsicWidth(); mDrawableHeight = d.getIntrinsicHeight(); - applyDrawableTint(); + applyImageTint(); applyColorMod(); configureBounds(); } else { |