fix: preference dialogs are not themed with material 3

This commit is contained in:
proletarius101 2024-03-15 21:05:13 +08:00
parent ef083be9c6
commit d88f39e64d
3 changed files with 13 additions and 16 deletions

View File

@ -43,20 +43,6 @@
<item name="shapeAppearance">@style/ShapeAppearance.App.Button</item>
</style>
<style name="AlertDialogBaseThemeDark" parent="ThemeOverlay.Material3.MaterialAlertDialog" />
<style name="ThemeOverlay.App.MaterialAlertDialog.Dark" parent="AlertDialogBaseThemeDark">
<item name="android:windowBackground">@color/cardview_dark_background</item>
</style>
<style name="AlertDialogBaseThemeLight" parent="ThemeOverlay.Material3.MaterialAlertDialog" />
<style name="ThemeOverlay.App.MaterialAlertDialog.Light" parent="AlertDialogBaseThemeLight">
<item name="colorSecondary">@color/fdroid_green</item>
</style>
<style name="AlertDialogBaseThemeNight" parent="AlertDialogBaseThemeDark" />
<style name="MinWithDialogBaseThemeDark" parent="Theme.Material3.DayNight.Dialog.MinWidth">
<item name="colorSecondary">@color/fdroid_green</item>

View File

@ -1,7 +1,14 @@
<resources>
<!-- https://github.com/material-components/material-components-android/blob/22de817c30a493fb7dda46a8bea784d5bdc1dbdb/catalog/java/io/material/catalog/application/theme/res/values/themes.xml#L32-L38 -->
<style name="ThemeOverlay.App.Preference" parent="PreferenceThemeOverlay">
<item name="switchPreferenceCompatStyle">@style/Widget.App.Preference.SwitchPreferenceCompat
<item name="switchPreferenceCompatStyle">
@style/Widget.App.Preference.SwitchPreferenceCompat
</item>
</style>
<style name="ThemeOverlay.App.MaterialAlertDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog">
<item name="shapeAppearance">?attr/shapeAppearanceCornerExtraLarge</item>
<item name="android:colorBackground">?attr/colorSurfaceContainerHigh</item>
<item name="android:layout">@layout/m3_alert_dialog</item>
</style>
</resources>

View File

@ -18,7 +18,7 @@
<!-- Generated by the Material Theme Builder with modifications-->
<!-- https://www.figma.com/community/plugin/1034969338659738588&ndash;&gt;-->
<resources xmlns:tools="http://schemas.android.com/tools">
<resources>
<style name="Base.Theme.App" parent="Theme.Material3.DayNight.NoActionBar">
<!--Material shape attributes-->
@ -63,6 +63,10 @@
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">true</item>
<!-- Adjust androidx.preference dialogs to follow Material You -->
<!-- https://github.com/material-components/material-components-android/issues/2732#issuecomment-1146086018 -->
<item name="alertDialogTheme">@style/ThemeOverlay.App.MaterialAlertDialog</item>
<item name="colorPrimary">@color/md_theme_primary</item>
<item name="colorOnPrimary">@color/md_theme_onPrimary</item>
<item name="colorPrimaryContainer">@color/md_theme_primaryContainer</item>