Added auto decrypt on close

This commit is contained in:
M66B
2020-11-25 09:17:37 +01:00
parent 6d39a843fe
commit 4c6dddf11c
4 changed files with 63 additions and 2 deletions

View File

@@ -72,6 +72,7 @@ public class FragmentOptionsEncryption extends FragmentBase implements SharedPre
private SwitchCompat swSign;
private SwitchCompat swEncrypt;
private SwitchCompat swAutoDecrypt;
private SwitchCompat swAutoUndoDecrypt;
private Spinner spOpenPgp;
private TextView tvOpenPgpStatus;
@@ -90,7 +91,7 @@ public class FragmentOptionsEncryption extends FragmentBase implements SharedPre
private List<String> openPgpProvider = new ArrayList<>();
private final static String[] RESET_OPTIONS = new String[]{
"sign_default", "encrypt_default", "auto_decrypt",
"sign_default", "encrypt_default", "auto_decrypt", "auto_undecrypt",
"openpgp_provider", "autocrypt", "autocrypt_mutual", "encrypt_subject",
"check_certificate"
};
@@ -109,6 +110,7 @@ public class FragmentOptionsEncryption extends FragmentBase implements SharedPre
swSign = view.findViewById(R.id.swSign);
swEncrypt = view.findViewById(R.id.swEncrypt);
swAutoDecrypt = view.findViewById(R.id.swAutoDecrypt);
swAutoUndoDecrypt = view.findViewById(R.id.swAutoUndoDecrypt);
spOpenPgp = view.findViewById(R.id.spOpenPgp);
tvOpenPgpStatus = view.findViewById(R.id.tvOpenPgpStatus);
@@ -170,6 +172,13 @@ public class FragmentOptionsEncryption extends FragmentBase implements SharedPre
}
});
swAutoUndoDecrypt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("auto_undecrypt", checked).apply();
}
});
// PGP
spOpenPgp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@@ -363,6 +372,7 @@ public class FragmentOptionsEncryption extends FragmentBase implements SharedPre
swEncrypt.setChecked(prefs.getBoolean("encrypt_default", false));
swSign.setEnabled(!swEncrypt.isChecked());
swAutoDecrypt.setChecked(prefs.getBoolean("auto_decrypt", false));
swAutoUndoDecrypt.setChecked(prefs.getBoolean("auto_undecrypt", false));
String provider = prefs.getString("openpgp_provider", "org.sufficientlysecure.keychain");
spOpenPgp.setTag(provider);