mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
save fragment state when changing theme/langugage
closes #2782 // FREEBIE
This commit is contained in:
parent
9201d50f05
commit
0cd4cc67af
@ -18,6 +18,7 @@ package org.thoughtcrime.securesms;
|
|||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.Build.VERSION;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
@ -70,7 +71,10 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle icicle, @NonNull MasterSecret masterSecret) {
|
protected void onCreate(Bundle icicle, @NonNull MasterSecret masterSecret) {
|
||||||
this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
initFragment(android.R.id.content, new ApplicationPreferenceFragment(), masterSecret);
|
|
||||||
|
if (icicle == null) {
|
||||||
|
initFragment(android.R.id.content, new ApplicationPreferenceFragment(), masterSecret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -105,9 +109,11 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
|||||||
@Override
|
@Override
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||||
if (key.equals(TextSecurePreferences.THEME_PREF)) {
|
if (key.equals(TextSecurePreferences.THEME_PREF)) {
|
||||||
dynamicTheme.onResume(this);
|
if (VERSION.SDK_INT >= 11) recreate();
|
||||||
|
else dynamicTheme.onResume(this);
|
||||||
} else if (key.equals(TextSecurePreferences.LANGUAGE_PREF)) {
|
} else if (key.equals(TextSecurePreferences.LANGUAGE_PREF)) {
|
||||||
dynamicLanguage.onResume(this);
|
if (VERSION.SDK_INT >= 11) recreate();
|
||||||
|
else dynamicLanguage.onResume(this);
|
||||||
|
|
||||||
Intent intent = new Intent(this, KeyCachingService.class);
|
Intent intent = new Intent(this, KeyCachingService.class);
|
||||||
intent.setAction(KeyCachingService.LOCALE_CHANGE_EVENT);
|
intent.setAction(KeyCachingService.LOCALE_CHANGE_EVENT);
|
||||||
|
Loading…
Reference in New Issue
Block a user