1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-29 11:15:51 +00:00

Added option to disable collapsing on marking read/unread

This commit is contained in:
M66B 2021-09-29 09:41:32 +02:00
parent 0e278dc566
commit 648728d1fa
4 changed files with 30 additions and 5 deletions

View file

@ -286,6 +286,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private boolean authentication_indicator;
private boolean autoclose_unseen;
private boolean collapse_marked;
private boolean language_detection;
private List<String> languages;
@ -4989,10 +4990,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
message.ui_seen = args.getBoolean("seen");
message.unseen = (message.ui_seen ? 0 : message.count);
if (!message.ui_seen &&
(autoclose_unseen || getItemCount() == 1))
if (!message.ui_seen && autoclose_unseen)
properties.finish();
else
else if (collapse_marked)
properties.setExpanded(message, false, true);
}
@ -5923,6 +5924,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.authentication_indicator = prefs.getBoolean("authentication_indicator", false);
this.language_detection = prefs.getBoolean("language_detection", false);
this.autoclose_unseen = prefs.getBoolean("autoclose_unseen", false);
this.collapse_marked = prefs.getBoolean("collapse_marked", true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
languages = new ArrayList<>();

View file

@ -84,6 +84,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private TextView tvOnClose;
private Spinner spOnClose;
private SwitchCompat swAutoCloseUnseen;
private SwitchCompat swCollapseMarked;
private Spinner spUndoTimeout;
private SwitchCompat swCollapseMultiple;
private SwitchCompat swAutoRead;
@ -101,7 +102,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
"pull", "autoscroll", "quick_filter", "quick_scroll", "swipe_sensitivity",
"doubletap", "swipenav", "volumenav", "reversed", "swipe_close", "swipe_move",
"autoexpand", "expand_first", "expand_all", "expand_one", "collapse_multiple",
"autoclose", "onclose", "autoclose_unseen",
"autoclose", "onclose", "autoclose_unseen", "collapse_marked",
"undo_timeout",
"autoread", "flag_snoozed", "autounflag", "auto_important", "reset_importance"
};
@ -144,6 +145,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);
swCollapseMarked = view.findViewById(R.id.swCollapseMarked);
spUndoTimeout = view.findViewById(R.id.spUndoTimeout);
swAutoRead = view.findViewById(R.id.swAutoRead);
swFlagSnoozed = view.findViewById(R.id.swFlagSnoozed);
@ -396,6 +398,13 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
}
});
swCollapseMarked.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("collapse_marked", checked).apply();
}
});
spUndoTimeout.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
@ -535,6 +544,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
spOnClose.setEnabled(!swAutoClose.isChecked());
swAutoCloseUnseen.setChecked(prefs.getBoolean("autoclose_unseen", false));
swCollapseMarked.setChecked(prefs.getBoolean("collapse_marked", true));
int undo_timeout = prefs.getInt("undo_timeout", 5000);
int[] undoValues = getResources().getIntArray(R.array.undoValues);

View file

@ -540,6 +540,18 @@
app:layout_constraintTop_toBottomOf="@id/spOnClose"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCollapseMarked"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_collapse_marked"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoCloseUnseen"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvUndoTimeout"
android:layout_width="0dp"
@ -551,7 +563,7 @@
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoCloseUnseen" />
app:layout_constraintTop_toBottomOf="@id/swCollapseMarked" />
<Spinner
android:id="@+id/spUndoTimeout"

View file

@ -522,6 +522,7 @@
<string name="title_advanced_autoclose">Automatically close conversations</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>
<string name="title_advanced_undo">Undo timeout</string>
<string name="title_advanced_quick_filter">Show non-obtrusive quick filter icons</string>
<string name="title_advanced_quick_scroll">Show non-obtrusive quick scroll up/down icons</string>