fix activity restart after theme switch
This commit is contained in:
parent
25a73620a9
commit
3b475e8461
1 changed files with 4 additions and 2 deletions
|
@ -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 a new issue