parent
d856758d15
commit
d708f08f02
2 changed files with 25 additions and 3 deletions
|
@ -51,7 +51,7 @@ public class PanicResponderActivity extends Activity {
|
||||||
DatabaseHelper.saveDatabase(this, new ArrayList<Entry>());
|
DatabaseHelper.saveDatabase(this, new ArrayList<Entry>());
|
||||||
|
|
||||||
if (response.contains("settings"))
|
if (response.contains("settings"))
|
||||||
settings.clear();
|
settings.clear(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
|
|
@ -109,8 +109,30 @@ public class Settings {
|
||||||
.apply();
|
.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void clear(boolean keep_auth) {
|
||||||
settings.edit().clear().commit();
|
String authMethod = getAuthMethod().toString().toLowerCase();
|
||||||
|
String authPassword = getAuthPasswordHash();
|
||||||
|
String authPIN = getAuthPINHash();
|
||||||
|
|
||||||
|
boolean warningShown = getFirstTimeWarningShown();
|
||||||
|
|
||||||
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
|
editor.clear();
|
||||||
|
|
||||||
|
editor.putBoolean(getResString(R.string.settings_key_security_backup_warning), warningShown);
|
||||||
|
|
||||||
|
if (keep_auth) {
|
||||||
|
editor.putString(getResString(R.string.settings_key_auth), authMethod);
|
||||||
|
|
||||||
|
if (!authPassword.isEmpty())
|
||||||
|
editor.putString(getResString(R.string.settings_key_auth_password_hash), authPassword);
|
||||||
|
|
||||||
|
if (!authPIN.isEmpty())
|
||||||
|
editor.putString(getResString(R.string.settings_key_auth_pin_hash), authPIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.commit();
|
||||||
|
|
||||||
PreferenceManager.setDefaultValues(context, R.xml.preferences, true);
|
PreferenceManager.setDefaultValues(context, R.xml.preferences, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue