Эх сурвалжийг харах

Dark snackbar in dark themes (fixes #2699)

arkon 5 жил өмнө
parent
commit
9deaff9181

+ 6 - 0
app/src/main/res/drawable/snackbar_bg.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <corners android:radius="@dimen/design_snackbar_background_corner_radius" />
+    <solid android:color="?attr/colorSurface" />
+</shape>

+ 6 - 0
app/src/main/res/values/styles.xml

@@ -194,6 +194,11 @@
         <item name="android:background">@drawable/list_item_selector</item>
     </style>
 
+
+    <style name="Theme.Widget.Snackbar" parent="Widget.MaterialComponents.Snackbar">
+        <item name="android:background">@drawable/snackbar_bg</item>
+    </style>
+
     <!--==============-->
     <!--Widgets.Button-->
     <!--==============-->
@@ -218,6 +223,7 @@
         <item name="android:minWidth">48dip</item>
     </style>
 
+
     <!--===-->
     <!--OLD-->
     <!--===-->

+ 5 - 0
app/src/main/res/values/themes.xml

@@ -50,6 +50,9 @@
         <item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
         <item name="dialogTheme">@style/Theme.AlertDialog.Light</item>
         <item name="alertDialogTheme">@style/Theme.AlertDialog.Dark</item>
+        <!-- Intentially using default snackbar background in light theme -->
+        <!-- <item name="snackbarStyle">@style/Theme.Widget.Snackbar</item> -->
+        <item name="snackbarButtonStyle">@style/Theme.Widget.Button.Borderless</item>
         <item name="textAppearanceButton">@style/TextAppearance.Widget.Button</item>
         <item name="android:itemTextAppearance">@style/TextAppearance.Widget.Menu</item>
 
@@ -110,6 +113,8 @@
         <item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
         <item name="dialogTheme">@style/Theme.AlertDialog.Dark</item>
         <item name="alertDialogTheme">@style/Theme.AlertDialog.Dark</item>
+        <item name="snackbarStyle">@style/Theme.Widget.Snackbar</item>
+        <item name="snackbarButtonStyle">@style/Theme.Widget.Button.Borderless</item>
         <item name="textAppearanceButton">@style/TextAppearance.Widget.Button</item>
         <item name="android:itemTextAppearance">@style/TextAppearance.Widget.Menu</item>