AMOLED theme now has dark snackbar

This commit is contained in:
Jay 2019-12-16 20:14:33 -08:00
parent 9fd7083db8
commit af8ddac007
6 changed files with 11 additions and 2 deletions

View File

@ -41,7 +41,7 @@ fun View.snack(message: String, length: Int = Snackbar.LENGTH_SHORT, f: (Snackba
Unit)? = null): Snackbar { Unit)? = null): Snackbar {
val snack = Snackbar.make(this, message, length) val snack = Snackbar.make(this, message, length)
val textView: TextView = snack.view.findViewById(com.google.android.material.R.id.snackbar_text) val textView: TextView = snack.view.findViewById(com.google.android.material.R.id.snackbar_text)
textView.setTextColor(context.getResourceColor(android.R.attr.textColorPrimaryInverse)) textView.setTextColor(context.getResourceColor(R.attr.snackbar_text))
when { when {
Build.VERSION.SDK_INT >= 23 -> { Build.VERSION.SDK_INT >= 23 -> {
val leftM = if (this is CoordinatorLayout) 0 else rootWindowInsets.systemWindowInsetLeft val leftM = if (this is CoordinatorLayout) 0 else rootWindowInsets.systemWindowInsetLeft

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<solid android:color="@color/snackbarBackground"/> <solid android:color="?snackbar_background"/>
<corners android:radius="4dp"/> <corners android:radius="4dp"/>
</shape> </shape>

View File

@ -31,6 +31,8 @@
<item name="text_color_primary">@color/textColorPrimaryDark</item> <item name="text_color_primary">@color/textColorPrimaryDark</item>
<item name="background_card">@color/cardBackground</item> <item name="background_card">@color/cardBackground</item>
<item name="icon_color">@color/iconColorDark</item> <item name="icon_color">@color/iconColorDark</item>
<item name="snackbar_background">@color/snackbarBackground</item>
<item name="snackbar_text">@color/textColorPrimaryLight</item>
<item name="android:navigationBarColor">@color/oldNavBarBackground</item> <item name="android:navigationBarColor">@color/oldNavBarBackground</item>
</style> </style>
@ -54,6 +56,8 @@
<item name="colorPrimary">@color/colorAmoledPrimary</item> <item name="colorPrimary">@color/colorAmoledPrimary</item>
<item name="colorPrimaryDark">@color/colorAmoledPrimary</item> <item name="colorPrimaryDark">@color/colorAmoledPrimary</item>
<item name="android:colorBackground">@color/md_black_1000</item> <item name="android:colorBackground">@color/md_black_1000</item>
<item name="snackbar_background">@color/trueSnackbarBackground</item>
<item name="snackbar_text">@color/textColorPrimaryDark</item>
<!-- Custom Attributes--> <!-- Custom Attributes-->
<item name="selectable_list_drawable">@drawable/list_item_selector_amoled</item> <item name="selectable_list_drawable">@drawable/list_item_selector_amoled</item>

View File

@ -26,4 +26,6 @@
<attr name="text_color_primary" format="reference|integer"/> <attr name="text_color_primary" format="reference|integer"/>
<attr name="background_card" format="reference|integer"/> <attr name="background_card" format="reference|integer"/>
<attr name="icon_color" format="reference|integer"/> <attr name="icon_color" format="reference|integer"/>
<attr name="snackbar_background" format="reference|integer"/>
<attr name="snackbar_text" format="reference|integer"/>
</resources> </resources>

View File

@ -7,6 +7,7 @@
<color name="drawerPrimary">@color/colorPrimary</color> <color name="drawerPrimary">@color/colorPrimary</color>
<color name="cardBackground">#FFFFFF</color> <color name="cardBackground">#FFFFFF</color>
<color name="snackbarBackground">#323232</color> <color name="snackbarBackground">#323232</color>
<color name="trueSnackbarBackground">#323232</color>
<color name="dialogBackground">@color/md_white_1000</color> <color name="dialogBackground">@color/md_white_1000</color>
<color name="rippleColor">@color/md_black_1000_12</color> <color name="rippleColor">@color/md_black_1000_12</color>
<color name="colorAccent">@color/md_blue_A400</color> <color name="colorAccent">@color/md_blue_A400</color>

View File

@ -38,6 +38,8 @@
<item name="text_color_primary">@color/textColorPrimaryLight</item> <item name="text_color_primary">@color/textColorPrimaryLight</item>
<item name="background_card">@color/cardBackground</item> <item name="background_card">@color/cardBackground</item>
<item name="icon_color">@color/iconColorLight</item> <item name="icon_color">@color/iconColorLight</item>
<item name="snackbar_background">@color/snackbarBackground</item>
<item name="snackbar_text">@color/textColorPrimaryDark</item>
<item name="android:statusBarColor">@android:color/transparent</item> <item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">#B3000000</item> <item name="android:navigationBarColor">#B3000000</item>