mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Fix light theme sometimes being wrong when switching themes
This commit is contained in:
parent
b158bc6222
commit
3b6afd2cb6
1 changed files with 5 additions and 1 deletions
|
@ -236,7 +236,11 @@ fun Activity.setThemeAndNight(preferences: PreferencesHelper) {
|
||||||
fun Context.getPrefTheme(preferences: PreferencesHelper): ThemeUtil.Themes {
|
fun Context.getPrefTheme(preferences: PreferencesHelper): ThemeUtil.Themes {
|
||||||
// Using a try catch in case I start to remove themes
|
// Using a try catch in case I start to remove themes
|
||||||
return try {
|
return try {
|
||||||
(if (isInNightMode() || preferences.nightMode().get() == AppCompatDelegate.MODE_NIGHT_YES) preferences.darkTheme() else preferences.lightTheme()).get()
|
(
|
||||||
|
if ((applicationContext.isInNightMode() || preferences.nightMode().get() == AppCompatDelegate.MODE_NIGHT_YES) &&
|
||||||
|
preferences.nightMode().get() != AppCompatDelegate.MODE_NIGHT_NO
|
||||||
|
) preferences.darkTheme() else preferences.lightTheme()
|
||||||
|
).get()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
preferences.lightTheme().set(ThemeUtil.Themes.PURE_WHITE)
|
preferences.lightTheme().set(ThemeUtil.Themes.PURE_WHITE)
|
||||||
preferences.darkTheme().set(ThemeUtil.Themes.DARK)
|
preferences.darkTheme().set(ThemeUtil.Themes.DARK)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue