Change value of themedIconTint to be a color resource, instead of a ColorStateList resource which is not supported for the XML tint attribute of an ImageView below v21.

This commit is contained in:
Phillip Hsu
2016-09-01 20:55:29 -07:00
parent d7b3fc6ee1
commit c8ea8cf43a
3 changed files with 16 additions and 9 deletions
+10 -2
View File
@@ -9,7 +9,11 @@
<!--<item name="dialogTheme">@style/AppCompatDialogTheme</item>-->
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyle</item>
<item name="bottomSheetDialogTheme">@style/BottomSheetDialogTheme</item>
<item name="themedIconTint">@color/icon_color</item>
<!--The icons that need to be tinted with this attribute will only ever be in
the active state, so we don't need to use @color/icon_color ColorStateList resource.
Secondly, using a ColorStateList resource via XML for the tint attribute of an ImageView
is not supported below 21. -->
<item name="themedIconTint">@color/icon_color_active_light</item>
<item name="android:textColorHint">@color/text_color_disabled_light</item>
</style>
@@ -22,7 +26,11 @@
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyle.Dark</item>
<!--TODO: Dark theme-->
<item name="bottomSheetDialogTheme">@style/BottomSheetDialogTheme</item>
<item name="themedIconTint">@color/icon_color_dark</item>
<!--The icons that need to be tinted with this attribute will only ever be in
the active state, so we don't need to use @color/icon_color_dark ColorStateList resource
Secondly, using a ColorStateList resource via XML for the tint attribute of an ImageView
is not supported below 21.-->
<item name="themedIconTint">@color/icon_color_active_dark</item>
<item name="android:textColorHint">@color/text_color_disabled_dark</item>
</style>
+4 -1
View File
@@ -18,10 +18,13 @@
<item name="android:layout_width">@dimen/cardview_action_icon_size</item>
<item name="android:layout_height">@dimen/cardview_action_icon_size</item>
<item name="android:background">?selectableItemBackground</item>
<item name="android:tint">?attr/themedIconTint</item>
<item name="android:layout_marginStart">@dimen/cardview_action_icon_margin</item>
<item name="android:layout_marginEnd">@dimen/cardview_action_icon_margin</item>
<item name="android:layout_marginBottom">@dimen/cardview_action_icon_margin</item>
<!--https://code.google.com/p/android/issues/detail?id=18220-->
<!--"... there is no support for color state list in the ImageView tint attribute
prior to API 21." ImageButton is a subclass of ImageView.-->
<item name="android:tint">?attr/themedIconTint</item>
</style>
<style name="TimerAction.AddOneMinute">
<item name="android:gravity">center</item>