diff --git a/app/src/main/java/eu/faircode/email/ActivityBase.java b/app/src/main/java/eu/faircode/email/ActivityBase.java index 0621d8ea46..bc10d885a0 100644 --- a/app/src/main/java/eu/faircode/email/ActivityBase.java +++ b/app/src/main/java/eu/faircode/email/ActivityBase.java @@ -73,8 +73,9 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc this.contacts = hasPermission(Manifest.permission.READ_CONTACTS); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); - boolean no_history = prefs.getBoolean("no_history", false); - if (no_history) + + boolean secure = prefs.getBoolean("secure", false); + if (secure) getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); if (!this.getClass().equals(ActivityMain.class)) { diff --git a/app/src/main/java/eu/faircode/email/ApplicationEx.java b/app/src/main/java/eu/faircode/email/ApplicationEx.java index 9b0bbd854e..3c987a7b94 100644 --- a/app/src/main/java/eu/faircode/email/ApplicationEx.java +++ b/app/src/main/java/eu/faircode/email/ApplicationEx.java @@ -173,6 +173,12 @@ public class ApplicationEx extends Application { editor.putInt("default_snooze", hours); editor.remove("notify_snooze_duration"); } + + } else if (version < 819) { + if (prefs.contains("no_history")) { + editor.putBoolean("secure", prefs.getBoolean("no_history", false)); + editor.remove("no_history"); + } } if (version < BuildConfig.VERSION_CODE) diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java b/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java index dab4fa9165..9c673570e3 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java @@ -63,7 +63,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer private Spinner spOpenPgp; private SwitchCompat swEncrypt; private SwitchCompat swAutoDecrypt; - private SwitchCompat swNoHistory; + private SwitchCompat swSecure; private Button btnBiometrics; private Spinner spBiometricsTimeout; private Button btnPin; @@ -73,7 +73,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer private final static String[] RESET_OPTIONS = new String[]{ "disable_tracking", "display_hidden", "openpgp_provider", "encrypt_default", "auto_decrypt", - "no_history", + "secure", "biometrics", "pin", "biometrics_timeout" }; @@ -92,7 +92,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer spOpenPgp = view.findViewById(R.id.spOpenPgp); swEncrypt = view.findViewById(R.id.swEncrypt); swAutoDecrypt = view.findViewById(R.id.swAutoDecrypt); - swNoHistory = view.findViewById(R.id.swNoHistory); + swSecure = view.findViewById(R.id.swSecure); btnBiometrics = view.findViewById(R.id.btnBiometrics); spBiometricsTimeout = view.findViewById(R.id.spBiometricsTimeout); btnPin = view.findViewById(R.id.btnPin); @@ -154,10 +154,10 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer } }); - swNoHistory.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + swSecure.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("no_history", checked).commit(); // apply won't work here + prefs.edit().putBoolean("secure", checked).commit(); // apply won't work here restart(); } }); @@ -267,7 +267,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer swEncrypt.setChecked(prefs.getBoolean("encrypt_default", false)); swAutoDecrypt.setChecked(prefs.getBoolean("auto_decrypt", false)); - swNoHistory.setChecked(prefs.getBoolean("no_history", false)); + swSecure.setChecked(prefs.getBoolean("secure", false)); boolean biometrics = prefs.getBoolean("biometrics", false); btnBiometrics.setText(biometrics diff --git a/app/src/main/res/layout/fragment_options_privacy.xml b/app/src/main/res/layout/fragment_options_privacy.xml index 76c5d4053b..9cbb4e4668 100644 --- a/app/src/main/res/layout/fragment_options_privacy.xml +++ b/app/src/main/res/layout/fragment_options_privacy.xml @@ -103,18 +103,18 @@ app:switchPadding="12dp" /> + app:layout_constraintTop_toBottomOf="@id/swSecure" /> + app:layout_constraintTop_toBottomOf="@id/tvSecureHint" />