themes: Switch to Material3 theme

* Merge accent and primary color for simpler color management
* Apply background color on status and navigation bar
* Drop non-required colors

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta 2024-06-24 11:02:27 +05:30
parent 412ed9ee16
commit 033498aa17
3 changed files with 10 additions and 19 deletions

View file

@ -6,9 +6,7 @@
<resources> <resources>
<!-- AOSP colors --> <!-- AOSP colors -->
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#36 --> <!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#36 -->
<color name="accent">@android:color/system_accent1_100</color> <color name="accent_primary">@android:color/system_accent1_100</color>
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#22 -->
<color name="primary">@android:color/system_neutral1_900</color>
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#51 --> <!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#51 -->
<color name="background">@android:color/system_neutral1_900</color> <color name="background">@android:color/system_neutral1_900</color>
</resources> </resources>

View file

@ -6,20 +6,14 @@
<resources> <resources>
<!-- AOSP colors --> <!-- AOSP colors -->
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#35 --> <!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#35 -->
<color name="accent">@android:color/system_accent1_600</color> <color name="accent_primary">@android:color/system_accent1_600</color>
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#23 -->
<color name="primary">@android:color/system_neutral1_50</color>
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#27 -->
<color name="primaryDark">@color/primary</color>
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#52 --> <!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#52 -->
<color name="background">@android:color/system_neutral1_50</color> <color name="background">@android:color/system_neutral1_50</color>
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#23 -->
<color name="statusBarColor">@color/primary</color>
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#69 --> <!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#69 -->
<!-- private resource, access it from colorError attribute instead --> <!-- private resource, access it from colorError attribute instead -->
<color name="red">@*android:color/error_color_device_default_dark</color> <color name="red">@*android:color/error_color_device_default_dark</color>
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#35 --> <!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#35 -->
<color name="ic_launcher_background">@color/accent</color> <color name="ic_launcher_background">@color/accent_primary</color>
<!-- Custom colors --> <!-- Custom colors -->
<color name="divider">#20ffffff</color> <color name="divider">#20ffffff</color>

View file

@ -4,18 +4,17 @@
--> -->
<resources> <resources>
<style name="AppTheme" parent="@style/Theme.AppCompat.DayNight.NoActionBar"> <style name="AppTheme" parent="@style/Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/primary</item> <item name="colorPrimary">@color/accent_primary</item>
<item name="colorPrimaryDark">@color/primaryDark</item> <item name="colorAccent">@color/accent_primary</item>
<item name="colorAccent">@color/accent</item>
<item name="colorError">@color/red</item> <item name="colorError">@color/red</item>
<item name="android:windowBackground">@color/background</item> <item name="android:windowBackground">@color/background</item>
<item name="fontFamily">@*android:string/config_bodyFontFamily</item> <item name="fontFamily">@*android:string/config_bodyFontFamily</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item> <item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<item name="android:windowLightStatusBar">@bool/isLight</item> <item name="android:windowLightStatusBar">@bool/isLight</item>
<item name="android:statusBarColor">@color/statusBarColor</item> <item name="android:statusBarColor">@color/background</item>
<item name="android:windowLightNavigationBar">@bool/isLight</item> <item name="android:windowLightNavigationBar">@bool/isLight</item>
<item name="android:navigationBarColor">@color/primary</item> <item name="android:navigationBarColor">@color/background</item>
</style> </style>
<!-- Copied from Settings --> <!-- Copied from Settings -->
@ -75,7 +74,7 @@
<item name="android:textAlignment">gravity</item> <item name="android:textAlignment">gravity</item>
</style> </style>
<style name="SudPrimaryButton" parent="Widget.AppCompat.Button.Colored"> <style name="SudPrimaryButton" parent="Widget.Material3.Button.UnelevatedButton">
<item name="android:buttonStyle">@style/SudPrimaryButton</item> <item name="android:buttonStyle">@style/SudPrimaryButton</item>
<item name="android:theme">@style/SudPrimaryButton</item> <item name="android:theme">@style/SudPrimaryButton</item>
<item name="buttonStyle">@style/SudPrimaryButton</item> <item name="buttonStyle">@style/SudPrimaryButton</item>
@ -90,7 +89,7 @@
<item name="textAllCaps">false</item> <item name="textAllCaps">false</item>
</style> </style>
<style name="SudSecondaryButton" parent="Widget.AppCompat.Button.Borderless.Colored"> <style name="SudSecondaryButton" parent="Widget.Material3.Button.TextButton">
<item name="android:buttonStyle">@style/SudSecondaryButton</item> <item name="android:buttonStyle">@style/SudSecondaryButton</item>
<item name="android:theme">@style/SudSecondaryButton</item> <item name="android:theme">@style/SudSecondaryButton</item>
<item name="buttonStyle">@style/SudSecondaryButton</item> <item name="buttonStyle">@style/SudSecondaryButton</item>