Merge pull request #1294 from pokegh0st/fix/preferences

Update Settings screen to use Material You design
This commit is contained in:
Sylvia van Os
2023-05-18 00:05:22 +02:00
committed by GitHub
5 changed files with 56 additions and 1 deletions

View File

@@ -0,0 +1,24 @@
<layer-list xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="?attr/colorSurface" />
<corners
android:bottomLeftRadius="28dp"
android:bottomRightRadius="28dp"
android:topLeftRadius="28dp"
android:topRightRadius="28dp" />
</shape>
</item>
<item>
<shape>
<solid android:color="@color/m3_popupmenu_overlay_color"
tools:ignore="PrivateResource" />
<corners
android:bottomLeftRadius="28dp"
android:bottomRightRadius="28dp"
android:topLeftRadius="28dp"
android:topRightRadius="28dp" />
</shape>
</item>
</layer-list>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.materialswitch.MaterialSwitch xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/switchWidget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:focusable="false" />

View File

@@ -27,10 +27,18 @@
<item name="colorOnSurfaceInverse">@color/md_theme_dark_inverseOnSurface</item>
<item name="colorSurfaceInverse">@color/md_theme_dark_inverseSurface</item>
<item name="colorPrimaryInverse">@color/md_theme_dark_primaryInverse</item>
<item name="materialAlertDialogTheme">@style/ThemeOverlay.App.MaterialAlertDialog.Monet</item>
<item name="alertDialogTheme">@style/ThemeOverlay.App.MaterialAlertDialog.Monet</item>
<item name="windowActionModeOverlay">true</item>
</style>
<style name="ThemeOverlay.App.MaterialAlertDialog.Monet" parent="ThemeOverlay.Material3.MaterialAlertDialog">
<item name="alertDialogStyle">@style/MaterialAlertDialog.Material3</item>
<item name="dialogCornerRadius">28dp</item>
<item name="android:background">@drawable/dialog_bg_monet</item>
</style>
<!-- note that this is not used directly, these are used to patch the active theme runtime with
theme.applyStyle
-->

View File

@@ -27,8 +27,17 @@
<item name="colorOnSurfaceInverse">@color/md_theme_light_inverseOnSurface</item>
<item name="colorSurfaceInverse">@color/md_theme_light_inverseSurface</item>
<item name="colorPrimaryInverse">@color/md_theme_light_primaryInverse</item>
<item name="materialAlertDialogTheme">@style/ThemeOverlay.App.MaterialAlertDialog.Monet</item>
<item name="alertDialogTheme">@style/ThemeOverlay.App.MaterialAlertDialog.Monet</item>
<item name="windowActionModeOverlay">true</item>
</style>
<style name="ThemeOverlay.App.MaterialAlertDialog.Monet" parent="ThemeOverlay.Material3.MaterialAlertDialog">
<item name="alertDialogStyle">@style/MaterialAlertDialog.Material3</item>
<item name="dialogCornerRadius">28dp</item>
<item name="android:background">@drawable/dialog_bg_monet</item>
</style>
<style name="AppTheme.NoActionBar" parent="AppTheme">

View File

@@ -25,6 +25,7 @@
app:singleLineTitle="false" />
<SwitchPreferenceCompat
android:widgetLayout="@layout/preference_material_switch"
android:defaultValue="false"
android:key="@string/settings_key_oled_dark"
android:title="@string/settings_oled_dark"
@@ -52,6 +53,7 @@
app:singleLineTitle="false" />
<SwitchPreferenceCompat
android:widgetLayout="@layout/preference_material_switch"
android:defaultValue="true"
android:key="@string/settings_key_display_barcode_max_brightness"
android:title="@string/settings_display_barcode_max_brightness"
@@ -68,6 +70,7 @@
app:singleLineTitle="false" />
<SwitchPreferenceCompat
android:widgetLayout="@layout/preference_material_switch"
android:defaultValue="true"
android:key="@string/settings_key_keep_screen_on"
android:title="@string/settings_keep_screen_on"
@@ -75,11 +78,14 @@
app:singleLineTitle="false" />
<SwitchPreferenceCompat
android:widgetLayout="@layout/preference_material_switch"
android:defaultValue="true"
android:key="@string/settings_key_disable_lockscreen_while_viewing_card"
android:title="@string/settings_disable_lockscreen_while_viewing_card"
app:iconSpaceReserved="false"
app:singleLineTitle="false" />
</PreferenceCategory>
</PreferenceScreen>
</PreferenceScreen>