Ver Fonte

MaterialEditTextPreference will use android.R.attr.colorAccent as a backup to R.attr.colorAccent on Lollipop (if you specify android.R.attr.colorAccent in your Lollipop Activity theme, it will be used). Related to #509.

Aidan Follestad há 10 anos atrás
pai
commit
3b1bc4565f

+ 5 - 1
library/src/main/java/com/afollestad/materialdialogs/prefs/MaterialEditTextPreference.java

@@ -38,7 +38,11 @@ public class MaterialEditTextPreference extends EditTextPreference {
 
     public MaterialEditTextPreference(Context context, AttributeSet attrs) {
         super(context, attrs);
-        mColor = DialogUtils.resolveColor(context, R.attr.colorAccent);
+        final int fallback;
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
+            fallback = DialogUtils.resolveColor(context, android.R.attr.colorAccent);
+        else fallback = 0;
+        mColor = DialogUtils.resolveColor(context, R.attr.colorAccent, fallback);
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
             mColor = DialogUtils.resolveColor(context, android.R.attr.colorAccent, mColor);
         }