summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/ImageView.java
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-07-21 17:49:13 -0700
committerAlan Viverette <alanv@google.com>2014-07-22 01:03:58 +0000
commit4f64c048505a432e549ccb756634ecebf28f9e80 (patch)
tree4ee51f737ee62e464f4b65e64608c9e9e5e0b42b /core/java/android/widget/ImageView.java
parent0d964e77b9a204417d0a24dcbacd354f9de589d9 (diff)
downloadframeworks_base-4f64c048505a432e549ccb756634ecebf28f9e80.zip
frameworks_base-4f64c048505a432e549ccb756634ecebf28f9e80.tar.gz
frameworks_base-4f64c048505a432e549ccb756634ecebf28f9e80.tar.bz2
Clean up view tinting APIs, tileModeX/Y attribute docs
BUG: 16400590 BUG: 16403307 Change-Id: Ie924815a39eb0e683d1982b08ec478ed3edbfb7b
Diffstat (limited to 'core/java/android/widget/ImageView.java')
-rw-r--r--core/java/android/widget/ImageView.java44
1 files changed, 14 insertions, 30 deletions
diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java
index e97177d..0881f3e 100644
--- a/core/java/android/widget/ImageView.java
+++ b/core/java/android/widget/ImageView.java
@@ -168,10 +168,11 @@ public class ImageView extends View {
setScaleType(sScaleTypeArray[index]);
}
+ mDrawableTintMode = Drawable.parseTintMode(a.getInt(
+ R.styleable.ImageView_tintMode, -1), mDrawableTintMode);
+
if (a.hasValue(R.styleable.ImageView_tint)) {
mDrawableTint = a.getColorStateList(R.styleable.ImageView_tint);
- mDrawableTintMode = Drawable.parseTintMode(a.getInt(
- R.styleable.ImageView_tintMode, -1), mDrawableTintMode);
mHasDrawableTint = true;
applyDrawableTint();
@@ -448,50 +449,30 @@ public class ImageView extends View {
}
/**
- * Applies a tint to the image drawable.
+ * Applies a tint to the image drawable. Does not modify the current tint
+ * mode, which is {@link PorterDuff.Mode#SRC_ATOP} by default.
* <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)}.
*
* @param tint the tint to apply, may be {@code null} to clear tint
- * @param tintMode the blending mode used to apply the tint, may be
- * {@code null} to clear tint
*
* @attr ref android.R.styleable#ImageView_tint
- * @attr ref android.R.styleable#ImageView_tintMode
+ * @see #getTint()
* @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
*/
- private void setTint(@Nullable ColorStateList tint,
- @Nullable PorterDuff.Mode tintMode) {
+ public void setTint(@Nullable ColorStateList tint) {
mDrawableTint = tint;
- mDrawableTintMode = tintMode;
mHasDrawableTint = true;
applyDrawableTint();
}
/**
- * Applies a tint to the image drawable. Does not modify the current tint
- * mode, which is {@link PorterDuff.Mode#SRC_ATOP} by default.
- * <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)}.
- *
- * @param tint the tint to apply, may be {@code null} to clear tint
- *
- * @attr ref android.R.styleable#ImageView_tint
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
- */
- public void setTint(@Nullable ColorStateList tint) {
- setTint(tint, mDrawableTintMode);
- }
-
- /**
* @return the tint applied to the image drawable
* @attr ref android.R.styleable#ImageView_tint
- * @see #setTint(ColorStateList, PorterDuff.Mode)
+ * @see #setTint(ColorStateList)
*/
@Nullable
public ColorStateList getTint() {
@@ -506,16 +487,19 @@ public class ImageView extends View {
* @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 #setTint(ColorStateList)
+ * @see #getTintMode()
+ * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
*/
public void setTintMode(@Nullable PorterDuff.Mode tintMode) {
- setTint(mDrawableTint, tintMode);
+ mDrawableTintMode = tintMode;
+
+ applyDrawableTint();
}
/**
* @return the blending mode used to apply the tint to the image drawable
* @attr ref android.R.styleable#ImageView_tintMode
- * @see #setTint(ColorStateList, PorterDuff.Mode)
+ * @see #setTintMode(PorterDuff.Mode)
*/
@Nullable
public PorterDuff.Mode getTintMode() {