Separate tint and tintMode properties
BUG: 16054922
Change-Id: I820fb857b671faf9eb27612e470e820c5c4cd6b5
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 @@
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 @@
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 @@
* 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 @@
/**
* @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 @@
private void applyButtonTint() {
if (mButtonDrawable != null && mHasButtonTint) {
mButtonDrawable = mButtonDrawable.mutate();
- mButtonDrawable.setTint(mButtonTint, mButtonTintMode);
+ mButtonDrawable.setTintList(mButtonTintList);
+ mButtonDrawable.setTintMode(mButtonTintMode);
}
}