mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Only use launchWhenCreated when the context isn't in nightmode already
This commit is contained in:
parent
a3f210dbf0
commit
29eec83389
1 changed files with 7 additions and 3 deletions
|
@ -67,10 +67,14 @@ fun AppCompatActivity.setThemeAndNight(preferences: PreferencesHelper) {
|
||||||
if (ThemeUtil.isColoredTheme(theme)) {
|
if (ThemeUtil.isColoredTheme(theme)) {
|
||||||
setTheme(R.style.ThemeOverlay_Tachiyomi_AllBlue)
|
setTheme(R.style.ThemeOverlay_Tachiyomi_AllBlue)
|
||||||
}
|
}
|
||||||
}
|
if (!isInNightMode()) {
|
||||||
lifecycle.coroutineScope.launchWhenCreated {
|
lifecycle.coroutineScope.launchWhenCreated {
|
||||||
AppCompatDelegate.setDefaultNightMode(preferences.nightMode().get())
|
AppCompatDelegate.setDefaultNightMode(preferences.nightMode().get())
|
||||||
}
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AppCompatDelegate.setDefaultNightMode(preferences.nightMode().get())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.getPrefTheme(preferences: PreferencesHelper): Themes {
|
fun Context.getPrefTheme(preferences: PreferencesHelper): Themes {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue