Moved discard draft option

This commit is contained in:
M66B 2020-07-17 11:23:45 +02:00
parent ae827996f5
commit e69f956c4d
4 changed files with 24 additions and 23 deletions

View File

@ -79,7 +79,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private SwitchCompat swAutoUnflag;
private SwitchCompat swAutoImportant;
private SwitchCompat swResetImportance;
private SwitchCompat swDiscardDelete;
private Group grpConversationActions;
private final static String[] RESET_OPTIONS = new String[]{
@ -89,7 +88,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
"doubletap", "swipenav", "volumenav", "reversed",
"autoexpand", "expand_all", "expand_one", "collapse_multiple",
"autoclose", "onclose",
"autoread", "flag_snoozed", "autounflag", "auto_important", "reset_importance", "discard_delete",
"autoread", "flag_snoozed", "autounflag", "auto_important", "reset_importance"
};
@Override
@ -127,7 +126,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swAutoUnflag = view.findViewById(R.id.swAutoUnflag);
swAutoImportant = view.findViewById(R.id.swAutoImportant);
swResetImportance = view.findViewById(R.id.swResetImportance);
swDiscardDelete = view.findViewById(R.id.swDiscardDelete);
grpConversationActions = view.findViewById(R.id.grpConversationActions);
setOptions();
@ -344,13 +342,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
}
});
swDiscardDelete.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("discard_delete", checked).apply();
}
});
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
return view;
@ -444,7 +435,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swAutoUnflag.setChecked(prefs.getBoolean("autounflag", false));
swAutoImportant.setChecked(prefs.getBoolean("auto_important", false));
swResetImportance.setChecked(prefs.getBoolean("reset_importance", false));
swDiscardDelete.setChecked(prefs.getBoolean("discard_delete", false));
grpConversationActions.setVisibility(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ? View.VISIBLE : View.GONE);
}

View File

@ -58,6 +58,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
private Spinner spSignatureLocation;
private SwitchCompat swSignatureReply;
private SwitchCompat swSignatureForward;
private SwitchCompat swDiscardDelete;
private SwitchCompat swPlainOnly;
private SwitchCompat swFormatFlowed;
@ -72,6 +73,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
"send_reminders", "send_delayed",
"autolist", "prefix_once", "extended_reply", "quote_reply", "resize_reply",
"signature_location", "signature_reply", "signature_forward",
"discard_delete",
"plain_only", "format_flowed", "usenet_signature", "remove_signatures",
"receipt_default", "receipt_type", "lookup_mx"
};
@ -102,6 +104,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
spSignatureLocation = view.findViewById(R.id.spSignatureLocation);
swSignatureReply = view.findViewById(R.id.swSignatureReply);
swSignatureForward = view.findViewById(R.id.swSignatureForward);
swDiscardDelete = view.findViewById(R.id.swDiscardDelete);
swPlainOnly = view.findViewById(R.id.swPlainOnly);
swFormatFlowed = view.findViewById(R.id.swFormatFlowed);
@ -236,6 +239,13 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
}
});
swDiscardDelete.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("discard_delete", checked).apply();
}
});
swPlainOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -362,6 +372,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
swSignatureReply.setChecked(prefs.getBoolean("signature_reply", true));
swSignatureForward.setChecked(prefs.getBoolean("signature_forward", true));
swDiscardDelete.setChecked(prefs.getBoolean("discard_delete", false));
swPlainOnly.setChecked(prefs.getBoolean("plain_only", false));
swFormatFlowed.setChecked(prefs.getBoolean("format_flowed", false));

View File

@ -422,17 +422,6 @@
app:layout_constraintTop_toBottomOf="@id/swAutoImportant"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swDiscardDelete"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_discard_delete"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swResetImportance"
app:switchPadding="12dp" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpConversationActions"
android:layout_width="0dp"

View File

@ -274,6 +274,17 @@
app:layout_constraintTop_toBottomOf="@id/swSignatureReply"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swDiscardDelete"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_discard_delete"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swSignatureForward"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvCaptionAdvanced"
android:layout_width="0dp"
@ -284,7 +295,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/swSignatureForward" />
app:layout_constraintTop_toBottomOf="@+id/swDiscardDelete" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swPlainOnly"