Moved discard draft option

pull/184/head
M66B 5 years ago
parent ae827996f5
commit e69f956c4d

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

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

@ -422,17 +422,6 @@
app:layout_constraintTop_toBottomOf="@id/swAutoImportant" app:layout_constraintTop_toBottomOf="@id/swAutoImportant"
app:switchPadding="12dp" /> 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 <androidx.constraintlayout.widget.Group
android:id="@+id/grpConversationActions" android:id="@+id/grpConversationActions"
android:layout_width="0dp" android:layout_width="0dp"

@ -274,6 +274,17 @@
app:layout_constraintTop_toBottomOf="@id/swSignatureReply" app:layout_constraintTop_toBottomOf="@id/swSignatureReply"
app:switchPadding="12dp" /> 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 <eu.faircode.email.FixedTextView
android:id="@+id/tvCaptionAdvanced" android:id="@+id/tvCaptionAdvanced"
android:layout_width="0dp" android:layout_width="0dp"
@ -284,7 +295,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textAppearance="@style/TextAppearance.AppCompat.Large"
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/swSignatureForward" /> app:layout_constraintTop_toBottomOf="@+id/swDiscardDelete" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swPlainOnly" android:id="@+id/swPlainOnly"

Loading…
Cancel
Save