mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 18:41:48 +01:00
Fix light theme sometimes being wrong when switching themes
This commit is contained in:
parent
b158bc6222
commit
3b6afd2cb6
@ -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…
Reference in New Issue
Block a user