mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-23 19:32:16 +00:00
Add: ThemePref change listener
This commit is contained in:
parent
d00bd044ce
commit
b74aeb8fcf
@ -117,6 +117,7 @@ class MainApplication : Application(), ImageLoaderFactory {
|
||||
var lastAutoSync = Preferences[Preferences.Key.AutoSync]
|
||||
var lastUpdateUnstable = Preferences[Preferences.Key.UpdateUnstable]
|
||||
var lastLanguage = Preferences[Preferences.Key.Language]
|
||||
var lastTheme = Preferences[Preferences.Key.Theme]
|
||||
CoroutineScope(Dispatchers.Default).launch {
|
||||
Preferences.subject.collect {
|
||||
when (it) {
|
||||
@ -137,6 +138,13 @@ class MainApplication : Application(), ImageLoaderFactory {
|
||||
forceSyncAll()
|
||||
}
|
||||
}
|
||||
Preferences.Key.Theme -> {
|
||||
val theme = Preferences[Preferences.Key.Theme]
|
||||
if (theme != lastTheme) {
|
||||
lastTheme = theme
|
||||
CoroutineScope(Dispatchers.Main).launch { mActivity.recreate() }
|
||||
}
|
||||
}
|
||||
Preferences.Key.Language -> {
|
||||
val language = Preferences[Preferences.Key.Language]
|
||||
if (language != lastLanguage) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user