mirror of
https://github.com/accelforce/Yuito
synced 2024-12-29 00:59:57 +01:00
fix activity restart after theme switch
This commit is contained in:
parent
25a73620a9
commit
3b475e8461
@ -85,6 +85,8 @@ class PreferencesActivity : BaseActivity(), SharedPreferences.OnSharedPreference
|
||||
.replace(R.id.fragment_container, fragment)
|
||||
.commit()
|
||||
|
||||
restartActivitiesOnExit = intent.getBooleanExtra("restart", false)
|
||||
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
@ -119,9 +121,9 @@ class PreferencesActivity : BaseActivity(), SharedPreferences.OnSharedPreference
|
||||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
|
||||
when (key) {
|
||||
"appTheme" -> {
|
||||
val theme = sharedPreferences.getString("appTheme", ThemeUtils.APP_THEME_DEFAULT)
|
||||
val theme = sharedPreferences.getNonNullString("appTheme", ThemeUtils.APP_THEME_DEFAULT)
|
||||
Log.d("activeTheme", theme)
|
||||
ThemeUtils.setAppNightMode(theme!!, this)
|
||||
ThemeUtils.setAppNightMode(theme, this)
|
||||
restartActivitiesOnExit = true
|
||||
|
||||
// recreate() could be used instead, but it doesn't have an animation B).
|
||||
|
Loading…
Reference in New Issue
Block a user