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.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.ViewStub;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpAppPreference;
|
||||
import org.openintents.openpgp.util.OpenPgpKeyPreference;
|
||||
|
||||
public class SettingsActivity extends BaseActivity {
|
||||
public class SettingsActivity extends BaseActivity
|
||||
implements SharedPreferences.OnSharedPreferenceChangeListener{
|
||||
SettingsFragment fragement;
|
||||
|
||||
@Override
|
||||
|
@ -54,6 +57,9 @@ public class SettingsActivity extends BaseActivity {
|
|||
getFragmentManager().beginTransaction()
|
||||
.replace(R.id.container_content, fragement)
|
||||
.commit();
|
||||
|
||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
sharedPref.registerOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
public void finishWithResult() {
|
||||
|
@ -73,6 +79,12 @@ public class SettingsActivity extends BaseActivity {
|
|||
super.onBackPressed();
|
||||
}
|
||||
|
||||
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
|
||||
if (key.equals(getString(R.string.settings_key_theme))) {
|
||||
recreate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
|
Loading…
Reference in a new issue