Recreate the SettingsActivity on theme change
This commit is contained in:
parent
a5f9ec4efb
commit
e9b33edb1a
1 changed files with 13 additions and 1 deletions
|
@ -24,16 +24,19 @@ package org.shadowice.flocke.andotp;
|
||||||
|
|
||||||
import android.app.KeyguardManager;
|
import android.app.KeyguardManager;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.view.ViewStub;
|
import android.view.ViewStub;
|
||||||
|
|
||||||
import org.openintents.openpgp.util.OpenPgpAppPreference;
|
import org.openintents.openpgp.util.OpenPgpAppPreference;
|
||||||
import org.openintents.openpgp.util.OpenPgpKeyPreference;
|
import org.openintents.openpgp.util.OpenPgpKeyPreference;
|
||||||
|
|
||||||
public class SettingsActivity extends BaseActivity {
|
public class SettingsActivity extends BaseActivity
|
||||||
|
implements SharedPreferences.OnSharedPreferenceChangeListener{
|
||||||
SettingsFragment fragement;
|
SettingsFragment fragement;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -54,6 +57,9 @@ public class SettingsActivity extends BaseActivity {
|
||||||
getFragmentManager().beginTransaction()
|
getFragmentManager().beginTransaction()
|
||||||
.replace(R.id.container_content, fragement)
|
.replace(R.id.container_content, fragement)
|
||||||
.commit();
|
.commit();
|
||||||
|
|
||||||
|
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
sharedPref.registerOnSharedPreferenceChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void finishWithResult() {
|
public void finishWithResult() {
|
||||||
|
@ -73,6 +79,12 @@ public class SettingsActivity extends BaseActivity {
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
|
||||||
|
if (key.equals(getString(R.string.settings_key_theme))) {
|
||||||
|
recreate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
|
Loading…
Reference in a new issue