diff --git a/app/src/main/java/com/keylesspalace/tusky/PreferencesActivity.kt b/app/src/main/java/com/keylesspalace/tusky/PreferencesActivity.kt index 359002183..016047c2f 100644 --- a/app/src/main/java/com/keylesspalace/tusky/PreferencesActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/PreferencesActivity.kt @@ -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).