Moved default encrypt to privacy settings

This commit is contained in:
M66B 2019-11-08 18:15:19 +01:00
parent e40372a9ed
commit 11245a389e
4 changed files with 30 additions and 27 deletions

View File

@ -61,6 +61,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private SwitchCompat swDisableTracking; private SwitchCompat swDisableTracking;
private SwitchCompat swDisplayHidden; private SwitchCompat swDisplayHidden;
private Spinner spOpenPgp; private Spinner spOpenPgp;
private SwitchCompat swEncrypt;
private SwitchCompat swAutoDecrypt; private SwitchCompat swAutoDecrypt;
private SwitchCompat swNoHistory; private SwitchCompat swNoHistory;
private Button btnBiometrics; private Button btnBiometrics;
@ -70,7 +71,10 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private List<String> openPgpProvider = new ArrayList<>(); private List<String> openPgpProvider = new ArrayList<>();
private final static String[] RESET_OPTIONS = new String[]{ private final static String[] RESET_OPTIONS = new String[]{
"disable_tracking", "display_hidden", "auto_decrypt", "no_history", "biometrics", "pin", "biometrics_timeout" "disable_tracking", "display_hidden",
"openpgp_provider", "encrypt_default", "auto_decrypt",
"no_history",
"biometrics", "pin", "biometrics_timeout"
}; };
@Override @Override
@ -86,6 +90,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
swDisableTracking = view.findViewById(R.id.swDisableTracking); swDisableTracking = view.findViewById(R.id.swDisableTracking);
swDisplayHidden = view.findViewById(R.id.swDisplayHidden); swDisplayHidden = view.findViewById(R.id.swDisplayHidden);
spOpenPgp = view.findViewById(R.id.spOpenPgp); spOpenPgp = view.findViewById(R.id.spOpenPgp);
swEncrypt = view.findViewById(R.id.swEncrypt);
swAutoDecrypt = view.findViewById(R.id.swAutoDecrypt); swAutoDecrypt = view.findViewById(R.id.swAutoDecrypt);
swNoHistory = view.findViewById(R.id.swNoHistory); swNoHistory = view.findViewById(R.id.swNoHistory);
btnBiometrics = view.findViewById(R.id.btnBiometrics); btnBiometrics = view.findViewById(R.id.btnBiometrics);
@ -98,8 +103,8 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
if (ri.serviceInfo != null) if (ri.serviceInfo != null)
openPgpProvider.add(ri.serviceInfo.packageName); openPgpProvider.add(ri.serviceInfo.packageName);
ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), R.layout.spinner_item1, android.R.id.text1); ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, android.R.id.text1);
adapter.setDropDownViewResource(R.layout.spinner_item1_dropdown); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
adapter.addAll(openPgpProvider); adapter.addAll(openPgpProvider);
spOpenPgp.setAdapter(adapter); spOpenPgp.setAdapter(adapter);
@ -135,6 +140,13 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
} }
}); });
swEncrypt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("encrypt_default", checked).apply();
}
});
swAutoDecrypt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swAutoDecrypt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -253,6 +265,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
break; break;
} }
swEncrypt.setChecked(prefs.getBoolean("encrypt_default", false));
swAutoDecrypt.setChecked(prefs.getBoolean("auto_decrypt", false)); swAutoDecrypt.setChecked(prefs.getBoolean("auto_decrypt", false));
swNoHistory.setChecked(prefs.getBoolean("no_history", false)); swNoHistory.setChecked(prefs.getBoolean("no_history", false));

View File

@ -55,7 +55,6 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
private SwitchCompat swAutoResize; private SwitchCompat swAutoResize;
private Spinner spAutoResize; private Spinner spAutoResize;
private TextView tvAutoResize; private TextView tvAutoResize;
private SwitchCompat swEncrypt;
private SwitchCompat swReceipt; private SwitchCompat swReceipt;
private SwitchCompat swLookupMx; private SwitchCompat swLookupMx;
private Spinner spSendDelayed; private Spinner spSendDelayed;
@ -64,7 +63,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
"keyboard", "suggest_sent", "suggested_received", "keyboard", "suggest_sent", "suggested_received",
"prefix_once", "extended_reply", "quote_reply", "prefix_once", "extended_reply", "quote_reply",
"plain_only", "usenet_signature", "plain_only", "usenet_signature",
"autoresize", "encrypt_default", "receipt_default", "resize", "lookup_mx", "send_delayed" "autoresize", "receipt_default", "resize", "lookup_mx", "send_delayed"
}; };
@Override @Override
@ -89,7 +88,6 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
swAutoResize = view.findViewById(R.id.swAutoResize); swAutoResize = view.findViewById(R.id.swAutoResize);
spAutoResize = view.findViewById(R.id.spAutoResize); spAutoResize = view.findViewById(R.id.spAutoResize);
tvAutoResize = view.findViewById(R.id.tvAutoResize); tvAutoResize = view.findViewById(R.id.tvAutoResize);
swEncrypt = view.findViewById(R.id.swEncrypt);
swReceipt = view.findViewById(R.id.swReceipt); swReceipt = view.findViewById(R.id.swReceipt);
swLookupMx = view.findViewById(R.id.swLookupMx); swLookupMx = view.findViewById(R.id.swLookupMx);
spSendDelayed = view.findViewById(R.id.spSendDelayed); spSendDelayed = view.findViewById(R.id.spSendDelayed);
@ -186,13 +184,6 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
} }
}); });
swEncrypt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("encrypt_default", checked).apply();
}
});
swReceipt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swReceipt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -287,7 +278,6 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
} }
spAutoResize.setEnabled(swAutoResize.isChecked()); spAutoResize.setEnabled(swAutoResize.isChecked());
swEncrypt.setChecked(prefs.getBoolean("encrypt_default", false));
swReceipt.setChecked(prefs.getBoolean("receipt_default", false)); swReceipt.setChecked(prefs.getBoolean("receipt_default", false));
swLookupMx.setChecked(prefs.getBoolean("lookup_mx", false)); swLookupMx.setChecked(prefs.getBoolean("lookup_mx", false));

View File

@ -80,6 +80,17 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvOpenPgp" /> app:layout_constraintTop_toBottomOf="@id/tvOpenPgp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swEncrypt"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_identity_encrypt"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spOpenPgp"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoDecrypt" android:id="@+id/swAutoDecrypt"
android:layout_width="0dp" android:layout_width="0dp"
@ -88,7 +99,7 @@
android:text="@string/title_advanced_auto_decrypt" android:text="@string/title_advanced_auto_decrypt"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spOpenPgp" app:layout_constraintTop_toBottomOf="@id/swEncrypt"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat

View File

@ -183,17 +183,6 @@
app:layout_constraintStart_toEndOf="@id/spAutoResize" app:layout_constraintStart_toEndOf="@id/spAutoResize"
app:layout_constraintTop_toTopOf="@id/spAutoResize" /> app:layout_constraintTop_toTopOf="@id/spAutoResize" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swEncrypt"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_identity_encrypt"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spAutoResize"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swReceipt" android:id="@+id/swReceipt"
android:layout_width="0dp" android:layout_width="0dp"
@ -202,7 +191,7 @@
android:text="@string/title_identity_receipt" android:text="@string/title_identity_receipt"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swEncrypt" app:layout_constraintTop_toBottomOf="@id/spAutoResize"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat