Loading api/current.txt +6 −0 Original line number Diff line number Diff line Loading @@ -380,6 +380,8 @@ package android { field public static final int centerY = 16843171; // 0x10101a3 field public static final int checkBoxPreferenceStyle = 16842895; // 0x101008f field public static final int checkMark = 16843016; // 0x1010108 field public static final int checkMarkTint = 16843949; // 0x10104ad field public static final int checkMarkTintMode = 16843950; // 0x10104ae field public static final int checkable = 16843237; // 0x10101e5 field public static final int checkableBehavior = 16843232; // 0x10101e0 field public static final int checkboxStyle = 16842860; // 0x101006c Loading Loading @@ -37638,9 +37640,13 @@ package android.widget { ctor public CheckedTextView(android.content.Context, android.util.AttributeSet, int); ctor public CheckedTextView(android.content.Context, android.util.AttributeSet, int, int); method public android.graphics.drawable.Drawable getCheckMarkDrawable(); method public android.content.res.ColorStateList getCheckMarkTint(); method public android.graphics.PorterDuff.Mode getCheckMarkTintMode(); method public boolean isChecked(); method public void setCheckMarkDrawable(int); method public void setCheckMarkDrawable(android.graphics.drawable.Drawable); method public void setCheckMarkTint(android.content.res.ColorStateList); method public void setCheckMarkTintMode(android.graphics.PorterDuff.Mode); method public void setChecked(boolean); method public void toggle(); } core/java/android/view/View.java +13 −29 Original line number Diff line number Diff line Loading @@ -15546,7 +15546,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** * This function is called whenever the drawable hotspot changes. * This function is called whenever the view hotspot changes and needs to * be propagated to drawables managed by the view. * <p> * Be sure to call through to the superclass when overriding this function. * Loading Loading @@ -15888,50 +15889,30 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** * Applies a tint to the background drawable. * Applies a tint to the background drawable. Does not modify the current tint * mode, which is {@link PorterDuff.Mode#SRC_ATOP} by default. * <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)}. * * @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#View_backgroundTint * @attr ref android.R.styleable#View_backgroundTintMode * @see #getBackgroundTint() * @see Drawable#setTint(ColorStateList, PorterDuff.Mode) */ private void setBackgroundTint(@Nullable ColorStateList tint, @Nullable PorterDuff.Mode tintMode) { public void setBackgroundTint(@Nullable ColorStateList tint) { mBackgroundTint = tint; mBackgroundTintMode = tintMode; mHasBackgroundTint = true; applyBackgroundTint(); } /** * Applies a tint to the background drawable. Does not modify the current tint * mode, which is {@link PorterDuff.Mode#SRC_ATOP} by default. * <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)}. * * @param tint the tint to apply, may be {@code null} to clear tint * * @attr ref android.R.styleable#View_backgroundTint * @see #setBackgroundTint(ColorStateList, PorterDuff.Mode) */ public void setBackgroundTint(@Nullable ColorStateList tint) { setBackgroundTint(tint, mBackgroundTintMode); } /** * @return the tint applied to the background drawable * @attr ref android.R.styleable#View_backgroundTint * @see #setBackgroundTint(ColorStateList, PorterDuff.Mode) * @see #setBackgroundTint(ColorStateList) */ @Nullable public ColorStateList getBackgroundTint() { Loading @@ -15946,16 +15927,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @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 #setBackgroundTint(ColorStateList) * @see #getBackgroundTintMode() * @see Drawable#setTint(ColorStateList, PorterDuff.Mode) */ public void setBackgroundTintMode(@Nullable PorterDuff.Mode tintMode) { setBackgroundTint(mBackgroundTint, tintMode); mBackgroundTintMode = tintMode; applyBackgroundTint(); } /** * @return the blending mode used to apply the tint to the background drawable * @attr ref android.R.styleable#View_backgroundTintMode * @see #setBackgroundTint(ColorStateList, PorterDuff.Mode) * @see #setBackgroundTintMode(PorterDuff.Mode) */ @Nullable public PorterDuff.Mode getBackgroundTintMode() { core/java/android/widget/AbsSeekBar.java +15 −30 Original line number Diff line number Diff line Loading @@ -92,10 +92,11 @@ public abstract class AbsSeekBar extends ProgressBar { final Drawable thumb = a.getDrawable(com.android.internal.R.styleable.SeekBar_thumb); setThumb(thumb); if (a.hasValue(R.styleable.SeekBar_thumbTint)) { mThumbTint = a.getColorStateList(R.styleable.SeekBar_thumbTint); mThumbTintMode = Drawable.parseTintMode(a.getInt( R.styleable.SeekBar_thumbTintMode, -1), mThumbTintMode); if (a.hasValue(R.styleable.SeekBar_thumbTint)) { mThumbTint = a.getColorStateList(R.styleable.SeekBar_thumbTint); mHasThumbTint = true; applyThumbTint(); Loading Loading @@ -183,50 +184,30 @@ public abstract class AbsSeekBar extends ProgressBar { } /** * Applies a tint to the thumb drawable. * Applies a tint to the thumb drawable. Does not modify the current tint * mode, which is {@link PorterDuff.Mode#SRC_ATOP} by default. * <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)}. * * @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#SeekBar_thumbTint * @attr ref android.R.styleable#SeekBar_thumbTintMode * @see #getThumbTint() * @see Drawable#setTint(ColorStateList, PorterDuff.Mode) */ private void setThumbTint(@Nullable ColorStateList tint, @Nullable PorterDuff.Mode tintMode) { public void setThumbTint(@Nullable ColorStateList tint) { mThumbTint = tint; mThumbTintMode = tintMode; mHasThumbTint = true; applyThumbTint(); } /** * Applies a tint to the thumb drawable. Does not modify the current tint * mode, which is {@link PorterDuff.Mode#SRC_ATOP} by default. * <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)}. * * @param tint the tint to apply, may be {@code null} to clear tint * * @attr ref android.R.styleable#SeekBar_thumbTint * @see #setThumbTint(ColorStateList, PorterDuff.Mode) */ public void setThumbTint(@Nullable ColorStateList tint) { setThumbTint(tint, mThumbTintMode); } /** * @return the tint applied to the thumb drawable * @attr ref android.R.styleable#SeekBar_thumbTint * @see #setThumbTint(ColorStateList, PorterDuff.Mode) * @see #setThumbTint(ColorStateList) */ @Nullable public ColorStateList getThumbTint() { Loading @@ -240,17 +221,21 @@ public abstract class AbsSeekBar extends ProgressBar { * * @param tintMode the blending mode used to apply the tint, may be * {@code null} to clear tint * * @attr ref android.R.styleable#SeekBar_thumbTintMode * @see #setThumbTint(ColorStateList) * @see #getThumbTintMode() * @see Drawable#setTint(ColorStateList, PorterDuff.Mode) */ public void setThumbTintMode(@Nullable PorterDuff.Mode tintMode) { setThumbTint(mThumbTint, tintMode); mThumbTintMode = tintMode; applyThumbTint(); } /** * @return the blending mode used to apply the tint to the thumb drawable * @attr ref android.R.styleable#SeekBar_thumbTintMode * @see #setThumbTint(ColorStateList, PorterDuff.Mode) * @see #setThumbTintMode(PorterDuff.Mode) */ @Nullable public PorterDuff.Mode getThumbTintMode() { Loading core/java/android/widget/CheckedTextView.java +85 −0 Original line number Diff line number Diff line Loading @@ -18,9 +18,12 @@ package android.widget; import com.android.internal.R; import android.annotation.Nullable; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.Gravity; Loading @@ -41,8 +44,13 @@ import android.view.accessibility.AccessibilityNodeInfo; */ public class CheckedTextView extends TextView implements Checkable { private boolean mChecked; private int mCheckMarkResource; private Drawable mCheckMarkDrawable; private ColorStateList mCheckMarkTint = null; private PorterDuff.Mode mCheckMarkTintMode = PorterDuff.Mode.SRC_ATOP; private boolean mHasCheckMarkTint = false; private int mBasePadding; private int mCheckMarkWidth; private boolean mNeedRequestlayout; Loading Loading @@ -74,6 +82,16 @@ public class CheckedTextView extends TextView implements Checkable { setCheckMarkDrawable(d); } mCheckMarkTintMode = Drawable.parseTintMode(a.getInt( R.styleable.CompoundButton_buttonTintMode, -1), mCheckMarkTintMode); if (a.hasValue(R.styleable.CompoundButton_buttonTint)) { mCheckMarkTint = a.getColorStateList(R.styleable.CompoundButton_buttonTint); mHasCheckMarkTint = true; applyCheckMarkTint(); } boolean checked = a.getBoolean(R.styleable.CheckedTextView_checked, false); setChecked(checked); Loading Loading @@ -153,6 +171,7 @@ public class CheckedTextView extends TextView implements Checkable { mCheckMarkWidth = d.getIntrinsicWidth(); d.setState(getDrawableState()); applyCheckMarkTint(); } else { mCheckMarkWidth = 0; } Loading @@ -163,6 +182,72 @@ public class CheckedTextView extends TextView implements Checkable { resolvePadding(); } /** * Applies a tint to the check mark drawable. Does not modify the * current tint mode, which is {@link PorterDuff.Mode#SRC_ATOP} by default. * <p> * 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)}. * * @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) */ public void setCheckMarkTint(@Nullable ColorStateList tint) { mCheckMarkTint = tint; mHasCheckMarkTint = true; applyCheckMarkTint(); } /** * @return the tint applied to the check mark drawable * @attr ref android.R.styleable#CheckedTextView_checkMarkTint * @see #setCheckMarkTint(ColorStateList) */ @Nullable public ColorStateList getCheckMarkTint() { return mCheckMarkTint; } /** * Specifies the blending mode used to apply the tint specified by * {@link #setCheckMarkTint(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) */ public void setCheckMarkTintMode(@Nullable PorterDuff.Mode tintMode) { mCheckMarkTintMode = tintMode; applyCheckMarkTint(); } /** * @return the blending mode used to apply the tint to the check mark drawable * @attr ref android.R.styleable#CheckedTextView_checkMarkTintMode * @see #setCheckMarkTintMode(PorterDuff.Mode) */ @Nullable public PorterDuff.Mode getCheckMarkTintMode() { return mCheckMarkTintMode; } private void applyCheckMarkTint() { if (mCheckMarkDrawable != null && mHasCheckMarkTint) { mCheckMarkDrawable = mCheckMarkDrawable.mutate(); mCheckMarkDrawable.setTint(mCheckMarkTint, mCheckMarkTintMode); } } @RemotableViewMethod @Override public void setVisibility(int visibility) { Loading core/java/android/widget/CompoundButton.java +16 −33 Original line number Diff line number Diff line Loading @@ -87,10 +87,11 @@ public abstract class CompoundButton extends Button implements Checkable { setButtonDrawable(d); } if (a.hasValue(R.styleable.CompoundButton_buttonTint)) { mButtonTint = a.getColorStateList(R.styleable.CompoundButton_buttonTint); mButtonTintMode = Drawable.parseTintMode(a.getInt( R.styleable.CompoundButton_buttonTintMode, -1), mButtonTintMode); if (a.hasValue(R.styleable.CompoundButton_buttonTint)) { mButtonTint = a.getColorStateList(R.styleable.CompoundButton_buttonTint); mHasButtonTint = true; applyButtonTint(); Loading Loading @@ -238,52 +239,31 @@ public abstract class CompoundButton extends Button implements Checkable { } /** * Applies a tint to the button drawable. * Applies a tint to the button drawable. Does not modify the current tint * mode, which is {@link PorterDuff.Mode#SRC_ATOP} by default. * <p> * Subsequent calls to {@link #setButtonDrawable(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#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#CompoundButton_buttonTint * @attr ref android.R.styleable#CompoundButton_buttonTintMode * @see Drawable#setTint(ColorStateList, android.graphics.PorterDuff.Mode) * @see #setButtonTint(ColorStateList) * @see Drawable#setTint(ColorStateList, PorterDuff.Mode) */ private void setButtonTint(@Nullable ColorStateList tint, @Nullable PorterDuff.Mode tintMode) { public void setButtonTint(@Nullable ColorStateList tint) { mButtonTint = tint; mButtonTintMode = tintMode; mHasButtonTint = true; applyButtonTint(); } /** * Applies a tint to the button drawable. Does not modify the current tint * mode, which is {@link PorterDuff.Mode#SRC_ATOP} by default. * <p> * Subsequent calls to {@link #setButtonDrawable(Drawable)} will * automatically mutate the drawable and apply the specified tint and tint * mode using * {@link Drawable#setTint(ColorStateList, android.graphics.PorterDuff.Mode)}. * * @param tint the tint to apply, may be {@code null} to clear tint * * @attr ref android.R.styleable#CompoundButton_buttonTint * @see #setButtonTint(ColorStateList, android.graphics.PorterDuff.Mode) */ public void setButtonTint(@Nullable ColorStateList tint) { setButtonTint(tint, mButtonTintMode); } /** * @return the tint applied to the button drawable * @attr ref android.R.styleable#CompoundButton_buttonTint * @see #setButtonTint(ColorStateList, PorterDuff.Mode) * @see #setButtonTint(ColorStateList) */ @Nullable public ColorStateList getButtonTint() { Loading @@ -298,16 +278,19 @@ public abstract class CompoundButton extends Button implements Checkable { * @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 #setButtonTint(ColorStateList) * @see #getButtonTintMode() * @see Drawable#setTint(ColorStateList, PorterDuff.Mode) */ public void setButtonTintMode(@Nullable PorterDuff.Mode tintMode) { setButtonTint(mButtonTint, tintMode); mButtonTintMode = tintMode; applyButtonTint(); } /** * @return the blending mode used to apply the tint to the button drawable * @attr ref android.R.styleable#CompoundButton_buttonTintMode * @see #setButtonTint(ColorStateList, PorterDuff.Mode) * @see #setButtonTintMode(PorterDuff.Mode) */ @Nullable public PorterDuff.Mode getButtonTintMode() { Loading Loading
api/current.txt +6 −0 Original line number Diff line number Diff line Loading @@ -380,6 +380,8 @@ package android { field public static final int centerY = 16843171; // 0x10101a3 field public static final int checkBoxPreferenceStyle = 16842895; // 0x101008f field public static final int checkMark = 16843016; // 0x1010108 field public static final int checkMarkTint = 16843949; // 0x10104ad field public static final int checkMarkTintMode = 16843950; // 0x10104ae field public static final int checkable = 16843237; // 0x10101e5 field public static final int checkableBehavior = 16843232; // 0x10101e0 field public static final int checkboxStyle = 16842860; // 0x101006c Loading Loading @@ -37638,9 +37640,13 @@ package android.widget { ctor public CheckedTextView(android.content.Context, android.util.AttributeSet, int); ctor public CheckedTextView(android.content.Context, android.util.AttributeSet, int, int); method public android.graphics.drawable.Drawable getCheckMarkDrawable(); method public android.content.res.ColorStateList getCheckMarkTint(); method public android.graphics.PorterDuff.Mode getCheckMarkTintMode(); method public boolean isChecked(); method public void setCheckMarkDrawable(int); method public void setCheckMarkDrawable(android.graphics.drawable.Drawable); method public void setCheckMarkTint(android.content.res.ColorStateList); method public void setCheckMarkTintMode(android.graphics.PorterDuff.Mode); method public void setChecked(boolean); method public void toggle(); }
core/java/android/view/View.java +13 −29 Original line number Diff line number Diff line Loading @@ -15546,7 +15546,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** * This function is called whenever the drawable hotspot changes. * This function is called whenever the view hotspot changes and needs to * be propagated to drawables managed by the view. * <p> * Be sure to call through to the superclass when overriding this function. * Loading Loading @@ -15888,50 +15889,30 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** * Applies a tint to the background drawable. * Applies a tint to the background drawable. Does not modify the current tint * mode, which is {@link PorterDuff.Mode#SRC_ATOP} by default. * <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)}. * * @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#View_backgroundTint * @attr ref android.R.styleable#View_backgroundTintMode * @see #getBackgroundTint() * @see Drawable#setTint(ColorStateList, PorterDuff.Mode) */ private void setBackgroundTint(@Nullable ColorStateList tint, @Nullable PorterDuff.Mode tintMode) { public void setBackgroundTint(@Nullable ColorStateList tint) { mBackgroundTint = tint; mBackgroundTintMode = tintMode; mHasBackgroundTint = true; applyBackgroundTint(); } /** * Applies a tint to the background drawable. Does not modify the current tint * mode, which is {@link PorterDuff.Mode#SRC_ATOP} by default. * <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)}. * * @param tint the tint to apply, may be {@code null} to clear tint * * @attr ref android.R.styleable#View_backgroundTint * @see #setBackgroundTint(ColorStateList, PorterDuff.Mode) */ public void setBackgroundTint(@Nullable ColorStateList tint) { setBackgroundTint(tint, mBackgroundTintMode); } /** * @return the tint applied to the background drawable * @attr ref android.R.styleable#View_backgroundTint * @see #setBackgroundTint(ColorStateList, PorterDuff.Mode) * @see #setBackgroundTint(ColorStateList) */ @Nullable public ColorStateList getBackgroundTint() { Loading @@ -15946,16 +15927,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @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 #setBackgroundTint(ColorStateList) * @see #getBackgroundTintMode() * @see Drawable#setTint(ColorStateList, PorterDuff.Mode) */ public void setBackgroundTintMode(@Nullable PorterDuff.Mode tintMode) { setBackgroundTint(mBackgroundTint, tintMode); mBackgroundTintMode = tintMode; applyBackgroundTint(); } /** * @return the blending mode used to apply the tint to the background drawable * @attr ref android.R.styleable#View_backgroundTintMode * @see #setBackgroundTint(ColorStateList, PorterDuff.Mode) * @see #setBackgroundTintMode(PorterDuff.Mode) */ @Nullable public PorterDuff.Mode getBackgroundTintMode() {
core/java/android/widget/AbsSeekBar.java +15 −30 Original line number Diff line number Diff line Loading @@ -92,10 +92,11 @@ public abstract class AbsSeekBar extends ProgressBar { final Drawable thumb = a.getDrawable(com.android.internal.R.styleable.SeekBar_thumb); setThumb(thumb); if (a.hasValue(R.styleable.SeekBar_thumbTint)) { mThumbTint = a.getColorStateList(R.styleable.SeekBar_thumbTint); mThumbTintMode = Drawable.parseTintMode(a.getInt( R.styleable.SeekBar_thumbTintMode, -1), mThumbTintMode); if (a.hasValue(R.styleable.SeekBar_thumbTint)) { mThumbTint = a.getColorStateList(R.styleable.SeekBar_thumbTint); mHasThumbTint = true; applyThumbTint(); Loading Loading @@ -183,50 +184,30 @@ public abstract class AbsSeekBar extends ProgressBar { } /** * Applies a tint to the thumb drawable. * Applies a tint to the thumb drawable. Does not modify the current tint * mode, which is {@link PorterDuff.Mode#SRC_ATOP} by default. * <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)}. * * @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#SeekBar_thumbTint * @attr ref android.R.styleable#SeekBar_thumbTintMode * @see #getThumbTint() * @see Drawable#setTint(ColorStateList, PorterDuff.Mode) */ private void setThumbTint(@Nullable ColorStateList tint, @Nullable PorterDuff.Mode tintMode) { public void setThumbTint(@Nullable ColorStateList tint) { mThumbTint = tint; mThumbTintMode = tintMode; mHasThumbTint = true; applyThumbTint(); } /** * Applies a tint to the thumb drawable. Does not modify the current tint * mode, which is {@link PorterDuff.Mode#SRC_ATOP} by default. * <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)}. * * @param tint the tint to apply, may be {@code null} to clear tint * * @attr ref android.R.styleable#SeekBar_thumbTint * @see #setThumbTint(ColorStateList, PorterDuff.Mode) */ public void setThumbTint(@Nullable ColorStateList tint) { setThumbTint(tint, mThumbTintMode); } /** * @return the tint applied to the thumb drawable * @attr ref android.R.styleable#SeekBar_thumbTint * @see #setThumbTint(ColorStateList, PorterDuff.Mode) * @see #setThumbTint(ColorStateList) */ @Nullable public ColorStateList getThumbTint() { Loading @@ -240,17 +221,21 @@ public abstract class AbsSeekBar extends ProgressBar { * * @param tintMode the blending mode used to apply the tint, may be * {@code null} to clear tint * * @attr ref android.R.styleable#SeekBar_thumbTintMode * @see #setThumbTint(ColorStateList) * @see #getThumbTintMode() * @see Drawable#setTint(ColorStateList, PorterDuff.Mode) */ public void setThumbTintMode(@Nullable PorterDuff.Mode tintMode) { setThumbTint(mThumbTint, tintMode); mThumbTintMode = tintMode; applyThumbTint(); } /** * @return the blending mode used to apply the tint to the thumb drawable * @attr ref android.R.styleable#SeekBar_thumbTintMode * @see #setThumbTint(ColorStateList, PorterDuff.Mode) * @see #setThumbTintMode(PorterDuff.Mode) */ @Nullable public PorterDuff.Mode getThumbTintMode() { Loading
core/java/android/widget/CheckedTextView.java +85 −0 Original line number Diff line number Diff line Loading @@ -18,9 +18,12 @@ package android.widget; import com.android.internal.R; import android.annotation.Nullable; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.Gravity; Loading @@ -41,8 +44,13 @@ import android.view.accessibility.AccessibilityNodeInfo; */ public class CheckedTextView extends TextView implements Checkable { private boolean mChecked; private int mCheckMarkResource; private Drawable mCheckMarkDrawable; private ColorStateList mCheckMarkTint = null; private PorterDuff.Mode mCheckMarkTintMode = PorterDuff.Mode.SRC_ATOP; private boolean mHasCheckMarkTint = false; private int mBasePadding; private int mCheckMarkWidth; private boolean mNeedRequestlayout; Loading Loading @@ -74,6 +82,16 @@ public class CheckedTextView extends TextView implements Checkable { setCheckMarkDrawable(d); } mCheckMarkTintMode = Drawable.parseTintMode(a.getInt( R.styleable.CompoundButton_buttonTintMode, -1), mCheckMarkTintMode); if (a.hasValue(R.styleable.CompoundButton_buttonTint)) { mCheckMarkTint = a.getColorStateList(R.styleable.CompoundButton_buttonTint); mHasCheckMarkTint = true; applyCheckMarkTint(); } boolean checked = a.getBoolean(R.styleable.CheckedTextView_checked, false); setChecked(checked); Loading Loading @@ -153,6 +171,7 @@ public class CheckedTextView extends TextView implements Checkable { mCheckMarkWidth = d.getIntrinsicWidth(); d.setState(getDrawableState()); applyCheckMarkTint(); } else { mCheckMarkWidth = 0; } Loading @@ -163,6 +182,72 @@ public class CheckedTextView extends TextView implements Checkable { resolvePadding(); } /** * Applies a tint to the check mark drawable. Does not modify the * current tint mode, which is {@link PorterDuff.Mode#SRC_ATOP} by default. * <p> * 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)}. * * @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) */ public void setCheckMarkTint(@Nullable ColorStateList tint) { mCheckMarkTint = tint; mHasCheckMarkTint = true; applyCheckMarkTint(); } /** * @return the tint applied to the check mark drawable * @attr ref android.R.styleable#CheckedTextView_checkMarkTint * @see #setCheckMarkTint(ColorStateList) */ @Nullable public ColorStateList getCheckMarkTint() { return mCheckMarkTint; } /** * Specifies the blending mode used to apply the tint specified by * {@link #setCheckMarkTint(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) */ public void setCheckMarkTintMode(@Nullable PorterDuff.Mode tintMode) { mCheckMarkTintMode = tintMode; applyCheckMarkTint(); } /** * @return the blending mode used to apply the tint to the check mark drawable * @attr ref android.R.styleable#CheckedTextView_checkMarkTintMode * @see #setCheckMarkTintMode(PorterDuff.Mode) */ @Nullable public PorterDuff.Mode getCheckMarkTintMode() { return mCheckMarkTintMode; } private void applyCheckMarkTint() { if (mCheckMarkDrawable != null && mHasCheckMarkTint) { mCheckMarkDrawable = mCheckMarkDrawable.mutate(); mCheckMarkDrawable.setTint(mCheckMarkTint, mCheckMarkTintMode); } } @RemotableViewMethod @Override public void setVisibility(int visibility) { Loading
core/java/android/widget/CompoundButton.java +16 −33 Original line number Diff line number Diff line Loading @@ -87,10 +87,11 @@ public abstract class CompoundButton extends Button implements Checkable { setButtonDrawable(d); } if (a.hasValue(R.styleable.CompoundButton_buttonTint)) { mButtonTint = a.getColorStateList(R.styleable.CompoundButton_buttonTint); mButtonTintMode = Drawable.parseTintMode(a.getInt( R.styleable.CompoundButton_buttonTintMode, -1), mButtonTintMode); if (a.hasValue(R.styleable.CompoundButton_buttonTint)) { mButtonTint = a.getColorStateList(R.styleable.CompoundButton_buttonTint); mHasButtonTint = true; applyButtonTint(); Loading Loading @@ -238,52 +239,31 @@ public abstract class CompoundButton extends Button implements Checkable { } /** * Applies a tint to the button drawable. * Applies a tint to the button drawable. Does not modify the current tint * mode, which is {@link PorterDuff.Mode#SRC_ATOP} by default. * <p> * Subsequent calls to {@link #setButtonDrawable(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#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#CompoundButton_buttonTint * @attr ref android.R.styleable#CompoundButton_buttonTintMode * @see Drawable#setTint(ColorStateList, android.graphics.PorterDuff.Mode) * @see #setButtonTint(ColorStateList) * @see Drawable#setTint(ColorStateList, PorterDuff.Mode) */ private void setButtonTint(@Nullable ColorStateList tint, @Nullable PorterDuff.Mode tintMode) { public void setButtonTint(@Nullable ColorStateList tint) { mButtonTint = tint; mButtonTintMode = tintMode; mHasButtonTint = true; applyButtonTint(); } /** * Applies a tint to the button drawable. Does not modify the current tint * mode, which is {@link PorterDuff.Mode#SRC_ATOP} by default. * <p> * Subsequent calls to {@link #setButtonDrawable(Drawable)} will * automatically mutate the drawable and apply the specified tint and tint * mode using * {@link Drawable#setTint(ColorStateList, android.graphics.PorterDuff.Mode)}. * * @param tint the tint to apply, may be {@code null} to clear tint * * @attr ref android.R.styleable#CompoundButton_buttonTint * @see #setButtonTint(ColorStateList, android.graphics.PorterDuff.Mode) */ public void setButtonTint(@Nullable ColorStateList tint) { setButtonTint(tint, mButtonTintMode); } /** * @return the tint applied to the button drawable * @attr ref android.R.styleable#CompoundButton_buttonTint * @see #setButtonTint(ColorStateList, PorterDuff.Mode) * @see #setButtonTint(ColorStateList) */ @Nullable public ColorStateList getButtonTint() { Loading @@ -298,16 +278,19 @@ public abstract class CompoundButton extends Button implements Checkable { * @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 #setButtonTint(ColorStateList) * @see #getButtonTintMode() * @see Drawable#setTint(ColorStateList, PorterDuff.Mode) */ public void setButtonTintMode(@Nullable PorterDuff.Mode tintMode) { setButtonTint(mButtonTint, tintMode); mButtonTintMode = tintMode; applyButtonTint(); } /** * @return the blending mode used to apply the tint to the button drawable * @attr ref android.R.styleable#CompoundButton_buttonTintMode * @see #setButtonTint(ColorStateList, PorterDuff.Mode) * @see #setButtonTintMode(PorterDuff.Mode) */ @Nullable public PorterDuff.Mode getButtonTintMode() { Loading