Implement TintableCompoundDrawablesView in TextView-derived widgets
Adds AppCompatMultiAutoCompleteViewTest, which is a direct copy of
AppCompatAutoCompleteViewTest. Everything else is copied from
AppCompatTextView and refactored to match the class names. There's no
new logic in this CL.
Relnote: Backports compound drawable tinting to TextView-derived widgets
Fixes: 165822337
Test: AppCompatCheckBoxTest, etc.
Change-Id: Idf98ced324a724a5cb5b9d5a2f397a3b82fad900
diff --git a/appcompat/appcompat/api/current.txt b/appcompat/appcompat/api/current.txt
index 5fc9a95..c640b8d 100644
--- a/appcompat/appcompat/api/current.txt
+++ b/appcompat/appcompat/api/current.txt
@@ -461,17 +461,21 @@
method public boolean onMenuItemClick(android.view.MenuItem!);
}
- public class AppCompatAutoCompleteTextView extends android.widget.AutoCompleteTextView implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView {
+ public class AppCompatAutoCompleteTextView extends android.widget.AutoCompleteTextView implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatAutoCompleteTextView(android.content.Context);
ctor public AppCompatAutoCompleteTextView(android.content.Context, android.util.AttributeSet?);
ctor public AppCompatAutoCompleteTextView(android.content.Context, android.util.AttributeSet?, int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportBackgroundTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
method public void setEmojiCompatEnabled(boolean);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
method public void setTextAppearance(android.content.Context!, int);
}
@@ -496,7 +500,7 @@
method public void setTextAppearance(android.content.Context!, int);
}
- public class AppCompatCheckBox extends android.widget.CheckBox implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundButton {
+ public class AppCompatCheckBox extends android.widget.CheckBox implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundButton androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatCheckBox(android.content.Context);
ctor public AppCompatCheckBox(android.content.Context, android.util.AttributeSet?);
ctor public AppCompatCheckBox(android.content.Context, android.util.AttributeSet?, int);
@@ -504,6 +508,8 @@
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportButtonTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportButtonTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
method public void setEmojiCompatEnabled(boolean);
@@ -511,34 +517,44 @@
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportButtonTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportButtonTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
}
- public class AppCompatCheckedTextView extends android.widget.CheckedTextView implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView {
+ public class AppCompatCheckedTextView extends android.widget.CheckedTextView implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatCheckedTextView(android.content.Context);
ctor public AppCompatCheckedTextView(android.content.Context, android.util.AttributeSet?);
ctor public AppCompatCheckedTextView(android.content.Context, android.util.AttributeSet?, int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportBackgroundTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
method public void setEmojiCompatEnabled(boolean);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
method public void setTextAppearance(android.content.Context, int);
}
- public class AppCompatEditText extends android.widget.EditText implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.OnReceiveContentViewBehavior androidx.core.view.TintableBackgroundView {
+ public class AppCompatEditText extends android.widget.EditText implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.OnReceiveContentViewBehavior androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatEditText(android.content.Context);
ctor public AppCompatEditText(android.content.Context, android.util.AttributeSet?);
ctor public AppCompatEditText(android.content.Context, android.util.AttributeSet?, int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportBackgroundTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public androidx.core.view.ContentInfoCompat? onReceiveContent(androidx.core.view.ContentInfoCompat);
method public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
method public void setEmojiCompatEnabled(boolean);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
method public void setTextAppearance(android.content.Context!, int);
}
@@ -564,21 +580,25 @@
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
}
- public class AppCompatMultiAutoCompleteTextView extends android.widget.MultiAutoCompleteTextView implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView {
+ public class AppCompatMultiAutoCompleteTextView extends android.widget.MultiAutoCompleteTextView implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatMultiAutoCompleteTextView(android.content.Context);
ctor public AppCompatMultiAutoCompleteTextView(android.content.Context, android.util.AttributeSet?);
ctor public AppCompatMultiAutoCompleteTextView(android.content.Context, android.util.AttributeSet?, int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportBackgroundTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
method public void setEmojiCompatEnabled(boolean);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
method public void setTextAppearance(android.content.Context!, int);
}
- public class AppCompatRadioButton extends android.widget.RadioButton implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundButton {
+ public class AppCompatRadioButton extends android.widget.RadioButton implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundButton androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatRadioButton(android.content.Context!);
ctor public AppCompatRadioButton(android.content.Context!, android.util.AttributeSet?);
ctor public AppCompatRadioButton(android.content.Context!, android.util.AttributeSet?, int);
@@ -586,6 +606,8 @@
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportButtonTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportButtonTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
method public void setEmojiCompatEnabled(boolean);
@@ -593,6 +615,8 @@
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportButtonTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportButtonTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
}
public class AppCompatRatingBar extends android.widget.RatingBar {
@@ -645,16 +669,20 @@
method public void setTextMetricsParamsCompat(androidx.core.text.PrecomputedTextCompat.Params);
}
- public class AppCompatToggleButton extends android.widget.ToggleButton implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView {
+ public class AppCompatToggleButton extends android.widget.ToggleButton implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatToggleButton(android.content.Context);
ctor public AppCompatToggleButton(android.content.Context, android.util.AttributeSet?);
ctor public AppCompatToggleButton(android.content.Context, android.util.AttributeSet?, int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportBackgroundTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public void setEmojiCompatEnabled(boolean);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
}
public interface EmojiCompatConfigurationView {
diff --git a/appcompat/appcompat/api/public_plus_experimental_current.txt b/appcompat/appcompat/api/public_plus_experimental_current.txt
index 5fc9a95..c640b8d 100644
--- a/appcompat/appcompat/api/public_plus_experimental_current.txt
+++ b/appcompat/appcompat/api/public_plus_experimental_current.txt
@@ -461,17 +461,21 @@
method public boolean onMenuItemClick(android.view.MenuItem!);
}
- public class AppCompatAutoCompleteTextView extends android.widget.AutoCompleteTextView implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView {
+ public class AppCompatAutoCompleteTextView extends android.widget.AutoCompleteTextView implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatAutoCompleteTextView(android.content.Context);
ctor public AppCompatAutoCompleteTextView(android.content.Context, android.util.AttributeSet?);
ctor public AppCompatAutoCompleteTextView(android.content.Context, android.util.AttributeSet?, int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportBackgroundTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
method public void setEmojiCompatEnabled(boolean);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
method public void setTextAppearance(android.content.Context!, int);
}
@@ -496,7 +500,7 @@
method public void setTextAppearance(android.content.Context!, int);
}
- public class AppCompatCheckBox extends android.widget.CheckBox implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundButton {
+ public class AppCompatCheckBox extends android.widget.CheckBox implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundButton androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatCheckBox(android.content.Context);
ctor public AppCompatCheckBox(android.content.Context, android.util.AttributeSet?);
ctor public AppCompatCheckBox(android.content.Context, android.util.AttributeSet?, int);
@@ -504,6 +508,8 @@
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportButtonTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportButtonTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
method public void setEmojiCompatEnabled(boolean);
@@ -511,34 +517,44 @@
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportButtonTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportButtonTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
}
- public class AppCompatCheckedTextView extends android.widget.CheckedTextView implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView {
+ public class AppCompatCheckedTextView extends android.widget.CheckedTextView implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatCheckedTextView(android.content.Context);
ctor public AppCompatCheckedTextView(android.content.Context, android.util.AttributeSet?);
ctor public AppCompatCheckedTextView(android.content.Context, android.util.AttributeSet?, int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportBackgroundTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
method public void setEmojiCompatEnabled(boolean);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
method public void setTextAppearance(android.content.Context, int);
}
- public class AppCompatEditText extends android.widget.EditText implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.OnReceiveContentViewBehavior androidx.core.view.TintableBackgroundView {
+ public class AppCompatEditText extends android.widget.EditText implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.OnReceiveContentViewBehavior androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatEditText(android.content.Context);
ctor public AppCompatEditText(android.content.Context, android.util.AttributeSet?);
ctor public AppCompatEditText(android.content.Context, android.util.AttributeSet?, int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportBackgroundTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public androidx.core.view.ContentInfoCompat? onReceiveContent(androidx.core.view.ContentInfoCompat);
method public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
method public void setEmojiCompatEnabled(boolean);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
method public void setTextAppearance(android.content.Context!, int);
}
@@ -564,21 +580,25 @@
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
}
- public class AppCompatMultiAutoCompleteTextView extends android.widget.MultiAutoCompleteTextView implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView {
+ public class AppCompatMultiAutoCompleteTextView extends android.widget.MultiAutoCompleteTextView implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatMultiAutoCompleteTextView(android.content.Context);
ctor public AppCompatMultiAutoCompleteTextView(android.content.Context, android.util.AttributeSet?);
ctor public AppCompatMultiAutoCompleteTextView(android.content.Context, android.util.AttributeSet?, int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportBackgroundTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
method public void setEmojiCompatEnabled(boolean);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
method public void setTextAppearance(android.content.Context!, int);
}
- public class AppCompatRadioButton extends android.widget.RadioButton implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundButton {
+ public class AppCompatRadioButton extends android.widget.RadioButton implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundButton androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatRadioButton(android.content.Context!);
ctor public AppCompatRadioButton(android.content.Context!, android.util.AttributeSet?);
ctor public AppCompatRadioButton(android.content.Context!, android.util.AttributeSet?, int);
@@ -586,6 +606,8 @@
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportButtonTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportButtonTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
method public void setEmojiCompatEnabled(boolean);
@@ -593,6 +615,8 @@
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportButtonTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportButtonTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
}
public class AppCompatRatingBar extends android.widget.RatingBar {
@@ -645,16 +669,20 @@
method public void setTextMetricsParamsCompat(androidx.core.text.PrecomputedTextCompat.Params);
}
- public class AppCompatToggleButton extends android.widget.ToggleButton implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView {
+ public class AppCompatToggleButton extends android.widget.ToggleButton implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatToggleButton(android.content.Context);
ctor public AppCompatToggleButton(android.content.Context, android.util.AttributeSet?);
ctor public AppCompatToggleButton(android.content.Context, android.util.AttributeSet?, int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportBackgroundTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public void setEmojiCompatEnabled(boolean);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
}
public interface EmojiCompatConfigurationView {
diff --git a/appcompat/appcompat/api/restricted_current.txt b/appcompat/appcompat/api/restricted_current.txt
index 81ff914..82bdaaa 100644
--- a/appcompat/appcompat/api/restricted_current.txt
+++ b/appcompat/appcompat/api/restricted_current.txt
@@ -1329,17 +1329,21 @@
ctor public AlertDialogLayout(android.content.Context?, android.util.AttributeSet?);
}
- @androidx.resourceinspection.annotation.AppCompatShadowedAttributes public class AppCompatAutoCompleteTextView extends android.widget.AutoCompleteTextView implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView {
+ @androidx.resourceinspection.annotation.AppCompatShadowedAttributes public class AppCompatAutoCompleteTextView extends android.widget.AutoCompleteTextView implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatAutoCompleteTextView(android.content.Context);
ctor public AppCompatAutoCompleteTextView(android.content.Context, android.util.AttributeSet?);
ctor public AppCompatAutoCompleteTextView(android.content.Context, android.util.AttributeSet?, int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportBackgroundTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
method public void setEmojiCompatEnabled(boolean);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
method public void setTextAppearance(android.content.Context!, int);
}
@@ -1364,7 +1368,7 @@
method public void setTextAppearance(android.content.Context!, int);
}
- @androidx.resourceinspection.annotation.AppCompatShadowedAttributes public class AppCompatCheckBox extends android.widget.CheckBox implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundButton {
+ @androidx.resourceinspection.annotation.AppCompatShadowedAttributes public class AppCompatCheckBox extends android.widget.CheckBox implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundButton androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatCheckBox(android.content.Context);
ctor public AppCompatCheckBox(android.content.Context, android.util.AttributeSet?);
ctor public AppCompatCheckBox(android.content.Context, android.util.AttributeSet?, int);
@@ -1372,6 +1376,8 @@
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportButtonTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportButtonTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
method public void setEmojiCompatEnabled(boolean);
@@ -1379,9 +1385,11 @@
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportButtonTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportButtonTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
}
- @androidx.resourceinspection.annotation.AppCompatShadowedAttributes public class AppCompatCheckedTextView extends android.widget.CheckedTextView implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCheckedTextView {
+ @androidx.resourceinspection.annotation.AppCompatShadowedAttributes public class AppCompatCheckedTextView extends android.widget.CheckedTextView implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCheckedTextView androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatCheckedTextView(android.content.Context);
ctor public AppCompatCheckedTextView(android.content.Context, android.util.AttributeSet?);
ctor public AppCompatCheckedTextView(android.content.Context, android.util.AttributeSet?, int);
@@ -1389,6 +1397,8 @@
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCheckMarkTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCheckMarkTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
method public void setEmojiCompatEnabled(boolean);
@@ -1396,6 +1406,8 @@
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCheckMarkTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCheckMarkTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
method public void setTextAppearance(android.content.Context, int);
}
@@ -1408,18 +1420,22 @@
method public static void preload();
}
- @androidx.resourceinspection.annotation.AppCompatShadowedAttributes public class AppCompatEditText extends android.widget.EditText implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.OnReceiveContentViewBehavior androidx.core.view.TintableBackgroundView {
+ @androidx.resourceinspection.annotation.AppCompatShadowedAttributes public class AppCompatEditText extends android.widget.EditText implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.OnReceiveContentViewBehavior androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatEditText(android.content.Context);
ctor public AppCompatEditText(android.content.Context, android.util.AttributeSet?);
ctor public AppCompatEditText(android.content.Context, android.util.AttributeSet?, int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportBackgroundTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public androidx.core.view.ContentInfoCompat? onReceiveContent(androidx.core.view.ContentInfoCompat);
method public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
method public void setEmojiCompatEnabled(boolean);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
method public void setTextAppearance(android.content.Context!, int);
}
@@ -1459,21 +1475,25 @@
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportImageTintMode(android.graphics.PorterDuff.Mode?);
}
- @androidx.resourceinspection.annotation.AppCompatShadowedAttributes public class AppCompatMultiAutoCompleteTextView extends android.widget.MultiAutoCompleteTextView implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView {
+ @androidx.resourceinspection.annotation.AppCompatShadowedAttributes public class AppCompatMultiAutoCompleteTextView extends android.widget.MultiAutoCompleteTextView implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatMultiAutoCompleteTextView(android.content.Context);
ctor public AppCompatMultiAutoCompleteTextView(android.content.Context, android.util.AttributeSet?);
ctor public AppCompatMultiAutoCompleteTextView(android.content.Context, android.util.AttributeSet?, int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportBackgroundTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
method public void setEmojiCompatEnabled(boolean);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
method public void setTextAppearance(android.content.Context!, int);
}
- @androidx.resourceinspection.annotation.AppCompatShadowedAttributes public class AppCompatRadioButton extends android.widget.RadioButton implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundButton {
+ @androidx.resourceinspection.annotation.AppCompatShadowedAttributes public class AppCompatRadioButton extends android.widget.RadioButton implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundButton androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatRadioButton(android.content.Context!);
ctor public AppCompatRadioButton(android.content.Context!, android.util.AttributeSet?);
ctor public AppCompatRadioButton(android.content.Context!, android.util.AttributeSet?, int);
@@ -1481,6 +1501,8 @@
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportButtonTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportButtonTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public void setBackgroundDrawable(android.graphics.drawable.Drawable?);
method public void setEmojiCompatEnabled(boolean);
@@ -1488,6 +1510,8 @@
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportButtonTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportButtonTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
}
public class AppCompatRatingBar extends android.widget.RatingBar {
@@ -1540,16 +1564,20 @@
method public void setTextMetricsParamsCompat(androidx.core.text.PrecomputedTextCompat.Params);
}
- @androidx.resourceinspection.annotation.AppCompatShadowedAttributes public class AppCompatToggleButton extends android.widget.ToggleButton implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView {
+ @androidx.resourceinspection.annotation.AppCompatShadowedAttributes public class AppCompatToggleButton extends android.widget.ToggleButton implements androidx.appcompat.widget.EmojiCompatConfigurationView androidx.core.view.TintableBackgroundView androidx.core.widget.TintableCompoundDrawablesView {
ctor public AppCompatToggleButton(android.content.Context);
ctor public AppCompatToggleButton(android.content.Context, android.util.AttributeSet?);
ctor public AppCompatToggleButton(android.content.Context, android.util.AttributeSet?, int);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportBackgroundTintList();
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportBackgroundTintMode();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.content.res.ColorStateList? getSupportCompoundDrawablesTintList();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.graphics.PorterDuff.Mode? getSupportCompoundDrawablesTintMode();
method public boolean isEmojiCompatEnabled();
method public void setEmojiCompatEnabled(boolean);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintList(android.content.res.ColorStateList?);
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintList(android.content.res.ColorStateList?);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setSupportCompoundDrawablesTintMode(android.graphics.PorterDuff.Mode?);
}
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class ButtonBarLayout extends android.widget.LinearLayout {
diff --git a/appcompat/appcompat/src/androidTest/AndroidManifest.xml b/appcompat/appcompat/src/androidTest/AndroidManifest.xml
index 7f1e955..5c3a07c 100644
--- a/appcompat/appcompat/src/androidTest/AndroidManifest.xml
+++ b/appcompat/appcompat/src/androidTest/AndroidManifest.xml
@@ -107,6 +107,10 @@
android:label="@string/app_compat_auto_complete_text_view_activity"
android:theme="@style/Theme.TextColors"/>
+ <activity
+ android:name="androidx.appcompat.widget.AppCompatMultiAutoCompleteTextViewActivity"
+ android:label="@string/app_compat_multi_auto_complete_text_view_activity"
+ android:theme="@style/Theme.TextColors"/>
<activity
android:name="androidx.appcompat.widget.AppCompatMultiAutoCompleteTextViewEmojiActivity"
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatAutoCompleteTextViewTest.java b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatAutoCompleteTextViewTest.java
index 448975c..02a86d3 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatAutoCompleteTextViewTest.java
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatAutoCompleteTextViewTest.java
@@ -15,15 +15,31 @@
*/
package androidx.appcompat.widget;
+import static androidx.appcompat.testutils.TestUtilsActions.setEnabled;
+import static androidx.test.espresso.Espresso.onView;
+import static androidx.test.espresso.action.ViewActions.scrollTo;
+import static androidx.test.espresso.matcher.ViewMatchers.withId;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+import android.content.res.ColorStateList;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuItem;
+import androidx.appcompat.content.res.AppCompatResources;
+import androidx.appcompat.testutils.TestUtils;
+import androidx.core.content.res.ResourcesCompat;
+import androidx.core.graphics.ColorUtils;
+import androidx.core.widget.TextViewCompat;
import androidx.test.annotation.UiThreadTest;
import androidx.test.filters.LargeTest;
+import androidx.test.filters.SdkSuppress;
+
+import org.junit.Test;
/**
* In addition to all tinting-related tests done by the base class, this class provides
@@ -73,4 +89,194 @@
view.setCustomSelectionActionModeCallback(null);
assertNull(view.getCustomSelectionActionModeCallback());
}
+
+ @Test
+ public void testCompoundDrawablesTint() {
+ // Given an ACTV with a white drawableLeftCompat set and a #f0f drawableTint
+ final AppCompatAutoCompleteTextView textView = mActivity.findViewById(
+ androidx.appcompat.test.R.id.text_view_compound_drawable_tint);
+ final int tint = 0xffff00ff;
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatAutoCompleteTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(ColorStateList.valueOf(tint),
+ TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @SdkSuppress(minSdkVersion = 17)
+ @Test
+ public void testCompoundDrawableRelativeTint() {
+ // Given an ACTV with a white drawableStartCompat set and a #f0f drawableTint
+ final AppCompatAutoCompleteTextView textView = mActivity.findViewById(
+ androidx.appcompat.test.R.id.text_view_compound_drawable_relative_tint);
+ final int tint = 0xffff00ff;
+ // Then the drawable should be tinted
+ final Drawable drawable = TextViewCompat.getCompoundDrawablesRelative(textView)[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatAutoCompleteTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(ColorStateList.valueOf(tint),
+ TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @Test
+ public void testCompoundDrawablesTintList() {
+ // Given an ACTV with a white drawableLeftCompat and a ColorStateList drawableTint set
+ final AppCompatAutoCompleteTextView textView = mActivity.findViewById(
+ androidx.appcompat.test.R.id.text_view_compound_drawable_tint_list);
+ final int defaultTint = ResourcesCompat.getColor(
+ mResources, androidx.appcompat.test.R.color.lilac_default, null);
+ final int disabledTint = ResourcesCompat.getColor(
+ mResources, androidx.appcompat.test.R.color.lilac_disabled, null);
+
+ // Then the initial drawable tint is applied
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatAutoCompleteTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ defaultTint,
+ 0,
+ true);
+
+ // When the view is disabled
+ onView(withId(textView.getId())).perform(scrollTo(), setEnabled(false));
+ // Then the appropriate drawable tint is applied
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatAutoCompleteTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ disabledTint,
+ 0,
+ true);
+ }
+
+ @Test
+ public void testCompoundDrawablesTintMode() {
+ // Given an ACTV with a red drawableLeft, a semi-transparent blue drawableTint
+ // & drawableTintMode of src_over
+ final AppCompatAutoCompleteTextView textView = mActivity.findViewById(
+ androidx.appcompat.test.R.id.text_view_compound_drawable_tint_mode);
+ final int expected = ColorUtils.compositeColors(0x800000ff, 0xffff0000);
+ final int tolerance = 2; // allow some tolerance for the blending
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatAutoCompleteTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ expected,
+ tolerance,
+ true);
+ // Then the TextViewCompat getter returns the mode
+ assertEquals(PorterDuff.Mode.SRC_OVER,
+ TextViewCompat.getCompoundDrawableTintMode(textView));
+ }
+
+ @UiThreadTest
+ @Test
+ public void testSetCompoundDrawablesTintList() {
+ // Given an ACTV with a compound drawable
+ final AppCompatAutoCompleteTextView textView = new AppCompatAutoCompleteTextView(mActivity);
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, androidx.appcompat.test.R.drawable.white_square), null, null, null);
+
+ // When a tint is set programmatically
+ final int tint = 0xffa4c639;
+ final ColorStateList tintList = ColorStateList.valueOf(tint);
+ TextViewCompat.setCompoundDrawableTintList(textView, tintList);
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatAutoCompleteTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(tintList, TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @UiThreadTest
+ @Test
+ public void testSetCompoundDrawablesTintMode() {
+ // Given an ACTV with a red compound drawable
+ final AppCompatAutoCompleteTextView textView = new AppCompatAutoCompleteTextView(mActivity);
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, androidx.appcompat.test.R.drawable.red_square), null, null, null);
+
+ // When a semi-transparent blue tint is set programmatically with a mode of SRC_OVER
+ final int tint = 0x800000ff;
+ final PorterDuff.Mode mode = PorterDuff.Mode.SRC_OVER;
+ final ColorStateList tintList = ColorStateList.valueOf(tint);
+ TextViewCompat.setCompoundDrawableTintList(textView, tintList);
+ TextViewCompat.setCompoundDrawableTintMode(textView, mode);
+ final int expected = ColorUtils.compositeColors(tint, 0xffff0000);
+ final int tolerance = 2; // allow some tolerance for the blending
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatAutoCompleteTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ expected,
+ tolerance,
+ true);
+ // Then the TextViewCompat getter should return the tint mode
+ assertEquals(mode, TextViewCompat.getCompoundDrawableTintMode(textView));
+ }
+
+ @UiThreadTest
+ @Test
+ public void testCompoundDrawablesSetAfterTint() {
+ // Given an ACTV with a magenta tint
+ final AppCompatAutoCompleteTextView textView = new AppCompatAutoCompleteTextView(mActivity);
+ final int tint = 0xffff00ff;
+ TextViewCompat.setCompoundDrawableTintList(textView, ColorStateList.valueOf(tint));
+
+ // When a white compound drawable is set
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, androidx.appcompat.test.R.drawable.white_square), null, null, null);
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatAutoCompleteTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ }
}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatCheckBoxTest.java b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatCheckBoxTest.java
index 40272a4..bf5cd46 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatCheckBoxTest.java
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatCheckBoxTest.java
@@ -15,19 +15,29 @@
*/
package androidx.appcompat.widget;
+import static androidx.appcompat.testutils.TestUtilsActions.setEnabled;
+import static androidx.test.espresso.Espresso.onView;
+import static androidx.test.espresso.matcher.ViewMatchers.withId;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import android.content.res.ColorStateList;
+import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.AnimatedStateListDrawable;
import android.graphics.drawable.Drawable;
+import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat;
import androidx.appcompat.test.R;
+import androidx.appcompat.testutils.TestUtils;
import androidx.core.content.res.ResourcesCompat;
+import androidx.core.graphics.ColorUtils;
import androidx.core.widget.CompoundButtonCompat;
+import androidx.core.widget.TextViewCompat;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
import androidx.test.filters.SdkSuppress;
@@ -86,4 +96,190 @@
assertNotNull(button);
assertFalse(isAnimated);
}
+
+ @Test
+ public void testCompoundDrawablesTint() {
+ // Given an ACTV with a white drawableLeftCompat set and a #f0f drawableTint
+ final AppCompatCheckBox textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_tint);
+ final int tint = 0xffff00ff;
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatCheckBox compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(ColorStateList.valueOf(tint),
+ TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @SdkSuppress(minSdkVersion = 17)
+ @Test
+ public void testCompoundDrawableRelativeTint() {
+ // Given an ACTV with a white drawableStartCompat set and a #f0f drawableTint
+ final AppCompatCheckBox textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_relative_tint);
+ final int tint = 0xffff00ff;
+ // Then the drawable should be tinted
+ final Drawable drawable = TextViewCompat.getCompoundDrawablesRelative(textView)[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatCheckBox compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(ColorStateList.valueOf(tint),
+ TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @Test
+ public void testCompoundDrawablesTintList() {
+ // Given an ACTV with a white drawableLeftCompat and a ColorStateList drawableTint set
+ final AppCompatCheckBox textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_tint_list);
+ final int defaultTint = ResourcesCompat.getColor(mResources, R.color.lilac_default, null);
+ final int disabledTint = ResourcesCompat.getColor(mResources, R.color.lilac_disabled, null);
+
+ // Then the initial drawable tint is applied
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatCheckBox compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ defaultTint,
+ 0,
+ true);
+
+ // When the view is disabled
+ onView(withId(textView.getId())).perform(setEnabled(false));
+ // Then the appropriate drawable tint is applied
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatCheckBox compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ disabledTint,
+ 0,
+ true);
+ }
+
+ @Test
+ public void testCompoundDrawablesTintMode() {
+ // Given an ACTV with a red drawableLeft, a semi-transparent blue drawableTint
+ // & drawableTintMode of src_over
+ final AppCompatCheckBox textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_tint_mode);
+ final int expected = ColorUtils.compositeColors(0x800000ff, 0xffff0000);
+ final int tolerance = 2; // allow some tolerance for the blending
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatCheckBox compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ expected,
+ tolerance,
+ true);
+ // Then the TextViewCompat getter returns the mode
+ assertEquals(PorterDuff.Mode.SRC_OVER,
+ TextViewCompat.getCompoundDrawableTintMode(textView));
+ }
+
+ @Test
+ public void testSetCompoundDrawablesTintList() {
+ // Given an ACTV with a compound drawable
+ final AppCompatCheckBox textView = new AppCompatCheckBox(mActivity);
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, R.drawable.white_square), null, null, null);
+
+ // When a tint is set programmatically
+ final int tint = 0xffa4c639;
+ final ColorStateList tintList = ColorStateList.valueOf(tint);
+ TextViewCompat.setCompoundDrawableTintList(textView, tintList);
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatCheckBox compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(tintList, TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @Test
+ public void testSetCompoundDrawablesTintMode() {
+ // Given an ACTV with a red compound drawable
+ final AppCompatCheckBox textView = new AppCompatCheckBox(mActivity);
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, R.drawable.red_square), null, null, null);
+
+ // When a semi-transparent blue tint is set programmatically with a mode of SRC_OVER
+ final int tint = 0x800000ff;
+ final PorterDuff.Mode mode = PorterDuff.Mode.SRC_OVER;
+ final ColorStateList tintList = ColorStateList.valueOf(tint);
+ TextViewCompat.setCompoundDrawableTintList(textView, tintList);
+ TextViewCompat.setCompoundDrawableTintMode(textView, mode);
+ final int expected = ColorUtils.compositeColors(tint, 0xffff0000);
+ final int tolerance = 2; // allow some tolerance for the blending
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatCheckBox compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ expected,
+ tolerance,
+ true);
+ // Then the TextViewCompat getter should return the tint mode
+ assertEquals(mode, TextViewCompat.getCompoundDrawableTintMode(textView));
+ }
+
+
+ @Test
+ public void testCompoundDrawablesSetAfterTint() {
+ // Given an ACTV with a magenta tint
+ final AppCompatCheckBox textView = new AppCompatCheckBox(mActivity);
+ final int tint = 0xffff00ff;
+ TextViewCompat.setCompoundDrawableTintList(textView, ColorStateList.valueOf(tint));
+
+ // When a white compound drawable is set
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, R.drawable.white_square), null, null, null);
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatCheckBox compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ }
}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatCheckedTextViewTest.java b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatCheckedTextViewTest.java
index 6df367d..d20446c 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatCheckedTextViewTest.java
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatCheckedTextViewTest.java
@@ -15,11 +15,19 @@
*/
package androidx.appcompat.widget;
+import static android.os.Build.VERSION.SDK_INT;
+
+import static androidx.appcompat.testutils.TestUtilsActions.setEnabled;
+import static androidx.test.espresso.Espresso.onView;
+import static androidx.test.espresso.matcher.ViewMatchers.withId;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import android.content.res.ColorStateList;
+import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.AnimatedStateListDrawable;
import android.graphics.drawable.Drawable;
@@ -27,10 +35,14 @@
import android.view.Menu;
import android.view.MenuItem;
+import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat;
import androidx.appcompat.test.R;
+import androidx.appcompat.testutils.TestUtils;
import androidx.core.content.res.ResourcesCompat;
+import androidx.core.graphics.ColorUtils;
import androidx.core.widget.CheckedTextViewCompat;
+import androidx.core.widget.TextViewCompat;
import androidx.test.annotation.UiThreadTest;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
@@ -85,8 +97,12 @@
// Then this drawable should be an animated-selector
// i.e. compat version has precedence
- assertTrue(checkMark instanceof AnimatedStateListDrawableCompat
- || checkMark instanceof AnimatedStateListDrawable);
+ if (SDK_INT >= 21) {
+ assertTrue(checkMark instanceof AnimatedStateListDrawableCompat
+ || checkMark instanceof AnimatedStateListDrawable);
+ } else {
+ assertTrue(checkMark instanceof AnimatedStateListDrawableCompat);
+ }
}
/* Max SDK as we use this test to verify the fallback behavior in situations where the ASLD
@@ -149,4 +165,190 @@
view.setCustomSelectionActionModeCallback(null);
assertNull(view.getCustomSelectionActionModeCallback());
}
+
+ @Test
+ public void testCompoundDrawablesTint() {
+ // Given an ACTV with a white drawableLeftCompat set and a #f0f drawableTint
+ final AppCompatCheckedTextView textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_tint);
+ final int tint = 0xffff00ff;
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatCheckedTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(ColorStateList.valueOf(tint),
+ TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @SdkSuppress(minSdkVersion = 17)
+ @Test
+ public void testCompoundDrawableRelativeTint() {
+ // Given an ACTV with a white drawableStartCompat set and a #f0f drawableTint
+ final AppCompatCheckedTextView textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_relative_tint);
+ final int tint = 0xffff00ff;
+ // Then the drawable should be tinted
+ final Drawable drawable = TextViewCompat.getCompoundDrawablesRelative(textView)[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatCheckedTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(ColorStateList.valueOf(tint),
+ TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @Test
+ public void testCompoundDrawablesTintList() {
+ // Given an ACTV with a white drawableLeftCompat and a ColorStateList drawableTint set
+ final AppCompatCheckedTextView textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_tint_list);
+ final int defaultTint = ResourcesCompat.getColor(mResources, R.color.lilac_default, null);
+ final int disabledTint = ResourcesCompat.getColor(mResources, R.color.lilac_disabled, null);
+
+ // Then the initial drawable tint is applied
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatCheckedTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ defaultTint,
+ 0,
+ true);
+
+ // When the view is disabled
+ onView(withId(textView.getId())).perform(setEnabled(false));
+ // Then the appropriate drawable tint is applied
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatCheckedTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ disabledTint,
+ 0,
+ true);
+ }
+
+ @Test
+ public void testCompoundDrawablesTintMode() {
+ // Given an ACTV with a red drawableLeft, a semi-transparent blue drawableTint
+ // & drawableTintMode of src_over
+ final AppCompatCheckedTextView textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_tint_mode);
+ final int expected = ColorUtils.compositeColors(0x800000ff, 0xffff0000);
+ final int tolerance = 2; // allow some tolerance for the blending
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatCheckedTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ expected,
+ tolerance,
+ true);
+ // Then the TextViewCompat getter returns the mode
+ assertEquals(PorterDuff.Mode.SRC_OVER,
+ TextViewCompat.getCompoundDrawableTintMode(textView));
+ }
+
+ @Test
+ public void testSetCompoundDrawablesTintList() {
+ // Given an ACTV with a compound drawable
+ final AppCompatCheckedTextView textView = new AppCompatCheckedTextView(mActivity);
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, R.drawable.white_square), null, null, null);
+
+ // When a tint is set programmatically
+ final int tint = 0xffa4c639;
+ final ColorStateList tintList = ColorStateList.valueOf(tint);
+ TextViewCompat.setCompoundDrawableTintList(textView, tintList);
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatCheckedTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(tintList, TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @Test
+ public void testSetCompoundDrawablesTintMode() {
+ // Given an ACTV with a red compound drawable
+ final AppCompatCheckedTextView textView = new AppCompatCheckedTextView(mActivity);
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, R.drawable.red_square), null, null, null);
+
+ // When a semi-transparent blue tint is set programmatically with a mode of SRC_OVER
+ final int tint = 0x800000ff;
+ final PorterDuff.Mode mode = PorterDuff.Mode.SRC_OVER;
+ final ColorStateList tintList = ColorStateList.valueOf(tint);
+ TextViewCompat.setCompoundDrawableTintList(textView, tintList);
+ TextViewCompat.setCompoundDrawableTintMode(textView, mode);
+ final int expected = ColorUtils.compositeColors(tint, 0xffff0000);
+ final int tolerance = 2; // allow some tolerance for the blending
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatCheckedTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ expected,
+ tolerance,
+ true);
+ // Then the TextViewCompat getter should return the tint mode
+ assertEquals(mode, TextViewCompat.getCompoundDrawableTintMode(textView));
+ }
+
+
+ @Test
+ public void testCompoundDrawablesSetAfterTint() {
+ // Given an ACTV with a magenta tint
+ final AppCompatCheckedTextView textView = new AppCompatCheckedTextView(mActivity);
+ final int tint = 0xffff00ff;
+ TextViewCompat.setCompoundDrawableTintList(textView, ColorStateList.valueOf(tint));
+
+ // When a white compound drawable is set
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, R.drawable.white_square), null, null, null);
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatCheckedTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ }
}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatEditTextTest.java b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatEditTextTest.java
index 7a1b0fb..b2c2950 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatEditTextTest.java
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatEditTextTest.java
@@ -16,11 +16,19 @@
package androidx.appcompat.widget;
+import static androidx.appcompat.testutils.TestUtilsActions.setEnabled;
+import static androidx.test.espresso.Espresso.onView;
+import static androidx.test.espresso.action.ViewActions.scrollTo;
+import static androidx.test.espresso.matcher.ViewMatchers.withId;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import android.content.Context;
import android.content.res.ColorStateList;
+import android.content.res.Resources;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
import android.text.Editable;
import android.text.Layout;
import android.view.ActionMode;
@@ -31,8 +39,12 @@
import android.widget.EditText;
import androidx.annotation.ColorRes;
+import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.test.R;
+import androidx.appcompat.testutils.TestUtils;
import androidx.core.content.ContextCompat;
+import androidx.core.content.res.ResourcesCompat;
+import androidx.core.graphics.ColorUtils;
import androidx.core.widget.TextViewCompat;
import androidx.test.annotation.UiThreadTest;
import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -40,6 +52,7 @@
import androidx.test.filters.SdkSuppress;
import androidx.test.rule.ActivityTestRule;
+import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -54,6 +67,15 @@
public final ActivityTestRule<AppCompatEditTextActivity> mActivityTestRule =
new ActivityTestRule<>(AppCompatEditTextActivity.class);
+ private AppCompatEditTextActivity mActivity;
+ private Resources mResources;
+
+ @Before
+ public void setUp() {
+ mActivity = mActivityTestRule.getActivity();
+ mResources = mActivity.getResources();
+ }
+
@Test
@UiThreadTest
public void testGetTextNonEditable() {
@@ -235,4 +257,192 @@
view.setCustomSelectionActionModeCallback(null);
assertNull(view.getCustomSelectionActionModeCallback());
}
+
+ @Test
+ public void testCompoundDrawablesTint() {
+ // Given an ACTV with a white drawableLeftCompat set and a #f0f drawableTint
+ final AppCompatEditText textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_tint);
+ final int tint = 0xffff00ff;
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatEditText compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(ColorStateList.valueOf(tint),
+ TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @SdkSuppress(minSdkVersion = 17)
+ @Test
+ public void testCompoundDrawableRelativeTint() {
+ // Given an ACTV with a white drawableStartCompat set and a #f0f drawableTint
+ final AppCompatEditText textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_relative_tint);
+ final int tint = 0xffff00ff;
+ // Then the drawable should be tinted
+ final Drawable drawable = TextViewCompat.getCompoundDrawablesRelative(textView)[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatEditText compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(ColorStateList.valueOf(tint),
+ TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @Test
+ public void testCompoundDrawablesTintList() {
+ // Given an ACTV with a white drawableLeftCompat and a ColorStateList drawableTint set
+ final AppCompatEditText textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_tint_list);
+ final int defaultTint = ResourcesCompat.getColor(mResources, R.color.lilac_default, null);
+ final int disabledTint = ResourcesCompat.getColor(mResources, R.color.lilac_disabled, null);
+
+ // Then the initial drawable tint is applied
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatEditText compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ defaultTint,
+ 0,
+ true);
+
+ // When the view is disabled
+ onView(withId(textView.getId())).perform(scrollTo(), setEnabled(false));
+ // Then the appropriate drawable tint is applied
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatEditText compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ disabledTint,
+ 0,
+ true);
+ }
+
+ @Test
+ public void testCompoundDrawablesTintMode() {
+ // Given an ACTV with a red drawableLeft, a semi-transparent blue drawableTint
+ // & drawableTintMode of src_over
+ final AppCompatEditText textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_tint_mode);
+ final int expected = ColorUtils.compositeColors(0x800000ff, 0xffff0000);
+ final int tolerance = 2; // allow some tolerance for the blending
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatEditText compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ expected,
+ tolerance,
+ true);
+ // Then the TextViewCompat getter returns the mode
+ assertEquals(PorterDuff.Mode.SRC_OVER,
+ TextViewCompat.getCompoundDrawableTintMode(textView));
+ }
+
+ @UiThreadTest
+ @Test
+ public void testSetCompoundDrawablesTintList() {
+ // Given an ACTV with a compound drawable
+ final AppCompatEditText textView = new AppCompatEditText(mActivity);
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, R.drawable.white_square), null, null, null);
+
+ // When a tint is set programmatically
+ final int tint = 0xffa4c639;
+ final ColorStateList tintList = ColorStateList.valueOf(tint);
+ TextViewCompat.setCompoundDrawableTintList(textView, tintList);
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatEditText compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(tintList, TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @UiThreadTest
+ @Test
+ public void testSetCompoundDrawablesTintMode() {
+ // Given an ACTV with a red compound drawable
+ final AppCompatEditText textView = new AppCompatEditText(mActivity);
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, R.drawable.red_square), null, null, null);
+
+ // When a semi-transparent blue tint is set programmatically with a mode of SRC_OVER
+ final int tint = 0x800000ff;
+ final PorterDuff.Mode mode = PorterDuff.Mode.SRC_OVER;
+ final ColorStateList tintList = ColorStateList.valueOf(tint);
+ TextViewCompat.setCompoundDrawableTintList(textView, tintList);
+ TextViewCompat.setCompoundDrawableTintMode(textView, mode);
+ final int expected = ColorUtils.compositeColors(tint, 0xffff0000);
+ final int tolerance = 2; // allow some tolerance for the blending
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatEditText compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ expected,
+ tolerance,
+ true);
+ // Then the TextViewCompat getter should return the tint mode
+ assertEquals(mode, TextViewCompat.getCompoundDrawableTintMode(textView));
+ }
+
+ @UiThreadTest
+ @Test
+ public void testCompoundDrawablesSetAfterTint() {
+ // Given an ACTV with a magenta tint
+ final AppCompatEditText textView = new AppCompatEditText(mActivity);
+ final int tint = 0xffff00ff;
+ TextViewCompat.setCompoundDrawableTintList(textView, ColorStateList.valueOf(tint));
+
+ // When a white compound drawable is set
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, R.drawable.white_square), null, null, null);
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatEditText compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ }
}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatMultiAutoCompleteTextViewActivity.java b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatMultiAutoCompleteTextViewActivity.java
new file mode 100644
index 0000000..f9975d9
--- /dev/null
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatMultiAutoCompleteTextViewActivity.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package androidx.appcompat.widget;
+
+import androidx.appcompat.test.R;
+import androidx.appcompat.testutils.BaseTestActivity;
+
+public class AppCompatMultiAutoCompleteTextViewActivity extends BaseTestActivity {
+ @Override
+ protected int getContentViewLayoutResId() {
+ return R.layout.appcompat_multiautocompletetextview_activity;
+ }
+}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatMultiAutoCompleteTextViewTest.java b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatMultiAutoCompleteTextViewTest.java
new file mode 100644
index 0000000..86cfcb1
--- /dev/null
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatMultiAutoCompleteTextViewTest.java
@@ -0,0 +1,286 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package androidx.appcompat.widget;
+
+import static androidx.appcompat.testutils.TestUtilsActions.setEnabled;
+import static androidx.test.espresso.Espresso.onView;
+import static androidx.test.espresso.action.ViewActions.scrollTo;
+import static androidx.test.espresso.matcher.ViewMatchers.withId;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import android.content.res.ColorStateList;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.view.ActionMode;
+import android.view.Menu;
+import android.view.MenuItem;
+
+import androidx.appcompat.content.res.AppCompatResources;
+import androidx.appcompat.testutils.TestUtils;
+import androidx.core.content.res.ResourcesCompat;
+import androidx.core.graphics.ColorUtils;
+import androidx.core.widget.TextViewCompat;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SdkSuppress;
+
+import org.junit.Test;
+
+/**
+ * In addition to all tinting-related tests done by the base class, this class provides
+ * tests specific to {@link AppCompatMultiAutoCompleteTextView} class.
+ */
+@LargeTest
+public class AppCompatMultiAutoCompleteTextViewTest
+ extends AppCompatBaseViewTest<AppCompatMultiAutoCompleteTextViewActivity,
+ AppCompatMultiAutoCompleteTextView> {
+
+ public AppCompatMultiAutoCompleteTextViewTest() {
+ super(AppCompatMultiAutoCompleteTextViewActivity.class);
+ }
+
+ @UiThreadTest
+ public void testSetCustomSelectionActionModeCallback() {
+ final AppCompatMultiAutoCompleteTextView view = new AppCompatMultiAutoCompleteTextView(
+ mActivity);
+ final ActionMode.Callback callback = new ActionMode.Callback() {
+ @Override
+ public boolean onCreateActionMode(ActionMode mode, Menu menu) {
+ return false;
+ }
+
+ @Override
+ public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
+ return false;
+ }
+
+ @Override
+ public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
+ return false;
+ }
+
+ @Override
+ public void onDestroyActionMode(ActionMode mode) {
+ }
+ };
+
+ // Default value is documented as null.
+ assertNull(view.getCustomSelectionActionModeCallback());
+
+ // Setter and getter should be symmetric.
+ view.setCustomSelectionActionModeCallback(callback);
+ assertEquals(callback, view.getCustomSelectionActionModeCallback());
+
+ // Argument is nullable.
+ view.setCustomSelectionActionModeCallback(null);
+ assertNull(view.getCustomSelectionActionModeCallback());
+ }
+
+ @Test
+ public void testCompoundDrawablesTint() {
+ // Given an ACTV with a white drawableLeftCompat set and a #f0f drawableTint
+ final AppCompatMultiAutoCompleteTextView textView = mActivity.findViewById(
+ androidx.appcompat.test.R.id.text_view_compound_drawable_tint);
+ final int tint = 0xffff00ff;
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatMultiAutoCompleteTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(ColorStateList.valueOf(tint),
+ TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @SdkSuppress(minSdkVersion = 17)
+ @Test
+ public void testCompoundDrawableRelativeTint() {
+ // Given an ACTV with a white drawableStartCompat set and a #f0f drawableTint
+ final AppCompatMultiAutoCompleteTextView textView = mActivity.findViewById(
+ androidx.appcompat.test.R.id.text_view_compound_drawable_relative_tint);
+ final int tint = 0xffff00ff;
+ // Then the drawable should be tinted
+ final Drawable drawable = TextViewCompat.getCompoundDrawablesRelative(textView)[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatMultiAutoCompleteTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(ColorStateList.valueOf(tint),
+ TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @Test
+ public void testCompoundDrawablesTintList() {
+ // Given an ACTV with a white drawableLeftCompat and a ColorStateList drawableTint set
+ final AppCompatMultiAutoCompleteTextView textView = mActivity.findViewById(
+ androidx.appcompat.test.R.id.text_view_compound_drawable_tint_list);
+ final int defaultTint = ResourcesCompat.getColor(mResources,
+ androidx.appcompat.test.R.color.lilac_default, null);
+ final int disabledTint = ResourcesCompat.getColor(mResources,
+ androidx.appcompat.test.R.color.lilac_disabled, null);
+
+ // Then the initial drawable tint is applied
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatMultiAutoCompleteTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ defaultTint,
+ 0,
+ true);
+
+ // When the view is disabled
+ onView(withId(textView.getId())).perform(scrollTo(), setEnabled(false));
+ // Then the appropriate drawable tint is applied
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatMultiAutoCompleteTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ disabledTint,
+ 0,
+ true);
+ }
+
+ @Test
+ public void testCompoundDrawablesTintMode() {
+ // Given an ACTV with a red drawableLeft, a semi-transparent blue drawableTint
+ // & drawableTintMode of src_over
+ final AppCompatMultiAutoCompleteTextView textView = mActivity.findViewById(
+ androidx.appcompat.test.R.id.text_view_compound_drawable_tint_mode);
+ final int expected = ColorUtils.compositeColors(0x800000ff, 0xffff0000);
+ final int tolerance = 2; // allow some tolerance for the blending
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatMultiAutoCompleteTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ expected,
+ tolerance,
+ true);
+ // Then the TextViewCompat getter returns the mode
+ assertEquals(PorterDuff.Mode.SRC_OVER,
+ TextViewCompat.getCompoundDrawableTintMode(textView));
+ }
+
+ @UiThreadTest
+ @Test
+ public void testSetCompoundDrawablesTintList() {
+ // Given an ACTV with a compound drawable
+ final AppCompatMultiAutoCompleteTextView textView = new AppCompatMultiAutoCompleteTextView(
+ mActivity);
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, androidx.appcompat.test.R.drawable.white_square), null, null, null);
+
+ // When a tint is set programmatically
+ final int tint = 0xffa4c639;
+ final ColorStateList tintList = ColorStateList.valueOf(tint);
+ TextViewCompat.setCompoundDrawableTintList(textView, tintList);
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatMultiAutoCompleteTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(tintList, TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @UiThreadTest
+ @Test
+ public void testSetCompoundDrawablesTintMode() {
+ // Given an ACTV with a red compound drawable
+ final AppCompatMultiAutoCompleteTextView textView = new AppCompatMultiAutoCompleteTextView(
+ mActivity);
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, androidx.appcompat.test.R.drawable.red_square), null, null, null);
+
+ // When a semi-transparent blue tint is set programmatically with a mode of SRC_OVER
+ final int tint = 0x800000ff;
+ final PorterDuff.Mode mode = PorterDuff.Mode.SRC_OVER;
+ final ColorStateList tintList = ColorStateList.valueOf(tint);
+ TextViewCompat.setCompoundDrawableTintList(textView, tintList);
+ TextViewCompat.setCompoundDrawableTintMode(textView, mode);
+ final int expected = ColorUtils.compositeColors(tint, 0xffff0000);
+ final int tolerance = 2; // allow some tolerance for the blending
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatMultiAutoCompleteTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ expected,
+ tolerance,
+ true);
+ // Then the TextViewCompat getter should return the tint mode
+ assertEquals(mode, TextViewCompat.getCompoundDrawableTintMode(textView));
+ }
+
+ @UiThreadTest
+ @Test
+ public void testCompoundDrawablesSetAfterTint() {
+ // Given an ACTV with a magenta tint
+ final AppCompatMultiAutoCompleteTextView textView = new AppCompatMultiAutoCompleteTextView(
+ mActivity);
+ final int tint = 0xffff00ff;
+ TextViewCompat.setCompoundDrawableTintList(textView, ColorStateList.valueOf(tint));
+
+ // When a white compound drawable is set
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, androidx.appcompat.test.R.drawable.white_square), null, null, null);
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatMultiAutoCompleteTextView compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ }
+}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatRadioButtonTest.java b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatRadioButtonTest.java
index fbbd6b2..2778c30 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatRadioButtonTest.java
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatRadioButtonTest.java
@@ -15,19 +15,29 @@
*/
package androidx.appcompat.widget;
+import static androidx.appcompat.testutils.TestUtilsActions.setEnabled;
+import static androidx.test.espresso.Espresso.onView;
+import static androidx.test.espresso.matcher.ViewMatchers.withId;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import android.content.res.ColorStateList;
+import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.AnimatedStateListDrawable;
import android.graphics.drawable.Drawable;
+import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat;
import androidx.appcompat.test.R;
+import androidx.appcompat.testutils.TestUtils;
import androidx.core.content.res.ResourcesCompat;
+import androidx.core.graphics.ColorUtils;
import androidx.core.widget.CompoundButtonCompat;
+import androidx.core.widget.TextViewCompat;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
import androidx.test.filters.SdkSuppress;
@@ -87,4 +97,190 @@
assertNotNull(button);
assertFalse(isAnimated);
}
+
+ @Test
+ public void testCompoundDrawablesTint() {
+ // Given an ACTV with a white drawableLeftCompat set and a #f0f drawableTint
+ final AppCompatRadioButton textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_tint);
+ final int tint = 0xffff00ff;
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatRadioButton compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(ColorStateList.valueOf(tint),
+ TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @SdkSuppress(minSdkVersion = 17)
+ @Test
+ public void testCompoundDrawableRelativeTint() {
+ // Given an ACTV with a white drawableStartCompat set and a #f0f drawableTint
+ final AppCompatRadioButton textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_relative_tint);
+ final int tint = 0xffff00ff;
+ // Then the drawable should be tinted
+ final Drawable drawable = TextViewCompat.getCompoundDrawablesRelative(textView)[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatRadioButton compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(ColorStateList.valueOf(tint),
+ TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @Test
+ public void testCompoundDrawablesTintList() {
+ // Given an ACTV with a white drawableLeftCompat and a ColorStateList drawableTint set
+ final AppCompatRadioButton textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_tint_list);
+ final int defaultTint = ResourcesCompat.getColor(mResources, R.color.lilac_default, null);
+ final int disabledTint = ResourcesCompat.getColor(mResources, R.color.lilac_disabled, null);
+
+ // Then the initial drawable tint is applied
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatRadioButton compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ defaultTint,
+ 0,
+ true);
+
+ // When the view is disabled
+ onView(withId(textView.getId())).perform(setEnabled(false));
+ // Then the appropriate drawable tint is applied
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatRadioButton compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ disabledTint,
+ 0,
+ true);
+ }
+
+ @Test
+ public void testCompoundDrawablesTintMode() {
+ // Given an ACTV with a red drawableLeft, a semi-transparent blue drawableTint
+ // & drawableTintMode of src_over
+ final AppCompatRadioButton textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_tint_mode);
+ final int expected = ColorUtils.compositeColors(0x800000ff, 0xffff0000);
+ final int tolerance = 2; // allow some tolerance for the blending
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatRadioButton compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ expected,
+ tolerance,
+ true);
+ // Then the TextViewCompat getter returns the mode
+ assertEquals(PorterDuff.Mode.SRC_OVER,
+ TextViewCompat.getCompoundDrawableTintMode(textView));
+ }
+
+ @Test
+ public void testSetCompoundDrawablesTintList() {
+ // Given an ACTV with a compound drawable
+ final AppCompatRadioButton textView = new AppCompatRadioButton(mActivity);
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, R.drawable.white_square), null, null, null);
+
+ // When a tint is set programmatically
+ final int tint = 0xffa4c639;
+ final ColorStateList tintList = ColorStateList.valueOf(tint);
+ TextViewCompat.setCompoundDrawableTintList(textView, tintList);
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatRadioButton compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(tintList, TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @Test
+ public void testSetCompoundDrawablesTintMode() {
+ // Given an ACTV with a red compound drawable
+ final AppCompatRadioButton textView = new AppCompatRadioButton(mActivity);
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, R.drawable.red_square), null, null, null);
+
+ // When a semi-transparent blue tint is set programmatically with a mode of SRC_OVER
+ final int tint = 0x800000ff;
+ final PorterDuff.Mode mode = PorterDuff.Mode.SRC_OVER;
+ final ColorStateList tintList = ColorStateList.valueOf(tint);
+ TextViewCompat.setCompoundDrawableTintList(textView, tintList);
+ TextViewCompat.setCompoundDrawableTintMode(textView, mode);
+ final int expected = ColorUtils.compositeColors(tint, 0xffff0000);
+ final int tolerance = 2; // allow some tolerance for the blending
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatRadioButton compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ expected,
+ tolerance,
+ true);
+ // Then the TextViewCompat getter should return the tint mode
+ assertEquals(mode, TextViewCompat.getCompoundDrawableTintMode(textView));
+ }
+
+
+ @Test
+ public void testCompoundDrawablesSetAfterTint() {
+ // Given an ACTV with a magenta tint
+ final AppCompatRadioButton textView = new AppCompatRadioButton(mActivity);
+ final int tint = 0xffff00ff;
+ TextViewCompat.setCompoundDrawableTintList(textView, ColorStateList.valueOf(tint));
+
+ // When a white compound drawable is set
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, R.drawable.white_square), null, null, null);
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatRadioButton compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ }
}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatToggleButtonTest.java b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatToggleButtonTest.java
index 0d1c92e..57a3567 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatToggleButtonTest.java
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatToggleButtonTest.java
@@ -16,14 +16,26 @@
package androidx.appcompat.widget;
+import static androidx.appcompat.testutils.TestUtilsActions.setEnabled;
+import static androidx.test.espresso.Espresso.onView;
+import static androidx.test.espresso.matcher.ViewMatchers.withId;
+
import static org.junit.Assert.assertEquals;
+import android.content.res.ColorStateList;
+import android.graphics.PorterDuff;
import android.graphics.Typeface;
+import android.graphics.drawable.Drawable;
+import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.test.R;
+import androidx.appcompat.testutils.TestUtils;
import androidx.core.content.res.ResourcesCompat;
+import androidx.core.graphics.ColorUtils;
+import androidx.core.widget.TextViewCompat;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.MediumTest;
+import androidx.test.filters.SdkSuppress;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -53,4 +65,190 @@
assertEquals(expected, toggleButton.getTypeface());
}
+
+ @Test
+ public void testCompoundDrawablesTint() {
+ // Given an ACTV with a white drawableLeftCompat set and a #f0f drawableTint
+ final AppCompatToggleButton textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_tint);
+ final int tint = 0xffff00ff;
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatToggleButton compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(ColorStateList.valueOf(tint),
+ TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @SdkSuppress(minSdkVersion = 17)
+ @Test
+ public void testCompoundDrawableRelativeTint() {
+ // Given an ACTV with a white drawableStartCompat set and a #f0f drawableTint
+ final AppCompatToggleButton textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_relative_tint);
+ final int tint = 0xffff00ff;
+ // Then the drawable should be tinted
+ final Drawable drawable = TextViewCompat.getCompoundDrawablesRelative(textView)[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatToggleButton compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(ColorStateList.valueOf(tint),
+ TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @Test
+ public void testCompoundDrawablesTintList() {
+ // Given an ACTV with a white drawableLeftCompat and a ColorStateList drawableTint set
+ final AppCompatToggleButton textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_tint_list);
+ final int defaultTint = ResourcesCompat.getColor(mResources, R.color.lilac_default, null);
+ final int disabledTint = ResourcesCompat.getColor(mResources, R.color.lilac_disabled, null);
+
+ // Then the initial drawable tint is applied
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatToggleButton compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ defaultTint,
+ 0,
+ true);
+
+ // When the view is disabled
+ onView(withId(textView.getId())).perform(setEnabled(false));
+ // Then the appropriate drawable tint is applied
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatToggleButton compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ disabledTint,
+ 0,
+ true);
+ }
+
+ @Test
+ public void testCompoundDrawablesTintMode() {
+ // Given an ACTV with a red drawableLeft, a semi-transparent blue drawableTint
+ // & drawableTintMode of src_over
+ final AppCompatToggleButton textView = mActivity.findViewById(
+ R.id.text_view_compound_drawable_tint_mode);
+ final int expected = ColorUtils.compositeColors(0x800000ff, 0xffff0000);
+ final int tolerance = 2; // allow some tolerance for the blending
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatToggleButton compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ expected,
+ tolerance,
+ true);
+ // Then the TextViewCompat getter returns the mode
+ assertEquals(PorterDuff.Mode.SRC_OVER,
+ TextViewCompat.getCompoundDrawableTintMode(textView));
+ }
+
+ @Test
+ public void testSetCompoundDrawablesTintList() {
+ // Given an ACTV with a compound drawable
+ final AppCompatToggleButton textView = new AppCompatToggleButton(mActivity);
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, R.drawable.white_square), null, null, null);
+
+ // When a tint is set programmatically
+ final int tint = 0xffa4c639;
+ final ColorStateList tintList = ColorStateList.valueOf(tint);
+ TextViewCompat.setCompoundDrawableTintList(textView, tintList);
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatToggleButton compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ // Then the TextViewCompat getter should return the tint
+ assertEquals(tintList, TextViewCompat.getCompoundDrawableTintList(textView));
+ }
+
+ @Test
+ public void testSetCompoundDrawablesTintMode() {
+ // Given an ACTV with a red compound drawable
+ final AppCompatToggleButton textView = new AppCompatToggleButton(mActivity);
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, R.drawable.red_square), null, null, null);
+
+ // When a semi-transparent blue tint is set programmatically with a mode of SRC_OVER
+ final int tint = 0x800000ff;
+ final PorterDuff.Mode mode = PorterDuff.Mode.SRC_OVER;
+ final ColorStateList tintList = ColorStateList.valueOf(tint);
+ TextViewCompat.setCompoundDrawableTintList(textView, tintList);
+ TextViewCompat.setCompoundDrawableTintMode(textView, mode);
+ final int expected = ColorUtils.compositeColors(tint, 0xffff0000);
+ final int tolerance = 2; // allow some tolerance for the blending
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatToggleButton compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ expected,
+ tolerance,
+ true);
+ // Then the TextViewCompat getter should return the tint mode
+ assertEquals(mode, TextViewCompat.getCompoundDrawableTintMode(textView));
+ }
+
+
+ @Test
+ public void testCompoundDrawablesSetAfterTint() {
+ // Given an ACTV with a magenta tint
+ final AppCompatToggleButton textView = new AppCompatToggleButton(mActivity);
+ final int tint = 0xffff00ff;
+ TextViewCompat.setCompoundDrawableTintList(textView, ColorStateList.valueOf(tint));
+
+ // When a white compound drawable is set
+ textView.setCompoundDrawables(AppCompatResources.getDrawable(
+ mActivity, R.drawable.white_square), null, null, null);
+
+ // Then the drawable should be tinted
+ final Drawable drawable = textView.getCompoundDrawables()[0];
+ TestUtils.assertAllPixelsOfColor(
+ "Tint not applied to AppCompatToggleButton compound drawable",
+ drawable,
+ drawable.getIntrinsicWidth(),
+ drawable.getIntrinsicHeight(),
+ true,
+ tint,
+ 0,
+ true);
+ }
}
diff --git a/appcompat/appcompat/src/androidTest/res/layout/appcompat_autocompletetextview_activity.xml b/appcompat/appcompat/src/androidTest/res/layout/appcompat_autocompletetextview_activity.xml
index 7e8ed0a..acdc38b 100644
--- a/appcompat/appcompat/src/androidTest/res/layout/appcompat_autocompletetextview_activity.xml
+++ b/appcompat/appcompat/src/androidTest/res/layout/appcompat_autocompletetextview_activity.xml
@@ -107,6 +107,35 @@
android:enabled="false"
android:text="@string/text_link_disabled"/>
+ <androidx.appcompat.widget.AppCompatAutoCompleteTextView
+ android:id="@+id/text_view_compound_drawable_tint"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/white_square"
+ app:drawableTint="#f0f"/>
+
+ <androidx.appcompat.widget.AppCompatAutoCompleteTextView
+ android:id="@+id/text_view_compound_drawable_relative_tint"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableStartCompat="@drawable/white_square"
+ app:drawableTint="#f0f"/>
+
+ <androidx.appcompat.widget.AppCompatAutoCompleteTextView
+ android:id="@+id/text_view_compound_drawable_tint_list"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/white_square"
+ app:drawableTint="@color/color_state_list_lilac"/>
+
+ <androidx.appcompat.widget.AppCompatAutoCompleteTextView
+ android:id="@+id/text_view_compound_drawable_tint_mode"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/red_square"
+ app:drawableTint="#800000ff"
+ app:drawableTintMode="src_over"/>
+
</LinearLayout>
</ScrollView>
diff --git a/appcompat/appcompat/src/androidTest/res/layout/appcompat_checkbox_activity.xml b/appcompat/appcompat/src/androidTest/res/layout/appcompat_checkbox_activity.xml
index 7fc5656..44de39a 100644
--- a/appcompat/appcompat/src/androidTest/res/layout/appcompat_checkbox_activity.xml
+++ b/appcompat/appcompat/src/androidTest/res/layout/appcompat_checkbox_activity.xml
@@ -70,4 +70,34 @@
android:text="@string/sample_text2"
android:background="@drawable/test_background_green" />
+ <androidx.appcompat.widget.AppCompatCheckBox
+ android:id="@+id/text_view_compound_drawable_tint"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/white_square"
+ app:drawableTint="#f0f"/>
+
+ <androidx.appcompat.widget.AppCompatCheckBox
+ android:id="@+id/text_view_compound_drawable_relative_tint"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableStartCompat="@drawable/white_square"
+ app:drawableTint="#f0f"/>
+
+ <androidx.appcompat.widget.AppCompatCheckBox
+ android:id="@+id/text_view_compound_drawable_tint_list"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/white_square"
+ app:drawableTint="@color/color_state_list_lilac"/>
+
+ <androidx.appcompat.widget.AppCompatCheckBox
+ android:id="@+id/text_view_compound_drawable_tint_mode"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/red_square"
+ app:drawableTint="#800000ff"
+ app:drawableTintMode="src_over"/>
+
+
</LinearLayout>
diff --git a/appcompat/appcompat/src/androidTest/res/layout/appcompat_checkedtextview_activity.xml b/appcompat/appcompat/src/androidTest/res/layout/appcompat_checkedtextview_activity.xml
index 02ff5e5..311acbb 100644
--- a/appcompat/appcompat/src/androidTest/res/layout/appcompat_checkedtextview_activity.xml
+++ b/appcompat/appcompat/src/androidTest/res/layout/appcompat_checkedtextview_activity.xml
@@ -83,4 +83,33 @@
android:text="@string/sample_text2"
android:background="@drawable/test_background_green" />
+ <androidx.appcompat.widget.AppCompatCheckedTextView
+ android:id="@+id/text_view_compound_drawable_tint"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/white_square"
+ app:drawableTint="#f0f"/>
+
+ <androidx.appcompat.widget.AppCompatCheckedTextView
+ android:id="@+id/text_view_compound_drawable_relative_tint"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableStartCompat="@drawable/white_square"
+ app:drawableTint="#f0f"/>
+
+ <androidx.appcompat.widget.AppCompatCheckedTextView
+ android:id="@+id/text_view_compound_drawable_tint_list"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/white_square"
+ app:drawableTint="@color/color_state_list_lilac"/>
+
+ <androidx.appcompat.widget.AppCompatCheckedTextView
+ android:id="@+id/text_view_compound_drawable_tint_mode"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/red_square"
+ app:drawableTint="#800000ff"
+ app:drawableTintMode="src_over"/>
+
</LinearLayout>
diff --git a/appcompat/appcompat/src/androidTest/res/layout/appcompat_edittext_activity.xml b/appcompat/appcompat/src/androidTest/res/layout/appcompat_edittext_activity.xml
index edcb6c8..fcfa2b2 100644
--- a/appcompat/appcompat/src/androidTest/res/layout/appcompat_edittext_activity.xml
+++ b/appcompat/appcompat/src/androidTest/res/layout/appcompat_edittext_activity.xml
@@ -51,6 +51,35 @@
android:enabled="false"
android:hint="@string/text_hint_disabled"/>
+ <androidx.appcompat.widget.AppCompatEditText
+ android:id="@+id/text_view_compound_drawable_tint"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/white_square"
+ app:drawableTint="#f0f"/>
+
+ <androidx.appcompat.widget.AppCompatEditText
+ android:id="@+id/text_view_compound_drawable_relative_tint"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableStartCompat="@drawable/white_square"
+ app:drawableTint="#f0f"/>
+
+ <androidx.appcompat.widget.AppCompatEditText
+ android:id="@+id/text_view_compound_drawable_tint_list"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/white_square"
+ app:drawableTint="@color/color_state_list_lilac"/>
+
+ <androidx.appcompat.widget.AppCompatEditText
+ android:id="@+id/text_view_compound_drawable_tint_mode"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/red_square"
+ app:drawableTint="#800000ff"
+ app:drawableTintMode="src_over"/>
+
</LinearLayout>
</ScrollView>
diff --git a/appcompat/appcompat/src/androidTest/res/layout/appcompat_multiautocompletetextview_activity.xml b/appcompat/appcompat/src/androidTest/res/layout/appcompat_multiautocompletetextview_activity.xml
new file mode 100644
index 0000000..cdcb000
--- /dev/null
+++ b/appcompat/appcompat/src/androidTest/res/layout/appcompat_multiautocompletetextview_activity.xml
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<ScrollView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView
+ android:id="@+id/view_tinted_no_background"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/sample_text1"
+ android:background="@null"
+ app:backgroundTint="@color/color_state_list_lilac"
+ app:backgroundTintMode="src_in"/>
+
+ <androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView
+ android:id="@+id/view_tinted_background"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/sample_text2"
+ android:background="@drawable/test_drawable"
+ app:backgroundTint="@color/color_state_list_lilac"
+ app:backgroundTintMode="src_in"/>
+
+ <androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView
+ android:id="@+id/view_untinted_no_background"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@null"
+ android:text="@string/sample_text2"/>
+
+ <androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView
+ android:id="@+id/view_untinted_background"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/sample_text2"
+ android:background="@drawable/test_background_green"/>
+
+ <androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView
+ android:id="@+id/view_untinted_deferred"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/sample_text2"
+ android:background="@drawable/black_rect"/>
+
+ <androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView
+ android:id="@+id/view_text_color_hex"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/sample_text2"
+ android:textColor="#FF0000"/>
+
+ <androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView
+ android:id="@+id/view_text_color_csl"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/sample_text2"
+ android:textColor="@color/color_state_list_ocean"/>
+
+ <androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView
+ android:id="@+id/view_text_color_primary"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/sample_text1"
+ android:textColor="?android:attr/textColorPrimary"/>
+
+ <androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView
+ android:id="@+id/view_text_color_secondary"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/sample_text2"
+ android:textColor="?android:attr/textColorSecondary"/>
+
+ <androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView
+ android:id="@+id/view_text_link_enabled"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/text_link_enabled"
+ android:textColor="?android:attr/textColorSecondary"/>
+
+ <androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView
+ android:id="@+id/view_text_link_disabled"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:enabled="false"
+ android:text="@string/text_link_disabled"/>
+
+ <androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView
+ android:id="@+id/text_view_compound_drawable_tint"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/white_square"
+ app:drawableTint="#f0f"/>
+
+ <androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView
+ android:id="@+id/text_view_compound_drawable_relative_tint"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableStartCompat="@drawable/white_square"
+ app:drawableTint="#f0f"/>
+
+ <androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView
+ android:id="@+id/text_view_compound_drawable_tint_list"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/white_square"
+ app:drawableTint="@color/color_state_list_lilac"/>
+
+ <androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView
+ android:id="@+id/text_view_compound_drawable_tint_mode"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/red_square"
+ app:drawableTint="#800000ff"
+ app:drawableTintMode="src_over"/>
+
+ </LinearLayout>
+
+</ScrollView>
diff --git a/appcompat/appcompat/src/androidTest/res/layout/appcompat_radiobutton_activity.xml b/appcompat/appcompat/src/androidTest/res/layout/appcompat_radiobutton_activity.xml
index 12f0f67..e207644 100644
--- a/appcompat/appcompat/src/androidTest/res/layout/appcompat_radiobutton_activity.xml
+++ b/appcompat/appcompat/src/androidTest/res/layout/appcompat_radiobutton_activity.xml
@@ -70,4 +70,33 @@
android:text="@string/sample_text2"
android:background="@drawable/test_background_green" />
+ <androidx.appcompat.widget.AppCompatRadioButton
+ android:id="@+id/text_view_compound_drawable_tint"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/white_square"
+ app:drawableTint="#f0f"/>
+
+ <androidx.appcompat.widget.AppCompatRadioButton
+ android:id="@+id/text_view_compound_drawable_relative_tint"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableStartCompat="@drawable/white_square"
+ app:drawableTint="#f0f"/>
+
+ <androidx.appcompat.widget.AppCompatRadioButton
+ android:id="@+id/text_view_compound_drawable_tint_list"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/white_square"
+ app:drawableTint="@color/color_state_list_lilac"/>
+
+ <androidx.appcompat.widget.AppCompatRadioButton
+ android:id="@+id/text_view_compound_drawable_tint_mode"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/red_square"
+ app:drawableTint="#800000ff"
+ app:drawableTintMode="src_over"/>
+
</LinearLayout>
diff --git a/appcompat/appcompat/src/androidTest/res/layout/appcompat_togglebutton_activity.xml b/appcompat/appcompat/src/androidTest/res/layout/appcompat_togglebutton_activity.xml
index b5f6de6..4b4d461 100644
--- a/appcompat/appcompat/src/androidTest/res/layout/appcompat_togglebutton_activity.xml
+++ b/appcompat/appcompat/src/androidTest/res/layout/appcompat_togglebutton_activity.xml
@@ -69,4 +69,33 @@
android:text="@string/sample_text1"
app:fontFamily="@font/samplefont" />
+ <androidx.appcompat.widget.AppCompatToggleButton
+ android:id="@+id/text_view_compound_drawable_tint"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/white_square"
+ app:drawableTint="#f0f"/>
+
+ <androidx.appcompat.widget.AppCompatToggleButton
+ android:id="@+id/text_view_compound_drawable_relative_tint"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableStartCompat="@drawable/white_square"
+ app:drawableTint="#f0f"/>
+
+ <androidx.appcompat.widget.AppCompatToggleButton
+ android:id="@+id/text_view_compound_drawable_tint_list"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/white_square"
+ app:drawableTint="@color/color_state_list_lilac"/>
+
+ <androidx.appcompat.widget.AppCompatToggleButton
+ android:id="@+id/text_view_compound_drawable_tint_mode"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:drawableLeftCompat="@drawable/red_square"
+ app:drawableTint="#800000ff"
+ app:drawableTintMode="src_over"/>
+
</LinearLayout>
\ No newline at end of file
diff --git a/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatAutoCompleteTextView.java b/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatAutoCompleteTextView.java
index 7049341..7c5d7ed 100644
--- a/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatAutoCompleteTextView.java
+++ b/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatAutoCompleteTextView.java
@@ -22,6 +22,7 @@
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.text.method.KeyListener;
import android.util.AttributeSet;
import android.view.ActionMode;
@@ -33,11 +34,13 @@
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.view.TintableBackgroundView;
import androidx.core.widget.TextViewCompat;
+import androidx.core.widget.TintableCompoundDrawablesView;
import androidx.resourceinspection.annotation.AppCompatShadowedAttributes;
/**
@@ -57,7 +60,7 @@
*/
@AppCompatShadowedAttributes
public class AppCompatAutoCompleteTextView extends AutoCompleteTextView implements
- TintableBackgroundView, EmojiCompatConfigurationView {
+ TintableBackgroundView, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
private static final int[] TINT_ATTRS = {
android.R.attr.popupBackground
@@ -278,4 +281,104 @@
public boolean isEmojiCompatEnabled() {
return mAppCompatEmojiEditTextHelper.isEnabled();
}
+
+ @Override
+ public void setCompoundDrawables(@Nullable Drawable left, @Nullable Drawable top,
+ @Nullable Drawable right, @Nullable Drawable bottom) {
+ super.setCompoundDrawables(left, top, right, bottom);
+ if (mTextHelper != null) {
+ mTextHelper.onSetCompoundDrawables();
+ }
+ }
+
+ @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
+ @Override
+ public void setCompoundDrawablesRelative(@Nullable Drawable start, @Nullable Drawable top,
+ @Nullable Drawable end, @Nullable Drawable bottom) {
+ super.setCompoundDrawablesRelative(start, top, end, bottom);
+ if (mTextHelper != null) {
+ mTextHelper.onSetCompoundDrawables();
+ }
+ }
+
+ /**
+ * This should be accessed via
+ * {@link androidx.core.widget.TextViewCompat#getCompoundDrawableTintList(TextView)}
+ *
+ * @return the tint applied to the compound drawables
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTint
+ * @see #setSupportCompoundDrawablesTintList(ColorStateList)
+ *
+ * @hide
+ */
+ @Nullable
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public ColorStateList getSupportCompoundDrawablesTintList() {
+ return mTextHelper.getCompoundDrawableTintList();
+ }
+
+ /**
+ * This should be accessed via {@link
+ * androidx.core.widget.TextViewCompat#setCompoundDrawableTintList(TextView, ColorStateList)}
+ *
+ * Applies a tint to the compound drawables. Does not modify the current tint mode, which is
+ * {@link PorterDuff.Mode#SRC_IN} by default.
+ * <p>
+ * Subsequent calls to {@link #setCompoundDrawables(Drawable, Drawable, Drawable, Drawable)} and
+ * related methods will automatically mutate the drawables and apply the specified tint and tint
+ * mode using {@link Drawable#setTintList(ColorStateList)}.
+ *
+ * @param tintList the tint to apply, may be {@code null} to clear tint
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTint
+ * @see #getSupportCompoundDrawablesTintList()
+ *
+ * @hide
+ */
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public void setSupportCompoundDrawablesTintList(@Nullable ColorStateList tintList) {
+ mTextHelper.setCompoundDrawableTintList(tintList);
+ mTextHelper.applyCompoundDrawablesTints();
+ }
+
+ /**
+ * This should be accessed via
+ * {@link androidx.core.widget.TextViewCompat#getCompoundDrawableTintMode(TextView)}
+ *
+ * Returns the blending mode used to apply the tint to the compound drawables, if specified.
+ *
+ * @return the blending mode used to apply the tint to the compound drawables
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTintMode
+ * @see #setSupportCompoundDrawablesTintMode(PorterDuff.Mode)
+ *
+ * @hide
+ */
+ @Nullable
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
+ return mTextHelper.getCompoundDrawableTintMode();
+ }
+
+ /**
+ * This should be accessed via {@link
+ * androidx.core.widget.TextViewCompat#setCompoundDrawableTintMode(TextView, PorterDuff.Mode)}
+ *
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setSupportCompoundDrawablesTintList(ColorStateList)} to the compound drawables. The
+ * default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param tintMode the blending mode used to apply the tint, may be {@code null} to clear tint
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTintMode
+ * @see #setSupportCompoundDrawablesTintList(ColorStateList)
+ *
+ * @hide
+ */
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public void setSupportCompoundDrawablesTintMode(@Nullable PorterDuff.Mode tintMode) {
+ mTextHelper.setCompoundDrawableTintMode(tintMode);
+ mTextHelper.applyCompoundDrawablesTints();
+ }
}
diff --git a/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatCheckBox.java b/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatCheckBox.java
index 703414c..65c59a8 100644
--- a/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatCheckBox.java
+++ b/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatCheckBox.java
@@ -22,20 +22,24 @@
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.text.InputFilter;
import android.util.AttributeSet;
import android.view.View;
import android.widget.CheckBox;
+import android.widget.TextView;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.view.TintableBackgroundView;
import androidx.core.view.ViewCompat;
import androidx.core.widget.TintableCompoundButton;
+import androidx.core.widget.TintableCompoundDrawablesView;
import androidx.resourceinspection.annotation.AppCompatShadowedAttributes;
/**
@@ -55,7 +59,7 @@
*/
@AppCompatShadowedAttributes
public class AppCompatCheckBox extends CheckBox implements TintableCompoundButton,
- TintableBackgroundView, EmojiCompatConfigurationView {
+ TintableBackgroundView, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
private final AppCompatCompoundButtonHelper mCompoundButtonHelper;
private final AppCompatBackgroundHelper mBackgroundTintHelper;
@@ -273,4 +277,104 @@
public boolean isEmojiCompatEnabled() {
return getEmojiTextViewHelper().isEnabled();
}
+
+ @Override
+ public void setCompoundDrawables(@Nullable Drawable left, @Nullable Drawable top,
+ @Nullable Drawable right, @Nullable Drawable bottom) {
+ super.setCompoundDrawables(left, top, right, bottom);
+ if (mTextHelper != null) {
+ mTextHelper.onSetCompoundDrawables();
+ }
+ }
+
+ @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
+ @Override
+ public void setCompoundDrawablesRelative(@Nullable Drawable start, @Nullable Drawable top,
+ @Nullable Drawable end, @Nullable Drawable bottom) {
+ super.setCompoundDrawablesRelative(start, top, end, bottom);
+ if (mTextHelper != null) {
+ mTextHelper.onSetCompoundDrawables();
+ }
+ }
+
+ /**
+ * This should be accessed via
+ * {@link androidx.core.widget.TextViewCompat#getCompoundDrawableTintList(TextView)}
+ *
+ * @return the tint applied to the compound drawables
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTint
+ * @see #setSupportCompoundDrawablesTintList(ColorStateList)
+ *
+ * @hide
+ */
+ @Nullable
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public ColorStateList getSupportCompoundDrawablesTintList() {
+ return mTextHelper.getCompoundDrawableTintList();
+ }
+
+ /**
+ * This should be accessed via {@link
+ * androidx.core.widget.TextViewCompat#setCompoundDrawableTintList(TextView, ColorStateList)}
+ *
+ * Applies a tint to the compound drawables. Does not modify the current tint mode, which is
+ * {@link PorterDuff.Mode#SRC_IN} by default.
+ * <p>
+ * Subsequent calls to {@link #setCompoundDrawables(Drawable, Drawable, Drawable, Drawable)} and
+ * related methods will automatically mutate the drawables and apply the specified tint and tint
+ * mode using {@link Drawable#setTintList(ColorStateList)}.
+ *
+ * @param tintList the tint to apply, may be {@code null} to clear tint
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTint
+ * @see #getSupportCompoundDrawablesTintList()
+ *
+ * @hide
+ */
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public void setSupportCompoundDrawablesTintList(@Nullable ColorStateList tintList) {
+ mTextHelper.setCompoundDrawableTintList(tintList);
+ mTextHelper.applyCompoundDrawablesTints();
+ }
+
+ /**
+ * This should be accessed via
+ * {@link androidx.core.widget.TextViewCompat#getCompoundDrawableTintMode(TextView)}
+ *
+ * Returns the blending mode used to apply the tint to the compound drawables, if specified.
+ *
+ * @return the blending mode used to apply the tint to the compound drawables
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTintMode
+ * @see #setSupportCompoundDrawablesTintMode(PorterDuff.Mode)
+ *
+ * @hide
+ */
+ @Nullable
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
+ return mTextHelper.getCompoundDrawableTintMode();
+ }
+
+ /**
+ * This should be accessed via {@link
+ * androidx.core.widget.TextViewCompat#setCompoundDrawableTintMode(TextView, PorterDuff.Mode)}
+ *
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setSupportCompoundDrawablesTintList(ColorStateList)} to the compound drawables. The
+ * default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param tintMode the blending mode used to apply the tint, may be {@code null} to clear tint
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTintMode
+ * @see #setSupportCompoundDrawablesTintList(ColorStateList)
+ *
+ * @hide
+ */
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public void setSupportCompoundDrawablesTintMode(@Nullable PorterDuff.Mode tintMode) {
+ mTextHelper.setCompoundDrawableTintMode(tintMode);
+ mTextHelper.applyCompoundDrawablesTints();
+ }
}
diff --git a/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatCheckedTextView.java b/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatCheckedTextView.java
index fe03def3..a41e07a 100644
--- a/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatCheckedTextView.java
+++ b/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatCheckedTextView.java
@@ -33,6 +33,7 @@
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import androidx.appcompat.content.res.AppCompatResources;
@@ -40,6 +41,7 @@
import androidx.core.view.ViewCompat;
import androidx.core.widget.TextViewCompat;
import androidx.core.widget.TintableCheckedTextView;
+import androidx.core.widget.TintableCompoundDrawablesView;
import androidx.resourceinspection.annotation.AppCompatShadowedAttributes;
/**
@@ -64,7 +66,7 @@
*/
@AppCompatShadowedAttributes
public class AppCompatCheckedTextView extends CheckedTextView implements TintableCheckedTextView,
- TintableBackgroundView, EmojiCompatConfigurationView {
+ TintableBackgroundView, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
private final AppCompatCheckedTextViewHelper mCheckedHelper;
private final AppCompatBackgroundHelper mBackgroundTintHelper;
@@ -313,4 +315,104 @@
public boolean isEmojiCompatEnabled() {
return getEmojiTextViewHelper().isEnabled();
}
+
+ @Override
+ public void setCompoundDrawables(@Nullable Drawable left, @Nullable Drawable top,
+ @Nullable Drawable right, @Nullable Drawable bottom) {
+ super.setCompoundDrawables(left, top, right, bottom);
+ if (mTextHelper != null) {
+ mTextHelper.onSetCompoundDrawables();
+ }
+ }
+
+ @RequiresApi(17)
+ @Override
+ public void setCompoundDrawablesRelative(@Nullable Drawable start, @Nullable Drawable top,
+ @Nullable Drawable end, @Nullable Drawable bottom) {
+ super.setCompoundDrawablesRelative(start, top, end, bottom);
+ if (mTextHelper != null) {
+ mTextHelper.onSetCompoundDrawables();
+ }
+ }
+
+ /**
+ * This should be accessed via
+ * {@link androidx.core.widget.TextViewCompat#getCompoundDrawableTintList(TextView)}
+ *
+ * @return the tint applied to the compound drawables
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTint
+ * @see #setSupportCompoundDrawablesTintList(ColorStateList)
+ *
+ * @hide
+ */
+ @Nullable
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public ColorStateList getSupportCompoundDrawablesTintList() {
+ return mTextHelper.getCompoundDrawableTintList();
+ }
+
+ /**
+ * This should be accessed via {@link
+ * androidx.core.widget.TextViewCompat#setCompoundDrawableTintList(TextView, ColorStateList)}
+ *
+ * Applies a tint to the compound drawables. Does not modify the current tint mode, which is
+ * {@link PorterDuff.Mode#SRC_IN} by default.
+ * <p>
+ * Subsequent calls to {@link #setCompoundDrawables(Drawable, Drawable, Drawable, Drawable)} and
+ * related methods will automatically mutate the drawables and apply the specified tint and tint
+ * mode using {@link Drawable#setTintList(ColorStateList)}.
+ *
+ * @param tintList the tint to apply, may be {@code null} to clear tint
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTint
+ * @see #getSupportCompoundDrawablesTintList()
+ *
+ * @hide
+ */
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public void setSupportCompoundDrawablesTintList(@Nullable ColorStateList tintList) {
+ mTextHelper.setCompoundDrawableTintList(tintList);
+ mTextHelper.applyCompoundDrawablesTints();
+ }
+
+ /**
+ * This should be accessed via
+ * {@link androidx.core.widget.TextViewCompat#getCompoundDrawableTintMode(TextView)}
+ *
+ * Returns the blending mode used to apply the tint to the compound drawables, if specified.
+ *
+ * @return the blending mode used to apply the tint to the compound drawables
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTintMode
+ * @see #setSupportCompoundDrawablesTintMode(PorterDuff.Mode)
+ *
+ * @hide
+ */
+ @Nullable
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
+ return mTextHelper.getCompoundDrawableTintMode();
+ }
+
+ /**
+ * This should be accessed via {@link
+ * androidx.core.widget.TextViewCompat#setCompoundDrawableTintMode(TextView, PorterDuff.Mode)}
+ *
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setSupportCompoundDrawablesTintList(ColorStateList)} to the compound drawables. The
+ * default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param tintMode the blending mode used to apply the tint, may be {@code null} to clear tint
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTintMode
+ * @see #setSupportCompoundDrawablesTintList(ColorStateList)
+ *
+ * @hide
+ */
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public void setSupportCompoundDrawablesTintMode(@Nullable PorterDuff.Mode tintMode) {
+ mTextHelper.setCompoundDrawableTintMode(tintMode);
+ mTextHelper.applyCompoundDrawablesTints();
+ }
}
diff --git a/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatEditText.java b/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatEditText.java
index 1c98556..00742b8 100644
--- a/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatEditText.java
+++ b/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatEditText.java
@@ -51,6 +51,7 @@
import androidx.core.view.inputmethod.InputConnectionCompat;
import androidx.core.widget.TextViewCompat;
import androidx.core.widget.TextViewOnReceiveContentListener;
+import androidx.core.widget.TintableCompoundDrawablesView;
import androidx.resourceinspection.annotation.AppCompatShadowedAttributes;
/**
@@ -74,7 +75,7 @@
*/
@AppCompatShadowedAttributes
public class AppCompatEditText extends EditText implements TintableBackgroundView,
- OnReceiveContentViewBehavior, EmojiCompatConfigurationView {
+ OnReceiveContentViewBehavior, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
private final AppCompatBackgroundHelper mBackgroundTintHelper;
private final AppCompatTextHelper mTextHelper;
@@ -391,4 +392,104 @@
public boolean isEmojiCompatEnabled() {
return mAppCompatEmojiEditTextHelper.isEnabled();
}
+
+ @Override
+ public void setCompoundDrawables(@Nullable Drawable left, @Nullable Drawable top,
+ @Nullable Drawable right, @Nullable Drawable bottom) {
+ super.setCompoundDrawables(left, top, right, bottom);
+ if (mTextHelper != null) {
+ mTextHelper.onSetCompoundDrawables();
+ }
+ }
+
+ @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
+ @Override
+ public void setCompoundDrawablesRelative(@Nullable Drawable start, @Nullable Drawable top,
+ @Nullable Drawable end, @Nullable Drawable bottom) {
+ super.setCompoundDrawablesRelative(start, top, end, bottom);
+ if (mTextHelper != null) {
+ mTextHelper.onSetCompoundDrawables();
+ }
+ }
+
+ /**
+ * This should be accessed via
+ * {@link androidx.core.widget.TextViewCompat#getCompoundDrawableTintList(TextView)}
+ *
+ * @return the tint applied to the compound drawables
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTint
+ * @see #setSupportCompoundDrawablesTintList(ColorStateList)
+ *
+ * @hide
+ */
+ @Nullable
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public ColorStateList getSupportCompoundDrawablesTintList() {
+ return mTextHelper.getCompoundDrawableTintList();
+ }
+
+ /**
+ * This should be accessed via {@link
+ * androidx.core.widget.TextViewCompat#setCompoundDrawableTintList(TextView, ColorStateList)}
+ *
+ * Applies a tint to the compound drawables. Does not modify the current tint mode, which is
+ * {@link PorterDuff.Mode#SRC_IN} by default.
+ * <p>
+ * Subsequent calls to {@link #setCompoundDrawables(Drawable, Drawable, Drawable, Drawable)} and
+ * related methods will automatically mutate the drawables and apply the specified tint and tint
+ * mode using {@link Drawable#setTintList(ColorStateList)}.
+ *
+ * @param tintList the tint to apply, may be {@code null} to clear tint
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTint
+ * @see #getSupportCompoundDrawablesTintList()
+ *
+ * @hide
+ */
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public void setSupportCompoundDrawablesTintList(@Nullable ColorStateList tintList) {
+ mTextHelper.setCompoundDrawableTintList(tintList);
+ mTextHelper.applyCompoundDrawablesTints();
+ }
+
+ /**
+ * This should be accessed via
+ * {@link androidx.core.widget.TextViewCompat#getCompoundDrawableTintMode(TextView)}
+ *
+ * Returns the blending mode used to apply the tint to the compound drawables, if specified.
+ *
+ * @return the blending mode used to apply the tint to the compound drawables
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTintMode
+ * @see #setSupportCompoundDrawablesTintMode(PorterDuff.Mode)
+ *
+ * @hide
+ */
+ @Nullable
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
+ return mTextHelper.getCompoundDrawableTintMode();
+ }
+
+ /**
+ * This should be accessed via {@link
+ * androidx.core.widget.TextViewCompat#setCompoundDrawableTintMode(TextView, PorterDuff.Mode)}
+ *
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setSupportCompoundDrawablesTintList(ColorStateList)} to the compound drawables. The
+ * default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param tintMode the blending mode used to apply the tint, may be {@code null} to clear tint
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTintMode
+ * @see #setSupportCompoundDrawablesTintList(ColorStateList)
+ *
+ * @hide
+ */
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public void setSupportCompoundDrawablesTintMode(@Nullable PorterDuff.Mode tintMode) {
+ mTextHelper.setCompoundDrawableTintMode(tintMode);
+ mTextHelper.applyCompoundDrawablesTints();
+ }
}
diff --git a/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatMultiAutoCompleteTextView.java b/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatMultiAutoCompleteTextView.java
index 50daec3..28fc37a 100644
--- a/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatMultiAutoCompleteTextView.java
+++ b/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatMultiAutoCompleteTextView.java
@@ -22,19 +22,23 @@
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.text.method.KeyListener;
import android.util.AttributeSet;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.widget.MultiAutoCompleteTextView;
+import android.widget.TextView;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.view.TintableBackgroundView;
+import androidx.core.widget.TintableCompoundDrawablesView;
import androidx.resourceinspection.annotation.AppCompatShadowedAttributes;
/**
@@ -54,7 +58,8 @@
*/
@AppCompatShadowedAttributes
public class AppCompatMultiAutoCompleteTextView extends MultiAutoCompleteTextView
- implements TintableBackgroundView, EmojiCompatConfigurationView {
+ implements TintableBackgroundView, EmojiCompatConfigurationView,
+ TintableCompoundDrawablesView {
private static final int[] TINT_ATTRS = {
android.R.attr.popupBackground
@@ -258,4 +263,104 @@
public boolean isEmojiCompatEnabled() {
return mAppCompatEmojiEditTextHelper.isEnabled();
}
+
+ @Override
+ public void setCompoundDrawables(@Nullable Drawable left, @Nullable Drawable top,
+ @Nullable Drawable right, @Nullable Drawable bottom) {
+ super.setCompoundDrawables(left, top, right, bottom);
+ if (mTextHelper != null) {
+ mTextHelper.onSetCompoundDrawables();
+ }
+ }
+
+ @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
+ @Override
+ public void setCompoundDrawablesRelative(@Nullable Drawable start, @Nullable Drawable top,
+ @Nullable Drawable end, @Nullable Drawable bottom) {
+ super.setCompoundDrawablesRelative(start, top, end, bottom);
+ if (mTextHelper != null) {
+ mTextHelper.onSetCompoundDrawables();
+ }
+ }
+
+ /**
+ * This should be accessed via
+ * {@link androidx.core.widget.TextViewCompat#getCompoundDrawableTintList(TextView)}
+ *
+ * @return the tint applied to the compound drawables
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTint
+ * @see #setSupportCompoundDrawablesTintList(ColorStateList)
+ *
+ * @hide
+ */
+ @Nullable
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public ColorStateList getSupportCompoundDrawablesTintList() {
+ return mTextHelper.getCompoundDrawableTintList();
+ }
+
+ /**
+ * This should be accessed via {@link
+ * androidx.core.widget.TextViewCompat#setCompoundDrawableTintList(TextView, ColorStateList)}
+ *
+ * Applies a tint to the compound drawables. Does not modify the current tint mode, which is
+ * {@link PorterDuff.Mode#SRC_IN} by default.
+ * <p>
+ * Subsequent calls to {@link #setCompoundDrawables(Drawable, Drawable, Drawable, Drawable)} and
+ * related methods will automatically mutate the drawables and apply the specified tint and tint
+ * mode using {@link Drawable#setTintList(ColorStateList)}.
+ *
+ * @param tintList the tint to apply, may be {@code null} to clear tint
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTint
+ * @see #getSupportCompoundDrawablesTintList()
+ *
+ * @hide
+ */
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public void setSupportCompoundDrawablesTintList(@Nullable ColorStateList tintList) {
+ mTextHelper.setCompoundDrawableTintList(tintList);
+ mTextHelper.applyCompoundDrawablesTints();
+ }
+
+ /**
+ * This should be accessed via
+ * {@link androidx.core.widget.TextViewCompat#getCompoundDrawableTintMode(TextView)}
+ *
+ * Returns the blending mode used to apply the tint to the compound drawables, if specified.
+ *
+ * @return the blending mode used to apply the tint to the compound drawables
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTintMode
+ * @see #setSupportCompoundDrawablesTintMode(PorterDuff.Mode)
+ *
+ * @hide
+ */
+ @Nullable
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
+ return mTextHelper.getCompoundDrawableTintMode();
+ }
+
+ /**
+ * This should be accessed via {@link
+ * androidx.core.widget.TextViewCompat#setCompoundDrawableTintMode(TextView, PorterDuff.Mode)}
+ *
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setSupportCompoundDrawablesTintList(ColorStateList)} to the compound drawables. The
+ * default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param tintMode the blending mode used to apply the tint, may be {@code null} to clear tint
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTintMode
+ * @see #setSupportCompoundDrawablesTintList(ColorStateList)
+ *
+ * @hide
+ */
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public void setSupportCompoundDrawablesTintMode(@Nullable PorterDuff.Mode tintMode) {
+ mTextHelper.setCompoundDrawableTintMode(tintMode);
+ mTextHelper.applyCompoundDrawablesTints();
+ }
}
diff --git a/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatRadioButton.java b/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatRadioButton.java
index 0004689..aeddd9c 100644
--- a/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatRadioButton.java
+++ b/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatRadioButton.java
@@ -22,20 +22,24 @@
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.text.InputFilter;
import android.util.AttributeSet;
import android.view.View;
import android.widget.RadioButton;
+import android.widget.TextView;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.view.TintableBackgroundView;
import androidx.core.view.ViewCompat;
import androidx.core.widget.TintableCompoundButton;
+import androidx.core.widget.TintableCompoundDrawablesView;
import androidx.resourceinspection.annotation.AppCompatShadowedAttributes;
/**
@@ -55,7 +59,7 @@
*/
@AppCompatShadowedAttributes
public class AppCompatRadioButton extends RadioButton implements TintableCompoundButton,
- TintableBackgroundView, EmojiCompatConfigurationView {
+ TintableBackgroundView, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
private final AppCompatCompoundButtonHelper mCompoundButtonHelper;
private final AppCompatBackgroundHelper mBackgroundTintHelper;
@@ -272,4 +276,104 @@
public boolean isEmojiCompatEnabled() {
return getEmojiTextViewHelper().isEnabled();
}
+
+ @Override
+ public void setCompoundDrawables(@Nullable Drawable left, @Nullable Drawable top,
+ @Nullable Drawable right, @Nullable Drawable bottom) {
+ super.setCompoundDrawables(left, top, right, bottom);
+ if (mTextHelper != null) {
+ mTextHelper.onSetCompoundDrawables();
+ }
+ }
+
+ @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
+ @Override
+ public void setCompoundDrawablesRelative(@Nullable Drawable start, @Nullable Drawable top,
+ @Nullable Drawable end, @Nullable Drawable bottom) {
+ super.setCompoundDrawablesRelative(start, top, end, bottom);
+ if (mTextHelper != null) {
+ mTextHelper.onSetCompoundDrawables();
+ }
+ }
+
+ /**
+ * This should be accessed via
+ * {@link androidx.core.widget.TextViewCompat#getCompoundDrawableTintList(TextView)}
+ *
+ * @return the tint applied to the compound drawables
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTint
+ * @see #setSupportCompoundDrawablesTintList(ColorStateList)
+ *
+ * @hide
+ */
+ @Nullable
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public ColorStateList getSupportCompoundDrawablesTintList() {
+ return mTextHelper.getCompoundDrawableTintList();
+ }
+
+ /**
+ * This should be accessed via {@link
+ * androidx.core.widget.TextViewCompat#setCompoundDrawableTintList(TextView, ColorStateList)}
+ *
+ * Applies a tint to the compound drawables. Does not modify the current tint mode, which is
+ * {@link PorterDuff.Mode#SRC_IN} by default.
+ * <p>
+ * Subsequent calls to {@link #setCompoundDrawables(Drawable, Drawable, Drawable, Drawable)} and
+ * related methods will automatically mutate the drawables and apply the specified tint and tint
+ * mode using {@link Drawable#setTintList(ColorStateList)}.
+ *
+ * @param tintList the tint to apply, may be {@code null} to clear tint
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTint
+ * @see #getSupportCompoundDrawablesTintList()
+ *
+ * @hide
+ */
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public void setSupportCompoundDrawablesTintList(@Nullable ColorStateList tintList) {
+ mTextHelper.setCompoundDrawableTintList(tintList);
+ mTextHelper.applyCompoundDrawablesTints();
+ }
+
+ /**
+ * This should be accessed via
+ * {@link androidx.core.widget.TextViewCompat#getCompoundDrawableTintMode(TextView)}
+ *
+ * Returns the blending mode used to apply the tint to the compound drawables, if specified.
+ *
+ * @return the blending mode used to apply the tint to the compound drawables
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTintMode
+ * @see #setSupportCompoundDrawablesTintMode(PorterDuff.Mode)
+ *
+ * @hide
+ */
+ @Nullable
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
+ return mTextHelper.getCompoundDrawableTintMode();
+ }
+
+ /**
+ * This should be accessed via {@link
+ * androidx.core.widget.TextViewCompat#setCompoundDrawableTintMode(TextView, PorterDuff.Mode)}
+ *
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setSupportCompoundDrawablesTintList(ColorStateList)} to the compound drawables. The
+ * default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param tintMode the blending mode used to apply the tint, may be {@code null} to clear tint
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTintMode
+ * @see #setSupportCompoundDrawablesTintList(ColorStateList)
+ *
+ * @hide
+ */
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public void setSupportCompoundDrawablesTintMode(@Nullable PorterDuff.Mode tintMode) {
+ mTextHelper.setCompoundDrawableTintMode(tintMode);
+ mTextHelper.applyCompoundDrawablesTints();
+ }
}
diff --git a/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatToggleButton.java b/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatToggleButton.java
index 443e9a6..44f89fb 100644
--- a/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatToggleButton.java
+++ b/appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatToggleButton.java
@@ -22,16 +22,20 @@
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.text.InputFilter;
import android.util.AttributeSet;
+import android.widget.TextView;
import android.widget.ToggleButton;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.core.view.TintableBackgroundView;
import androidx.core.view.ViewCompat;
+import androidx.core.widget.TintableCompoundDrawablesView;
import androidx.resourceinspection.annotation.AppCompatShadowedAttributes;
/**
@@ -51,7 +55,7 @@
*/
@AppCompatShadowedAttributes
public class AppCompatToggleButton extends ToggleButton implements TintableBackgroundView,
- EmojiCompatConfigurationView {
+ EmojiCompatConfigurationView, TintableCompoundDrawablesView {
private final AppCompatBackgroundHelper mBackgroundTintHelper;
private final AppCompatTextHelper mTextHelper;
@@ -197,4 +201,104 @@
public boolean isEmojiCompatEnabled() {
return getEmojiTextViewHelper().isEnabled();
}
+
+ @Override
+ public void setCompoundDrawables(@Nullable Drawable left, @Nullable Drawable top,
+ @Nullable Drawable right, @Nullable Drawable bottom) {
+ super.setCompoundDrawables(left, top, right, bottom);
+ if (mTextHelper != null) {
+ mTextHelper.onSetCompoundDrawables();
+ }
+ }
+
+ @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
+ @Override
+ public void setCompoundDrawablesRelative(@Nullable Drawable start, @Nullable Drawable top,
+ @Nullable Drawable end, @Nullable Drawable bottom) {
+ super.setCompoundDrawablesRelative(start, top, end, bottom);
+ if (mTextHelper != null) {
+ mTextHelper.onSetCompoundDrawables();
+ }
+ }
+
+ /**
+ * This should be accessed via
+ * {@link androidx.core.widget.TextViewCompat#getCompoundDrawableTintList(TextView)}
+ *
+ * @return the tint applied to the compound drawables
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTint
+ * @see #setSupportCompoundDrawablesTintList(ColorStateList)
+ *
+ * @hide
+ */
+ @Nullable
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public ColorStateList getSupportCompoundDrawablesTintList() {
+ return mTextHelper.getCompoundDrawableTintList();
+ }
+
+ /**
+ * This should be accessed via {@link
+ * androidx.core.widget.TextViewCompat#setCompoundDrawableTintList(TextView, ColorStateList)}
+ *
+ * Applies a tint to the compound drawables. Does not modify the current tint mode, which is
+ * {@link PorterDuff.Mode#SRC_IN} by default.
+ * <p>
+ * Subsequent calls to {@link #setCompoundDrawables(Drawable, Drawable, Drawable, Drawable)} and
+ * related methods will automatically mutate the drawables and apply the specified tint and tint
+ * mode using {@link Drawable#setTintList(ColorStateList)}.
+ *
+ * @param tintList the tint to apply, may be {@code null} to clear tint
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTint
+ * @see #getSupportCompoundDrawablesTintList()
+ *
+ * @hide
+ */
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public void setSupportCompoundDrawablesTintList(@Nullable ColorStateList tintList) {
+ mTextHelper.setCompoundDrawableTintList(tintList);
+ mTextHelper.applyCompoundDrawablesTints();
+ }
+
+ /**
+ * This should be accessed via
+ * {@link androidx.core.widget.TextViewCompat#getCompoundDrawableTintMode(TextView)}
+ *
+ * Returns the blending mode used to apply the tint to the compound drawables, if specified.
+ *
+ * @return the blending mode used to apply the tint to the compound drawables
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTintMode
+ * @see #setSupportCompoundDrawablesTintMode(PorterDuff.Mode)
+ *
+ * @hide
+ */
+ @Nullable
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
+ return mTextHelper.getCompoundDrawableTintMode();
+ }
+
+ /**
+ * This should be accessed via {@link
+ * androidx.core.widget.TextViewCompat#setCompoundDrawableTintMode(TextView, PorterDuff.Mode)}
+ *
+ * Specifies the blending mode used to apply the tint specified by
+ * {@link #setSupportCompoundDrawablesTintList(ColorStateList)} to the compound drawables. The
+ * default mode is {@link PorterDuff.Mode#SRC_IN}.
+ *
+ * @param tintMode the blending mode used to apply the tint, may be {@code null} to clear tint
+ * @attr ref androidx.appcompat.R.styleable#AppCompatTextView_drawableTintMode
+ * @see #setSupportCompoundDrawablesTintList(ColorStateList)
+ *
+ * @hide
+ */
+ @Override
+ @RestrictTo(LIBRARY_GROUP_PREFIX)
+ public void setSupportCompoundDrawablesTintMode(@Nullable PorterDuff.Mode tintMode) {
+ mTextHelper.setCompoundDrawableTintMode(tintMode);
+ mTextHelper.applyCompoundDrawablesTints();
+ }
}