Added options to open links, show images and original messages without confirmation

This commit is contained in:
M66B
2020-01-31 13:39:05 +01:00
parent 45f46cf852
commit 3768f5c0ee
5 changed files with 137 additions and 24 deletions

View File

@@ -63,6 +63,9 @@ import java.util.ArrayList;
import java.util.List;
public class FragmentOptionsPrivacy extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
private SwitchCompat swConfirmLinks;
private SwitchCompat swConfirmImages;
private SwitchCompat swConfirmHtml;
private SwitchCompat swDisableTracking;
private SwitchCompat swDisplayHidden;
private Spinner spEncryptMethod;
@@ -84,6 +87,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private List<String> openPgpProvider = new ArrayList<>();
private final static String[] RESET_OPTIONS = new String[]{
"confirm_links", "confirm_images", "confirm_html",
"disable_tracking", "display_hidden",
"default_encrypt_method", "openpgp_provider", "autocrypt", "autocrypt_mutual",
"sign_default", "encrypt_default", "auto_decrypt",
@@ -102,6 +106,9 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
// Get controls
swConfirmLinks = view.findViewById(R.id.swConfirmLinks);
swConfirmImages = view.findViewById(R.id.swConfirmImages);
swConfirmHtml = view.findViewById(R.id.swConfirmHtml);
swDisableTracking = view.findViewById(R.id.swDisableTracking);
swDisplayHidden = view.findViewById(R.id.swDisplayHidden);
spEncryptMethod = view.findViewById(R.id.spEncryptMethod);
@@ -137,6 +144,27 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
swConfirmLinks.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("confirm_links", checked).apply();
}
});
swConfirmImages.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("confirm_images", checked).apply();
}
});
swConfirmHtml.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("confirm_html", checked).apply();
}
});
swDisableTracking.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -353,6 +381,9 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private void setOptions() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
swConfirmLinks.setChecked(prefs.getBoolean("confirm_links", true));
swConfirmImages.setChecked(prefs.getBoolean("confirm_images", true));
swConfirmHtml.setChecked(prefs.getBoolean("confirm_html", true));
swDisableTracking.setChecked(prefs.getBoolean("disable_tracking", true));
swDisplayHidden.setChecked(prefs.getBoolean("display_hidden", false));