Change alert dialog background color

This commit is contained in:
Phillip Hsu 2016-09-27 00:56:46 -07:00
parent bea6181ea9
commit d2ef5e4436
3 changed files with 18 additions and 3 deletions

View File

@ -26,5 +26,6 @@
<style name="AlertDialogStyle" parent="android:Theme.Material.Dialog.Alert">
<item name="android:colorAccent">@color/colorAccentInverse</item>
<item name="android:background">@color/alert_dialog_background_color_inverse</item>
</style>
</resources>

View File

@ -3,12 +3,17 @@
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF5252</color>
<color name="colorPrimaryFallback">#5C6BC0</color>
<color name="colorPrimaryInverse">#212121</color>
<color name="colorPrimaryDarkInverse">@android:color/black</color>
<!-- Same as colorAccent, can't find a lighter accent color that looks red enough.. -->
<color name="colorAccentInverse">#FF5252</color>
<color name="colorPrimaryFallbackInverse">#303030</color>
<color name="card_background_color">#1fffffff</color> <!--12% white, not from MD spec-->
<color name="card_background_color_inverse">#0fffffff</color> <!--6% white, not from MD spec-->
<color name="alert_dialog_background_color">@color/colorPrimaryFallback</color>
<color name="alert_dialog_background_color_inverse">@color/colorPrimaryFallbackInverse</color>
</resources>

View File

@ -1,7 +1,6 @@
<resources>
<!--TODO: DayNight parent-->
<style name="BaseTheme" parent="Theme.AppCompat.NoActionBar">
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyle</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
@ -26,6 +25,7 @@
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyle</item>
<item name="android:windowBackground">@color/colorPrimary</item>
<item name="cardBackgroundColor">@color/card_background_color</item>
</style>
@ -33,6 +33,7 @@
<style name="AppTheme.Dark" parent="BaseAppTheme">
<item name="colorPrimary">@color/colorPrimaryInverse</item>
<item name="colorPrimaryDark">@color/colorPrimaryDarkInverse</item>
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyle.Dark</item>
<item name="colorAccent">@color/colorAccentInverse</item>
<item name="android:windowBackground">@color/colorPrimaryInverse</item>
<item name="cardBackgroundColor">@color/card_background_color_inverse</item>
@ -138,12 +139,20 @@
<item name="android:focusable">true</item>
<item name="android:focusableInTouchMode">true</item>
</style>
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Dialog.Alert">
<style name="BaseAppCompatAlertDialogStyle" parent="Theme.AppCompat.Dialog.Alert">
<!-- Trying to use the colorAccent attribute (whether from ?android:attr or ?attr) WILL CRASH.-->
<item name="colorAccent">@color/colorAccentInverse</item>
</style>
<style name="AppCompatAlertDialogStyle" parent="BaseAppCompatAlertDialogStyle">
<item name="android:background">@color/alert_dialog_background_color</item>
</style>
<style name="AppCompatAlertDialogStyle.Dark" parent="BaseAppCompatAlertDialogStyle">
<item name="android:background">@color/alert_dialog_background_color_inverse</item>
</style>
<style name="BottomSheetDialogTheme" parent="Theme.Design.Light.BottomSheetDialog">
<item name="bottomSheetStyle">@style/ModalStyle</item>
<!--TODO: See if defining a colorAccent item works.-->