|
@@ -5,6 +5,9 @@ import android.graphics.PorterDuff;
|
|
|
import android.graphics.drawable.Drawable;
|
|
|
import android.os.Build;
|
|
|
import android.support.v4.content.ContextCompat;
|
|
|
+import android.support.v7.internal.widget.TintCheckBox;
|
|
|
+import android.support.v7.internal.widget.TintEditText;
|
|
|
+import android.support.v7.internal.widget.TintRadioButton;
|
|
|
import android.widget.CheckBox;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.ProgressBar;
|
|
@@ -28,7 +31,7 @@ public class MDTintHelper {
|
|
|
});
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
|
radioButton.setButtonTintList(sl);
|
|
|
- } else {
|
|
|
+ } else if (radioButton instanceof TintRadioButton) {
|
|
|
Drawable drawable = ContextCompat.getDrawable(radioButton.getContext(), R.drawable.abc_btn_radio_material);
|
|
|
DrawableWrapper d = new DrawableWrapper(drawable);
|
|
|
d.setTintList(sl);
|
|
@@ -51,10 +54,14 @@ public class MDTintHelper {
|
|
|
}
|
|
|
|
|
|
public static void setEditTextTint(EditText editText, int color) {
|
|
|
+ ColorStateList s1 = ColorStateList.valueOf(color);
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
|
- editText.setBackgroundTintList(ColorStateList.valueOf(color));
|
|
|
- } else {
|
|
|
- editText.getBackground().setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
|
|
+ editText.setBackgroundTintList(s1);
|
|
|
+ } else if (editText instanceof TintEditText) {
|
|
|
+ Drawable drawable = ContextCompat.getDrawable(editText.getContext(), R.drawable.abc_edit_text_material);
|
|
|
+ DrawableWrapper d = new DrawableWrapper(drawable);
|
|
|
+ d.setTintList(s1);
|
|
|
+ editText.setBackgroundDrawable(d);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -68,7 +75,7 @@ public class MDTintHelper {
|
|
|
});
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
|
box.setButtonTintList(sl);
|
|
|
- } else {
|
|
|
+ } else if (box instanceof TintCheckBox) {
|
|
|
Drawable drawable = ContextCompat.getDrawable(box.getContext(), R.drawable.abc_btn_check_material);
|
|
|
DrawableWrapper d = new DrawableWrapper(drawable);
|
|
|
d.setTintList(sl);
|