[app] Make background color follow system theme (#634)

This commit is contained in:
tehcneko 2021-05-19 19:36:49 +08:00 committed by GitHub
parent 188cffd8ce
commit c1bed35bcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 45 additions and 4 deletions

View File

@ -98,6 +98,9 @@ public class ThemeUtil {
}
public static String getColorTheme() {
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.S || Build.VERSION.SDK_INT == Build.VERSION_CODES.R && Build.VERSION.PREVIEW_SDK_INT != 0) && isSystemAccent()) {
return "system";
}
String primaryColorEntryName = "COLOR_PRIMARY";
String colorPrimary = preferences.getString("theme_color", "COLOR_PRIMARY");
for (CustomThemeColors color : CustomThemeColors.values()) {

View File

@ -21,4 +21,5 @@
<resources>
<color name="system">@android:color/system_accent1_200</color>
<color name="system_background">@android:color/system_neutral1_800</color>
</resources>

View File

@ -39,5 +39,4 @@
<color name="material_brown">@color/material_brown_200</color>
<color name="material_grey">@color/material_grey_200</color>
<color name="material_blue_grey">@color/material_blue_grey_200</color>
<color name="system">@color/material_blue</color>
</resources>

View File

@ -21,4 +21,5 @@
<resources>
<color name="system">@android:color/system_accent1_500</color>
<color name="system_background">@android:color/system_neutral1_50</color>
</resources>

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ This file is part of LSPosed.
~
~ LSPosed is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ LSPosed is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
~
~ Copyright (C) 2021 LSPosed Contributors
-->
<resources>
<style name="ThemeOverlay.system">
<item name="colorPrimary">@color/system</item>
<item name="colorBackgroundFloating">@color/system_background</item>
<item name="android:colorBackground">@color/system_background</item>
<item name="android:windowBackground">@color/system_background</item>
<item name="dialogTheme">@style/ThemeOverlay.Material.Dialog.SystemAccent</item>
<item name="alertDialogTheme">@style/ThemeOverlay.Material.Dialog.Alert.SystemAccent</item>
</style>
<style name="ThemeOverlay.Material.Dialog.SystemAccent" parent="ThemeOverlay.Material.Dialog">
<item name="android:colorBackground">?colorBackgroundFloating</item>
</style>
<style name="ThemeOverlay.Material.Dialog.Alert.SystemAccent" parent="ThemeOverlay.Material.Dialog.Alert">
<item name="android:colorBackground">?colorBackgroundFloating</item>
</style>
</resources>

View File

@ -40,4 +40,5 @@
<color name="material_grey">@color/material_grey_500</color>
<color name="material_blue_grey">@color/material_blue_grey_500</color>
<color name="system">@color/material_blue</color>
<color name="system_background">@color/material_blue</color>
</resources>

View File

@ -99,7 +99,5 @@
<item name="colorPrimary">@color/material_blue_grey</item>
</style>
<style name="ThemeOverlay.system">
<item name="colorPrimary">@color/system</item>
</style>
<style name="ThemeOverlay.system" />
</resources>