Added option to automatically close conversations on reply

This commit is contained in:
M66B 2023-01-19 14:45:39 +01:00
parent e9bc8f8e7b
commit 890ace9eed
4 changed files with 31 additions and 2 deletions

View File

@ -3575,6 +3575,12 @@ public class FragmentMessages extends FragmentBase
.putExtra("reference", message.id)
.putExtra("selected", selected);
startActivity(reply);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean autoclose_reply = prefs.getBoolean("autoclose_reply", false);
if (autoclose_reply &&
("reply".equals(action) || "reply_all".equals(action)))
finish();
}
private void onMenuResend(TupleMessageEx message) {

View File

@ -91,6 +91,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private TextView tvOnClose;
private Spinner spOnClose;
private SwitchCompat swAutoCloseUnseen;
private SwitchCompat swAutoCloseReply;
private SwitchCompat swCollapseMarked;
private Spinner spUndoTimeout;
private SwitchCompat swCollapseMultiple;
@ -112,7 +113,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
"pull", "autoscroll", "quick_filter", "quick_scroll", "quick_actions", "swipe_sensitivity", "foldernav",
"doubletap", "swipenav", "volumenav", "reversed", "swipe_close", "swipe_move",
"autoexpand", "expand_first", "expand_all", "expand_one", "collapse_multiple",
"autoclose", "onclose", "autoclose_unseen", "collapse_marked",
"autoclose", "onclose", "autoclose_unseen", "autoclose_reply", "collapse_marked",
"undo_timeout",
"autoread", "flag_snoozed", "autounflag", "auto_important", "reset_importance", "reset_snooze", "auto_block_sender",
"swipe_reply"
@ -162,6 +163,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
tvOnClose = view.findViewById(R.id.tvOnClose);
spOnClose = view.findViewById(R.id.spOnClose);
swAutoCloseUnseen = view.findViewById(R.id.swAutoCloseUnseen);
swAutoCloseReply = view.findViewById(R.id.swAutoCloseReply);
swCollapseMarked = view.findViewById(R.id.swCollapseMarked);
spUndoTimeout = view.findViewById(R.id.spUndoTimeout);
swAutoRead = view.findViewById(R.id.swAutoRead);
@ -453,6 +455,13 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
}
});
swAutoCloseReply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("autoclose_reply", checked).apply();
}
});
swCollapseMarked.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -627,6 +636,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
spOnClose.setEnabled(!swAutoClose.isChecked());
swAutoCloseUnseen.setChecked(prefs.getBoolean("autoclose_unseen", false));
swAutoCloseReply.setChecked(prefs.getBoolean("autoclose_reply", false));
swCollapseMarked.setChecked(prefs.getBoolean("collapse_marked", true));
int undo_timeout = prefs.getInt("undo_timeout", 5000);

View File

@ -623,6 +623,18 @@
app:layout_constraintTop_toBottomOf="@id/spOnClose"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoCloseReply"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_autoclose_reply"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoCloseUnseen"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCollapseMarked"
android:layout_width="0dp"
@ -632,7 +644,7 @@
android:text="@string/title_advanced_collapse_marked"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoCloseUnseen"
app:layout_constraintTop_toBottomOf="@id/swAutoCloseReply"
app:switchPadding="12dp" />
<TextView

View File

@ -638,6 +638,7 @@
<string name="title_advanced_expand_one">Expand only one message at a time</string>
<string name="title_advanced_collapse_multiple">Collapse messages in a conversation with multiple messages on \'back\'</string>
<string name="title_advanced_autoclose">Automatically close conversations</string>
<string name="title_advanced_autoclose_reply">Automatically close conversations on reply</string>
<string name="title_advanced_onclose">On closing a conversation</string>
<string name="title_advanced_autoclose_unread">Close conversations on marking messages as unread</string>
<string name="title_advanced_collapse_marked">Collapse messages which are manually marked as read or unread</string>