Browse Source

Added global theme attribute for list item color (with default adapter implementation).

Aidan Follestad 10 years ago
parent
commit
0c8f670da6

+ 5 - 0
README.md

@@ -401,6 +401,11 @@ or operating system. This behavior can be overridden in your Activity themes:
     -->
     <item name="md_accent_color">#673AB7</item>
 
+    <!--
+        By default, the list item text color is derived from the ?android:textColorSecondary OS attribute
+    -->
+    <item name="md_item_color">#9C27B0</item>
+
 </style>
 ```
 

+ 2 - 2
library/build.gradle

@@ -9,7 +9,7 @@ android {
         minSdkVersion 8
         targetSdkVersion 21
         versionCode 1
-        versionName "0.4.1"
+        versionName "0.4.1.5"
     }
     buildTypes {
         release {
@@ -32,7 +32,7 @@ publish {
     userOrg = 'drummer-aidan'
     groupId = 'com.afollestad'
     artifactId = 'material-dialogs'
-    version = '0.4.1'
+    version = '0.4.1.5'
     description = 'A library for implementing Material design styled dialogs across all versions of Android.'
     website = 'https://github.com/afollestad/material-dialogs'
     issueTracker = "${website}/issues"

+ 3 - 1
library/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java

@@ -1112,10 +1112,12 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener,
 
     private class MaterialDialogAdapter extends ArrayAdapter<CharSequence> {
 
-        final int itemColor = DialogUtils.resolveColor(getContext(), android.R.attr.textColorSecondary);
+        final int itemColor;
 
         public MaterialDialogAdapter(Context context, int resource, int textViewResourceId, CharSequence[] objects) {
             super(context, resource, textViewResourceId, objects);
+            final int fallback = DialogUtils.resolveColor(getContext(), android.R.attr.textColorSecondary);
+            itemColor = DialogUtils.resolveColor(getContext(), R.attr.md_item_color, fallback);
         }
 
         @Override

+ 1 - 0
library/src/main/res/values/attrs.xml

@@ -9,5 +9,6 @@
     <attr name="md_title_color" format="color" />
     <attr name="md_content_color" format="color" />
     <attr name="md_accent_color" format="color" />
+    <attr name="md_item_color" format="color" />
 
 </resources>