Fix theme issues

This commit is contained in:
Thomas 2023-12-23 17:01:26 +01:00
parent d60900e2f9
commit 25c237f0a8
3 changed files with 21 additions and 1 deletions

View file

@ -275,7 +275,7 @@ public class ThemeHelper {
public static void switchTo(String themePref) { public static void switchTo(String themePref) {
if (themes.LIGHT.name().equals(themePref) || themes.SOLARIZED_LIGHT.name().equals(themePref)) { if (themes.LIGHT.name().equals(themePref) || themes.SOLARIZED_LIGHT.name().equals(themePref)) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
} else if (themes.DARK.name().equals(themePref) || themes.SOLARIZED_DARK.name().equals(themePref)) { } else if (themes.DARK.name().equals(themePref) || themes.SOLARIZED_DARK.name().equals(themePref) || themes.DRACULA.name().equals(themePref) || themes.BLACK.name().equals(themePref)) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
} else { } else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
@ -314,6 +314,8 @@ public class ThemeHelper {
public enum themes { public enum themes {
LIGHT, LIGHT,
DARK, DARK,
BLACK,
DRACULA,
SYSTEM, SYSTEM,
SOLARIZED_LIGHT, SOLARIZED_LIGHT,
SOLARIZED_DARK SOLARIZED_DARK

View file

@ -45,6 +45,7 @@
</item> </item>
<item name="android:windowSharedElementExitTransition">@transition/change_image_transform <item name="android:windowSharedElementExitTransition">@transition/change_image_transform
</item> </item>
<item name="alertDialogTheme">@style/AppThemeAlertDialog</item>
</style> </style>
<style name="AppThemeBar" parent="Theme.Material3.Dark"> <style name="AppThemeBar" parent="Theme.Material3.Dark">
@ -81,6 +82,7 @@
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item> <item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">false</item> <item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">false</item>
<item name="android:isLightTheme" tools:targetApi="q">false</item> <item name="android:isLightTheme" tools:targetApi="q">false</item>
<item name="alertDialogTheme">@style/AppThemeAlertDialog</item>
</style> </style>
@ -98,6 +100,7 @@
</item> </item>
<item name="android:windowTranslucentStatus">true</item> <item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item> <item name="android:windowTranslucentNavigation">true</item>
<item name="alertDialogTheme">@style/AppThemeAlertDialog</item>
</style> </style>
<style name="AppThemeAlertDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog"> <style name="AppThemeAlertDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog">
@ -168,6 +171,7 @@
<item name="colorOnSurfaceInverse">@color/solarized_md_theme_dark_inverseOnSurface</item> <item name="colorOnSurfaceInverse">@color/solarized_md_theme_dark_inverseOnSurface</item>
<item name="colorSurfaceInverse">@color/solarized_md_theme_dark_inverseSurface</item> <item name="colorSurfaceInverse">@color/solarized_md_theme_dark_inverseSurface</item>
<item name="colorPrimaryInverse">@color/solarized_md_theme_dark_inversePrimary</item> <item name="colorPrimaryInverse">@color/solarized_md_theme_dark_inversePrimary</item>
<item name="alertDialogTheme">@style/SolarizedAlertDialog</item>
</style> </style>
<style name="SolarizedAppThemeBar" parent="AppThemeBar"> <style name="SolarizedAppThemeBar" parent="AppThemeBar">
@ -203,6 +207,7 @@
<item name="colorOnSurfaceInverse">@color/solarized_md_theme_dark_inverseOnSurface</item> <item name="colorOnSurfaceInverse">@color/solarized_md_theme_dark_inverseOnSurface</item>
<item name="colorSurfaceInverse">@color/solarized_md_theme_dark_inverseSurface</item> <item name="colorSurfaceInverse">@color/solarized_md_theme_dark_inverseSurface</item>
<item name="colorPrimaryInverse">@color/solarized_md_theme_dark_inversePrimary</item> <item name="colorPrimaryInverse">@color/solarized_md_theme_dark_inversePrimary</item>
<item name="alertDialogTheme">@style/SolarizedAlertDialog</item>
</style> </style>
<style name="TransparentSolarized" parent="SolarizedAppThemeBar"> <style name="TransparentSolarized" parent="SolarizedAppThemeBar">
@ -221,6 +226,7 @@
</item> </item>
<item name="android:windowTranslucentStatus">true</item> <item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item> <item name="android:windowTranslucentNavigation">true</item>
<item name="alertDialogTheme">@style/SolarizedAlertDialog</item>
</style> </style>
<style name="SolarizedAlertDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog"> <style name="SolarizedAlertDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog">
@ -289,6 +295,7 @@
<item name="colorOnSurfaceInverse">@color/black</item> <item name="colorOnSurfaceInverse">@color/black</item>
<item name="colorSurfaceInverse">@color/white</item> <item name="colorSurfaceInverse">@color/white</item>
<item name="colorPrimaryInverse">@color/black</item> <item name="colorPrimaryInverse">@color/black</item>
<item name="alertDialogTheme">@style/BlackAlertDialog</item>
</style> </style>
<style name="BlackAppThemeBar" parent="AppThemeBar"> <style name="BlackAppThemeBar" parent="AppThemeBar">
@ -320,6 +327,7 @@
<item name="colorOnSurfaceInverse">@color/black</item> <item name="colorOnSurfaceInverse">@color/black</item>
<item name="colorSurfaceInverse">@color/white</item> <item name="colorSurfaceInverse">@color/white</item>
<item name="colorPrimaryInverse">@color/black</item> <item name="colorPrimaryInverse">@color/black</item>
<item name="alertDialogTheme">@style/BlackAlertDialog</item>
</style> </style>
<style name="TransparentBlack" parent="BlackAppThemeBar"> <style name="TransparentBlack" parent="BlackAppThemeBar">
@ -337,6 +345,7 @@
</item> </item>
<item name="android:windowTranslucentStatus">true</item> <item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item> <item name="android:windowTranslucentNavigation">true</item>
<item name="alertDialogTheme">@style/BlackAlertDialog</item>
</style> </style>
<style name="BlackAlertDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog"> <style name="BlackAlertDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog">
@ -402,6 +411,7 @@
<item name="colorOnSurfaceInverse">@color/dracula_comment</item> <item name="colorOnSurfaceInverse">@color/dracula_comment</item>
<item name="colorSurfaceInverse">@color/dracula_foreground</item> <item name="colorSurfaceInverse">@color/dracula_foreground</item>
<item name="colorPrimaryInverse">@color/dracula_comment</item> <item name="colorPrimaryInverse">@color/dracula_comment</item>
<item name="alertDialogTheme">@style/DraculaAlertDialog</item>
</style> </style>
@ -434,6 +444,7 @@
<item name="colorOnSurfaceInverse">@color/dracula_comment</item> <item name="colorOnSurfaceInverse">@color/dracula_comment</item>
<item name="colorSurfaceInverse">@color/dracula_foreground</item> <item name="colorSurfaceInverse">@color/dracula_foreground</item>
<item name="colorPrimaryInverse">@color/dracula_comment</item> <item name="colorPrimaryInverse">@color/dracula_comment</item>
<item name="alertDialogTheme">@style/DraculaAlertDialog</item>
</style> </style>
<style name="TransparentDracula" parent="DraculaAppThemeBar"> <style name="TransparentDracula" parent="DraculaAppThemeBar">
@ -452,6 +463,7 @@
</item> </item>
<item name="android:windowTranslucentStatus">true</item> <item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item> <item name="android:windowTranslucentNavigation">true</item>
<item name="alertDialogTheme">@style/DraculaAlertDialog</item>
</style> </style>
<style name="DraculaAlertDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog"> <style name="DraculaAlertDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog">

View file

@ -46,6 +46,7 @@
<item name="android:windowSharedElementExitTransition">@transition/change_image_transform <item name="android:windowSharedElementExitTransition">@transition/change_image_transform
</item> </item>
<item name="android:statusBarColor">?android:colorBackground</item> <item name="android:statusBarColor">?android:colorBackground</item>
<item name="alertDialogTheme">@style/AppThemeAlertDialog</item>
</style> </style>
<style name="AppThemeBar" parent="Theme.Material3.Light"> <style name="AppThemeBar" parent="Theme.Material3.Light">
@ -82,6 +83,7 @@
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">true</item> <item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">true</item>
<item name="android:isLightTheme" tools:targetApi="q">true</item> <item name="android:isLightTheme" tools:targetApi="q">true</item>
<item name="android:statusBarColor">?android:colorBackground</item> <item name="android:statusBarColor">?android:colorBackground</item>
<item name="alertDialogTheme">@style/AppThemeAlertDialog</item>
</style> </style>
<style name="Transparent" parent="AppThemeBar"> <style name="Transparent" parent="AppThemeBar">
@ -98,6 +100,7 @@
</item> </item>
<item name="android:windowTranslucentStatus">true</item> <item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item> <item name="android:windowTranslucentNavigation">true</item>
<item name="alertDialogTheme">@style/AppThemeAlertDialog</item>
</style> </style>
<style name="AppThemeAlertDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog"> <style name="AppThemeAlertDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog">
@ -167,6 +170,7 @@
<item name="colorOnSurfaceInverse">@color/solarized_md_theme_light_inverseOnSurface</item> <item name="colorOnSurfaceInverse">@color/solarized_md_theme_light_inverseOnSurface</item>
<item name="colorSurfaceInverse">@color/solarized_md_theme_light_inverseSurface</item> <item name="colorSurfaceInverse">@color/solarized_md_theme_light_inverseSurface</item>
<item name="colorPrimaryInverse">@color/solarized_md_theme_light_inversePrimary</item> <item name="colorPrimaryInverse">@color/solarized_md_theme_light_inversePrimary</item>
<item name="alertDialogTheme">@style/SolarizedAlertDialog</item>
</style> </style>
<style name="TransparentSolarized" parent="SolarizedAppThemeBar"> <style name="TransparentSolarized" parent="SolarizedAppThemeBar">
@ -183,6 +187,7 @@
</item> </item>
<item name="android:windowTranslucentStatus">true</item> <item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item> <item name="android:windowTranslucentNavigation">true</item>
<item name="alertDialogTheme">@style/SolarizedAlertDialog</item>
</style> </style>
<style name="SolarizedAlertDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog"> <style name="SolarizedAlertDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog">
@ -254,6 +259,7 @@
<item name="colorOnSurfaceInverse">@color/solarized_md_theme_light_inverseOnSurface</item> <item name="colorOnSurfaceInverse">@color/solarized_md_theme_light_inverseOnSurface</item>
<item name="colorSurfaceInverse">@color/solarized_md_theme_light_inverseSurface</item> <item name="colorSurfaceInverse">@color/solarized_md_theme_light_inverseSurface</item>
<item name="colorPrimaryInverse">@color/solarized_md_theme_light_inversePrimary</item> <item name="colorPrimaryInverse">@color/solarized_md_theme_light_inversePrimary</item>
<item name="alertDialogTheme">@style/SolarizedAlertDialog</item>
</style> </style>
<style name="Fedilab.SmallIconButton" parent="Widget.Material3.Button.IconButton"> <style name="Fedilab.SmallIconButton" parent="Widget.Material3.Button.IconButton">