summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-07-28 16:02:55 -0700
committerAlan Viverette <alanv@google.com>2014-08-06 15:42:10 -0700
commita426445dfdab43886dd894f2ba8a1d55bfcbb278 (patch)
tree80d37c447a2b37e310eb41ff73f5ecd4896c7e33 /core/java
parent33559c96ad4f2847ad2667c6035b8afe2afe2970 (diff)
downloadframeworks_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')
-rw-r--r--core/java/android/view/View.java27
-rw-r--r--core/java/android/widget/AbsSeekBar.java27
-rw-r--r--core/java/android/widget/CheckedTextView.java29
-rw-r--r--core/java/android/widget/CompoundButton.java27
-rw-r--r--core/java/android/widget/FrameLayout.java46
-rw-r--r--core/java/android/widget/ImageView.java37
-rw-r--r--core/java/android/widget/ProgressBar.java134
7 files changed, 160 insertions, 167 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 9eda8e0..328d67c 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -3176,7 +3176,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
@ViewDebug.ExportedProperty(deepExport = true, prefix = "bg_")
private Drawable mBackground;
- private ColorStateList mBackgroundTint = null;
+ private ColorStateList mBackgroundTintList = null;
private PorterDuff.Mode mBackgroundTintMode = PorterDuff.Mode.SRC_ATOP;
private boolean mHasBackgroundTint = false;
@@ -4016,7 +4016,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
break;
case R.styleable.View_backgroundTint:
// This will get applied later during setBackground().
- mBackgroundTint = a.getColorStateList(R.styleable.View_backgroundTint);
+ mBackgroundTintList = a.getColorStateList(R.styleable.View_backgroundTint);
mHasBackgroundTint = true;
break;
case R.styleable.View_backgroundTintMode:
@@ -15912,16 +15912,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* <p>
* Subsequent calls to {@link #setBackground(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#View_backgroundTint
- * @see #getBackgroundTint()
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
+ * @see #getBackgroundTintList()
+ * @see Drawable#setTintList(ColorStateList)
*/
- public void setBackgroundTint(@Nullable ColorStateList tint) {
- mBackgroundTint = tint;
+ public void setBackgroundTintList(@Nullable ColorStateList tint) {
+ mBackgroundTintList = tint;
mHasBackgroundTint = true;
applyBackgroundTint();
@@ -15930,23 +15930,23 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
/**
* @return the tint applied to the background drawable
* @attr ref android.R.styleable#View_backgroundTint
- * @see #setBackgroundTint(ColorStateList)
+ * @see #setBackgroundTintList(ColorStateList)
*/
@Nullable
- public ColorStateList getBackgroundTint() {
- return mBackgroundTint;
+ public ColorStateList getBackgroundTintList() {
+ return mBackgroundTintList;
}
/**
* Specifies the blending mode used to apply the tint specified by
- * {@link #setBackgroundTint(ColorStateList)}} to the background drawable.
+ * {@link #setBackgroundTintList(ColorStateList)}} to the background 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#View_backgroundTintMode
* @see #getBackgroundTintMode()
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
+ * @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setBackgroundTintMode(@Nullable PorterDuff.Mode tintMode) {
mBackgroundTintMode = tintMode;
@@ -15967,7 +15967,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
private void applyBackgroundTint() {
if (mBackground != null && mHasBackgroundTint) {
mBackground = mBackground.mutate();
- mBackground.setTint(mBackgroundTint, mBackgroundTintMode);
+ mBackground.setTintList(mBackgroundTintList);
+ mBackground.setTintMode(mBackgroundTintMode);
}
}
diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java
index 2708525..39cd7e3 100644
--- a/core/java/android/widget/AbsSeekBar.java
+++ b/core/java/android/widget/AbsSeekBar.java
@@ -41,7 +41,7 @@ public abstract class AbsSeekBar extends ProgressBar {
private final Rect mTempRect = new Rect();
private Drawable mThumb;
- private ColorStateList mThumbTint = null;
+ private ColorStateList mThumbTintList = null;
private PorterDuff.Mode mThumbTintMode = PorterDuff.Mode.SRC_ATOP;
private boolean mHasThumbTint = false;
@@ -100,7 +100,7 @@ public abstract class AbsSeekBar extends ProgressBar {
R.styleable.SeekBar_thumbTintMode, -1), mThumbTintMode);
if (a.hasValue(R.styleable.SeekBar_thumbTint)) {
- mThumbTint = a.getColorStateList(R.styleable.SeekBar_thumbTint);
+ mThumbTintList = a.getColorStateList(R.styleable.SeekBar_thumbTint);
mHasThumbTint = true;
applyThumbTint();
@@ -193,16 +193,16 @@ public abstract class AbsSeekBar extends ProgressBar {
* <p>
* Subsequent calls to {@link #setThumb(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#SeekBar_thumbTint
- * @see #getThumbTint()
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
+ * @see #getThumbTintList()
+ * @see Drawable#setTintList(ColorStateList)
*/
- public void setThumbTint(@Nullable ColorStateList tint) {
- mThumbTint = tint;
+ public void setThumbTintList(@Nullable ColorStateList tint) {
+ mThumbTintList = tint;
mHasThumbTint = true;
applyThumbTint();
@@ -211,16 +211,16 @@ public abstract class AbsSeekBar extends ProgressBar {
/**
* @return the tint applied to the thumb drawable
* @attr ref android.R.styleable#SeekBar_thumbTint
- * @see #setThumbTint(ColorStateList)
+ * @see #setThumbTintList(ColorStateList)
*/
@Nullable
- public ColorStateList getThumbTint() {
- return mThumbTint;
+ public ColorStateList getThumbTintList() {
+ return mThumbTintList;
}
/**
* Specifies the blending mode used to apply the tint specified by
- * {@link #setThumbTint(ColorStateList)}} to the thumb drawable. The
+ * {@link #setThumbTintList(ColorStateList)}} to the thumb drawable. The
* default mode is {@link PorterDuff.Mode#SRC_ATOP}.
*
* @param tintMode the blending mode used to apply the tint, may be
@@ -228,7 +228,7 @@ public abstract class AbsSeekBar extends ProgressBar {
*
* @attr ref android.R.styleable#SeekBar_thumbTintMode
* @see #getThumbTintMode()
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
+ * @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setThumbTintMode(@Nullable PorterDuff.Mode tintMode) {
mThumbTintMode = tintMode;
@@ -249,7 +249,8 @@ public abstract class AbsSeekBar extends ProgressBar {
private void applyThumbTint() {
if (mThumb != null && mHasThumbTint) {
mThumb = mThumb.mutate();
- mThumb.setTint(mThumbTint, mThumbTintMode);
+ mThumb.setTintList(mThumbTintList);
+ mThumb.setTintMode(mThumbTintMode);
}
}
diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java
index 791151c..ccd0480 100644
--- a/core/java/android/widget/CheckedTextView.java
+++ b/core/java/android/widget/CheckedTextView.java
@@ -47,7 +47,7 @@ public class CheckedTextView extends TextView implements Checkable {
private int mCheckMarkResource;
private Drawable mCheckMarkDrawable;
- private ColorStateList mCheckMarkTint = null;
+ private ColorStateList mCheckMarkTintList = null;
private PorterDuff.Mode mCheckMarkTintMode = PorterDuff.Mode.SRC_ATOP;
private boolean mHasCheckMarkTint = false;
@@ -86,7 +86,7 @@ public class CheckedTextView extends TextView implements Checkable {
R.styleable.CompoundButton_buttonTintMode, -1), mCheckMarkTintMode);
if (a.hasValue(R.styleable.CompoundButton_buttonTint)) {
- mCheckMarkTint = a.getColorStateList(R.styleable.CompoundButton_buttonTint);
+ mCheckMarkTintList = a.getColorStateList(R.styleable.CompoundButton_buttonTint);
mHasCheckMarkTint = true;
applyCheckMarkTint();
@@ -189,16 +189,16 @@ public class CheckedTextView extends TextView implements Checkable {
* Subsequent calls to {@link #setCheckMarkDrawable(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#CheckedTextView_checkMarkTint
- * @see #getCheckMarkTint()
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
+ * @see #getCheckMarkTintList()
+ * @see Drawable#setTintList(ColorStateList)
*/
- public void setCheckMarkTint(@Nullable ColorStateList tint) {
- mCheckMarkTint = tint;
+ public void setCheckMarkTintList(@Nullable ColorStateList tint) {
+ mCheckMarkTintList = tint;
mHasCheckMarkTint = true;
applyCheckMarkTint();
@@ -207,23 +207,23 @@ public class CheckedTextView extends TextView implements Checkable {
/**
* @return the tint applied to the check mark drawable
* @attr ref android.R.styleable#CheckedTextView_checkMarkTint
- * @see #setCheckMarkTint(ColorStateList)
+ * @see #setCheckMarkTintList(ColorStateList)
*/
@Nullable
- public ColorStateList getCheckMarkTint() {
- return mCheckMarkTint;
+ public ColorStateList getCheckMarkTintList() {
+ return mCheckMarkTintList;
}
/**
* Specifies the blending mode used to apply the tint specified by
- * {@link #setCheckMarkTint(ColorStateList)} to the check mark
+ * {@link #setCheckMarkTintList(ColorStateList)} to the check mark
* 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#CheckedTextView_checkMarkTintMode
- * @see #setCheckMarkTint(ColorStateList)
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
+ * @see #setCheckMarkTintList(ColorStateList)
+ * @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setCheckMarkTintMode(@Nullable PorterDuff.Mode tintMode) {
mCheckMarkTintMode = tintMode;
@@ -244,7 +244,8 @@ public class CheckedTextView extends TextView implements Checkable {
private void applyCheckMarkTint() {
if (mCheckMarkDrawable != null && mHasCheckMarkTint) {
mCheckMarkDrawable = mCheckMarkDrawable.mutate();
- mCheckMarkDrawable.setTint(mCheckMarkTint, mCheckMarkTintMode);
+ mCheckMarkDrawable.setTintList(mCheckMarkTintList);
+ mCheckMarkDrawable.setTintMode(mCheckMarkTintMode);
}
}
diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java
index a45777e..c1d8cb3 100644
--- a/core/java/android/widget/CompoundButton.java
+++ b/core/java/android/widget/CompoundButton.java
@@ -53,7 +53,7 @@ public abstract class CompoundButton extends Button implements Checkable {
private boolean mBroadcasting;
private Drawable mButtonDrawable;
- private ColorStateList mButtonTint = null;
+ private ColorStateList mButtonTintList = null;
private PorterDuff.Mode mButtonTintMode = PorterDuff.Mode.SRC_ATOP;
private boolean mHasButtonTint = false;
@@ -91,7 +91,7 @@ public abstract class CompoundButton extends Button implements Checkable {
R.styleable.CompoundButton_buttonTintMode, -1), mButtonTintMode);
if (a.hasValue(R.styleable.CompoundButton_buttonTint)) {
- mButtonTint = a.getColorStateList(R.styleable.CompoundButton_buttonTint);
+ mButtonTintList = a.getColorStateList(R.styleable.CompoundButton_buttonTint);
mHasButtonTint = true;
applyButtonTint();
@@ -245,16 +245,16 @@ public abstract class CompoundButton extends Button implements Checkable {
* Subsequent calls to {@link #setButtonDrawable(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#CompoundButton_buttonTint
- * @see #setButtonTint(ColorStateList)
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
+ * @see #setButtonTintList(ColorStateList)
+ * @see Drawable#setTintList(ColorStateList)
*/
- public void setButtonTint(@Nullable ColorStateList tint) {
- mButtonTint = tint;
+ public void setButtonTintList(@Nullable ColorStateList tint) {
+ mButtonTintList = tint;
mHasButtonTint = true;
applyButtonTint();
@@ -263,23 +263,23 @@ public abstract class CompoundButton extends Button implements Checkable {
/**
* @return the tint applied to the button drawable
* @attr ref android.R.styleable#CompoundButton_buttonTint
- * @see #setButtonTint(ColorStateList)
+ * @see #setButtonTintList(ColorStateList)
*/
@Nullable
- public ColorStateList getButtonTint() {
- return mButtonTint;
+ public ColorStateList getButtonTintList() {
+ return mButtonTintList;
}
/**
* Specifies the blending mode used to apply the tint specified by
- * {@link #setButtonTint(ColorStateList)}} to the button drawable. The
+ * {@link #setButtonTintList(ColorStateList)}} to the button 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#CompoundButton_buttonTintMode
* @see #getButtonTintMode()
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
+ * @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setButtonTintMode(@Nullable PorterDuff.Mode tintMode) {
mButtonTintMode = tintMode;
@@ -300,7 +300,8 @@ public abstract class CompoundButton extends Button implements Checkable {
private void applyButtonTint() {
if (mButtonDrawable != null && mHasButtonTint) {
mButtonDrawable = mButtonDrawable.mutate();
- mButtonDrawable.setTint(mButtonTint, mButtonTintMode);
+ mButtonDrawable.setTintList(mButtonTintList);
+ mButtonDrawable.setTintMode(mButtonTintMode);
}
}
diff --git a/core/java/android/widget/FrameLayout.java b/core/java/android/widget/FrameLayout.java
index 81dfcbb..4fb7e62 100644
--- a/core/java/android/widget/FrameLayout.java
+++ b/core/java/android/widget/FrameLayout.java
@@ -67,7 +67,7 @@ public class FrameLayout extends ViewGroup {
@ViewDebug.ExportedProperty(category = "drawing")
private Drawable mForeground;
- private ColorStateList mForegroundTint = null;
+ private ColorStateList mForegroundTintList = null;
private PorterDuff.Mode mForegroundTintMode = PorterDuff.Mode.SRC_ATOP;
private boolean mHasForegroundTint = false;
@@ -131,7 +131,7 @@ public class FrameLayout extends ViewGroup {
R.styleable.FrameLayout_foregroundTintMode, -1), mForegroundTintMode);
if (a.hasValue(R.styleable.FrameLayout_foregroundTint)) {
- mForegroundTint = a.getColorStateList(R.styleable.FrameLayout_foregroundTint);
+ mForegroundTintList = a.getColorStateList(R.styleable.FrameLayout_foregroundTint);
mHasForegroundTint = true;
applyForegroundTint();
@@ -301,40 +301,21 @@ public class FrameLayout extends ViewGroup {
}
/**
- * Applies a tint to the foreground drawable.
- * <p>
- * Subsequent calls to {@link #setForeground(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#FrameLayout_foregroundTint
- * @attr ref android.R.styleable#FrameLayout_foregroundTintMode
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
- */
- private void setForegroundTint(@Nullable ColorStateList tint,
- @Nullable PorterDuff.Mode tintMode) {
- }
-
- /**
* Applies a tint to the foreground drawable. Does not modify the current
* tint mode, which is {@link PorterDuff.Mode#SRC_ATOP} by default.
* <p>
* Subsequent calls to {@link #setForeground(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#FrameLayout_foregroundTint
- * @see #getForegroundTint()
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
+ * @see #getForegroundTintList()
+ * @see Drawable#setTintList(ColorStateList)
*/
- public void setForegroundTint(@Nullable ColorStateList tint) {
- mForegroundTint = tint;
+ public void setForegroundTintList(@Nullable ColorStateList tint) {
+ mForegroundTintList = tint;
mHasForegroundTint = true;
applyForegroundTint();
@@ -343,23 +324,23 @@ public class FrameLayout extends ViewGroup {
/**
* @return the tint applied to the foreground drawable
* @attr ref android.R.styleable#FrameLayout_foregroundTint
- * @see #setForegroundTint(ColorStateList)
+ * @see #setForegroundTintList(ColorStateList)
*/
@Nullable
- public ColorStateList getForegroundTint() {
- return mForegroundTint;
+ public ColorStateList getForegroundTintList() {
+ return mForegroundTintList;
}
/**
* Specifies the blending mode used to apply the tint specified by
- * {@link #setForegroundTint(ColorStateList)}} to the foreground drawable.
+ * {@link #setForegroundTintList(ColorStateList)}} to the foreground 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#FrameLayout_foregroundTintMode
* @see #getForegroundTintMode()
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
+ * @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setForegroundTintMode(@Nullable PorterDuff.Mode tintMode) {
mForegroundTintMode = tintMode;
@@ -381,7 +362,8 @@ public class FrameLayout extends ViewGroup {
private void applyForegroundTint() {
if (mForeground != null && mHasForegroundTint) {
mForeground = mForeground.mutate();
- mForeground.setTint(mForegroundTint, mForegroundTintMode);
+ mForeground.setTintList(mForegroundTintList);
+ mForeground.setTintMode(mForegroundTintMode);
}
}
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 {
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java
index 4a30809..c0fa6e5 100644
--- a/core/java/android/widget/ProgressBar.java
+++ b/core/java/android/widget/ProgressBar.java
@@ -216,21 +216,21 @@ public class ProgressBar extends View {
private boolean mHasAnimation;
private Drawable mIndeterminateDrawable;
- private ColorStateList mIndeterminateTint = null;
+ private ColorStateList mIndeterminateTintList = null;
private PorterDuff.Mode mIndeterminateTintMode = PorterDuff.Mode.SRC_ATOP;
private boolean mHasIndeterminateTint = false;
private Drawable mProgressDrawable;
- private ColorStateList mProgressTint = null;
+ private ColorStateList mProgressTintList = null;
private PorterDuff.Mode mProgressTintMode = PorterDuff.Mode.SRC_ATOP;
private boolean mHasProgressTint = false;
- private ColorStateList mProgressBackgroundTint = null;
+ private ColorStateList mProgressBackgroundTintList = null;
private PorterDuff.Mode mProgressBackgroundTintMode = PorterDuff.Mode.SRC_ATOP;
private boolean mHasProgressBackgroundTint = false;
- private ColorStateList mSecondaryProgressTint = null;
+ private ColorStateList mSecondaryProgressTintList = null;
private PorterDuff.Mode mSecondaryProgressTintMode = PorterDuff.Mode.SRC_ATOP;
private boolean mHasSecondaryProgressTint = false;
@@ -332,11 +332,11 @@ public class ProgressBar extends View {
R.styleable.ProgressBar_progressBackgroundTintMode, -1), mProgressTintMode);
if (a.hasValue(R.styleable.ProgressBar_progressTint)) {
- mProgressTint = a.getColorStateList(
+ mProgressTintList = a.getColorStateList(
R.styleable.ProgressBar_progressTint);
mHasProgressTint = true;
- applyProgressLayerTint(R.id.progress, mProgressTint,
+ applyProgressLayerTint(R.id.progress, mProgressTintList,
mProgressTintMode, true);
}
@@ -344,11 +344,11 @@ public class ProgressBar extends View {
R.styleable.ProgressBar_progressTintMode, -1), mProgressBackgroundTintMode);
if (a.hasValue(R.styleable.ProgressBar_progressBackgroundTint)) {
- mProgressBackgroundTint = a.getColorStateList(
+ mProgressBackgroundTintList = a.getColorStateList(
R.styleable.ProgressBar_progressBackgroundTint);
mHasProgressBackgroundTint = true;
- applyProgressLayerTint(R.id.background, mProgressBackgroundTint,
+ applyProgressLayerTint(R.id.background, mProgressBackgroundTintList,
mProgressBackgroundTintMode, false);
}
@@ -356,11 +356,11 @@ public class ProgressBar extends View {
R.styleable.ProgressBar_secondaryProgressTintMode, -1), mSecondaryProgressTintMode);
if (a.hasValue(R.styleable.ProgressBar_secondaryProgressTint)) {
- mSecondaryProgressTint = a.getColorStateList(
+ mSecondaryProgressTintList = a.getColorStateList(
R.styleable.ProgressBar_secondaryProgressTint);
mHasSecondaryProgressTint = true;
- applyProgressLayerTint(R.id.secondaryProgress, mSecondaryProgressTint,
+ applyProgressLayerTint(R.id.secondaryProgress, mSecondaryProgressTintList,
mSecondaryProgressTintMode, false);
}
@@ -368,7 +368,7 @@ public class ProgressBar extends View {
R.styleable.ProgressBar_indeterminateTintMode, -1), mIndeterminateTintMode);
if (a.hasValue(R.styleable.ProgressBar_indeterminateTint)) {
- mIndeterminateTint = a.getColorStateList(
+ mIndeterminateTintList = a.getColorStateList(
R.styleable.ProgressBar_indeterminateTint);
mHasIndeterminateTint = true;
@@ -430,7 +430,8 @@ public class ProgressBar extends View {
shapeDrawable.getPaint().setShader(bitmapShader);
// Ensure the tint and filter are propagated in the correct order.
- shapeDrawable.setTint(bitmap.getTint(), bitmap.getTintMode());
+ shapeDrawable.setTintList(bitmap.getTint());
+ shapeDrawable.setTintMode(bitmap.getTintMode());
shapeDrawable.setColorFilter(bitmap.getColorFilter());
return clip ? new ClipDrawable(
@@ -582,16 +583,16 @@ public class ProgressBar extends View {
* Subsequent calls to {@link #setIndeterminateDrawable(Drawable)} will
* automatically mutate the drawable and apply the specified tint and
* tint mode using
- * {@link Drawable#setTint(ColorStateList, android.graphics.PorterDuff.Mode)}.
+ * {@link Drawable#setTintList(ColorStateList)}.
*
* @param tint the tint to apply, may be {@code null} to clear tint
*
* @attr ref android.R.styleable#ProgressBar_indeterminateTint
- * @see #getIndeterminateTint()
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
+ * @see #getIndeterminateTintList()
+ * @see Drawable#setTintList(ColorStateList)
*/
- public void setIndeterminateTint(@Nullable ColorStateList tint) {
- mIndeterminateTint = tint;
+ public void setIndeterminateTintList(@Nullable ColorStateList tint) {
+ mIndeterminateTintList = tint;
mHasIndeterminateTint = true;
applyIndeterminateTint();
@@ -600,23 +601,23 @@ public class ProgressBar extends View {
/**
* @return the tint applied to the indeterminate drawable
* @attr ref android.R.styleable#ProgressBar_indeterminateTint
- * @see #setIndeterminateTint(ColorStateList)
+ * @see #setIndeterminateTintList(ColorStateList)
*/
@Nullable
- public ColorStateList getIndeterminateTint() {
- return mIndeterminateTint;
+ public ColorStateList getIndeterminateTintList() {
+ return mIndeterminateTintList;
}
/**
* Specifies the blending mode used to apply the tint specified by
- * {@link #setIndeterminateTint(ColorStateList)} to the indeterminate
+ * {@link #setIndeterminateTintList(ColorStateList)} to the indeterminate
* 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#ProgressBar_indeterminateTintMode
- * @see #setIndeterminateTint(ColorStateList)
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
+ * @see #setIndeterminateTintList(ColorStateList)
+ * @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setIndeterminateTintMode(@Nullable PorterDuff.Mode tintMode) {
mIndeterminateTintMode = tintMode;
@@ -637,7 +638,8 @@ public class ProgressBar extends View {
private void applyIndeterminateTint() {
if (mIndeterminateDrawable != null && mHasIndeterminateTint) {
mIndeterminateDrawable = mIndeterminateDrawable.mutate();
- mIndeterminateDrawable.setTint(mIndeterminateTint, mIndeterminateTintMode);
+ mIndeterminateDrawable.setTintList(mIndeterminateTintList);
+ mIndeterminateDrawable.setTintMode(mIndeterminateTintMode);
}
}
@@ -704,16 +706,17 @@ public class ProgressBar extends View {
}
if (mHasProgressTint) {
- applyProgressLayerTint(R.id.progress, mProgressTint, mProgressTintMode, true);
+ applyProgressLayerTint(R.id.progress, mProgressTintList,
+ mProgressTintMode, true);
}
if (mHasProgressBackgroundTint) {
- applyProgressLayerTint(R.id.background, mProgressBackgroundTint,
+ applyProgressLayerTint(R.id.background, mProgressBackgroundTintList,
mProgressBackgroundTintMode, false);
}
if (mHasSecondaryProgressTint) {
- applyProgressLayerTint(R.id.secondaryProgress, mSecondaryProgressTint,
+ applyProgressLayerTint(R.id.secondaryProgress, mSecondaryProgressTintList,
mSecondaryProgressTintMode, false);
}
}
@@ -743,16 +746,16 @@ public class ProgressBar extends View {
* Subsequent calls to {@link #setProgressDrawable(Drawable)} will
* automatically mutate the drawable and apply the specified tint and
* tint mode using
- * {@link Drawable#setTint(ColorStateList, android.graphics.PorterDuff.Mode)}.
+ * {@link Drawable#setTintList(ColorStateList)}.
*
* @param tint the tint to apply, may be {@code null} to clear tint
*
* @attr ref android.R.styleable#ProgressBar_progressTint
- * @see #getProgressTint()
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
+ * @see #getProgressTintList()
+ * @see Drawable#setTintList(ColorStateList)
*/
- public void setProgressTint(@Nullable ColorStateList tint) {
- mProgressTint = tint;
+ public void setProgressTintList(@Nullable ColorStateList tint) {
+ mProgressTintList = tint;
mHasProgressTint = true;
applyProgressLayerTint(R.id.progress, tint, mProgressTintMode, true);
@@ -761,28 +764,28 @@ public class ProgressBar extends View {
/**
* @return the tint applied to the progress drawable
* @attr ref android.R.styleable#ProgressBar_progressTint
- * @see #setProgressTint(ColorStateList)
+ * @see #setProgressTintList(ColorStateList)
*/
@Nullable
- public ColorStateList getProgressTint() {
- return mProgressTint;
+ public ColorStateList getProgressTintList() {
+ return mProgressTintList;
}
/**
* Specifies the blending mode used to apply the tint specified by
- * {@link #setProgressTint(ColorStateList)}} to the progress
+ * {@link #setProgressTintList(ColorStateList)}} to the progress
* indicator. 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#ProgressBar_progressTintMode
* @see #getProgressTintMode()
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
+ * @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setProgressTintMode(@Nullable PorterDuff.Mode tintMode) {
mProgressTintMode = tintMode;
- applyProgressLayerTint(R.id.progress, mProgressTint, tintMode, true);
+ applyProgressLayerTint(R.id.progress, mProgressTintList, tintMode, true);
}
/**
@@ -807,16 +810,16 @@ public class ProgressBar extends View {
* Subsequent calls to {@link #setProgressDrawable(Drawable)} where the
* drawable contains a progress background will automatically mutate the
* drawable and apply the specified tint and tint mode using
- * {@link Drawable#setTint(ColorStateList, android.graphics.PorterDuff.Mode)}.
+ * {@link Drawable#setTintList(ColorStateList)}.
*
* @param tint the tint to apply, may be {@code null} to clear tint
*
* @attr ref android.R.styleable#ProgressBar_progressBackgroundTint
- * @see #getProgressBackgroundTint()
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
+ * @see #getProgressBackgroundTintList()
+ * @see Drawable#setTintList(ColorStateList)
*/
- public void setProgressBackgroundTint(@Nullable ColorStateList tint) {
- mProgressBackgroundTint = tint;
+ public void setProgressBackgroundTintList(@Nullable ColorStateList tint) {
+ mProgressBackgroundTintList = tint;
mHasProgressBackgroundTint = true;
applyProgressLayerTint(R.id.background, tint, mProgressBackgroundTintMode, false);
@@ -825,28 +828,28 @@ public class ProgressBar extends View {
/**
* @return the tint applied to the progress background
* @attr ref android.R.styleable#ProgressBar_progressBackgroundTint
- * @see #setProgressBackgroundTint(ColorStateList)
+ * @see #setProgressBackgroundTintList(ColorStateList)
*/
@Nullable
- public ColorStateList getProgressBackgroundTint() {
- return mProgressBackgroundTint;
+ public ColorStateList getProgressBackgroundTintList() {
+ return mProgressBackgroundTintList;
}
/**
* Specifies the blending mode used to apply the tint specified by
- * {@link #setProgressBackgroundTint(ColorStateList)}} to the progress
+ * {@link #setProgressBackgroundTintList(ColorStateList)}} to the progress
* background. 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#ProgressBar_progressBackgroundTintMode
- * @see #setProgressBackgroundTint(ColorStateList)
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
+ * @see #setProgressBackgroundTintList(ColorStateList)
+ * @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setProgressBackgroundTintMode(@Nullable PorterDuff.Mode tintMode) {
mProgressBackgroundTintMode = tintMode;
- applyProgressLayerTint(R.id.background, mProgressBackgroundTint, tintMode, false);
+ applyProgressLayerTint(R.id.background, mProgressBackgroundTintList, tintMode, false);
}
/**
@@ -872,16 +875,16 @@ public class ProgressBar extends View {
* Subsequent calls to {@link #setProgressDrawable(Drawable)} where the
* drawable contains a secondary progress indicator will automatically
* mutate the drawable and apply the specified tint and tint mode using
- * {@link Drawable#setTint(ColorStateList, android.graphics.PorterDuff.Mode)}.
+ * {@link Drawable#setTintList(ColorStateList)}.
*
* @param tint the tint to apply, may be {@code null} to clear tint
*
* @attr ref android.R.styleable#ProgressBar_secondaryProgressTint
- * @see #getSecondaryProgressTint()
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
+ * @see #getSecondaryProgressTintList()
+ * @see Drawable#setTintList(ColorStateList)
*/
- public void setSecondaryProgressTint(@Nullable ColorStateList tint) {
- mSecondaryProgressTint = tint;
+ public void setSecondaryProgressTintList(@Nullable ColorStateList tint) {
+ mSecondaryProgressTintList = tint;
mHasSecondaryProgressTint = true;
applyProgressLayerTint(R.id.secondaryProgress, tint, mSecondaryProgressTintMode, false);
@@ -890,29 +893,29 @@ public class ProgressBar extends View {
/**
* @return the tint applied to the secondary progress drawable
* @attr ref android.R.styleable#ProgressBar_secondaryProgressTint
- * @see #setSecondaryProgressTint(ColorStateList)
+ * @see #setSecondaryProgressTintList(ColorStateList)
*/
@Nullable
- public ColorStateList getSecondaryProgressTint() {
- return mSecondaryProgressTint;
+ public ColorStateList getSecondaryProgressTintList() {
+ return mSecondaryProgressTintList;
}
/**
* Specifies the blending mode used to apply the tint specified by
- * {@link #setSecondaryProgressTint(ColorStateList)}} to the secondary
+ * {@link #setSecondaryProgressTintList(ColorStateList)}} to the secondary
* progress indicator. 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#ProgressBar_secondaryProgressTintMode
- * @see #setSecondaryProgressTint(ColorStateList)
- * @see Drawable#setTint(ColorStateList, PorterDuff.Mode)
+ * @see #setSecondaryProgressTintList(ColorStateList)
+ * @see Drawable#setTintMode(PorterDuff.Mode)
*/
public void setSecondaryProgressTintMode(@Nullable PorterDuff.Mode tintMode) {
mSecondaryProgressTintMode = tintMode;
- applyProgressLayerTint(R.id.secondaryProgress, mSecondaryProgressTint, tintMode, false);
+ applyProgressLayerTint(R.id.secondaryProgress, mSecondaryProgressTintList, tintMode, false);
}
/**
@@ -942,7 +945,8 @@ public class ProgressBar extends View {
}
if (layer != null) {
- layer.setTint(tint, tintMode);
+ layer.setTintList(tint);
+ layer.setTintMode(tintMode);
}
}
}
@@ -1066,7 +1070,9 @@ public class ProgressBar extends View {
layer = d;
}
- layer.mutate().setTint(tint, tintMode);
+ layer.mutate();
+ layer.setTintList(tint);
+ layer.setTintMode(tintMode);
}
private float getScale(float progress) {