mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-06 00:53:26 +02:00
Added option to expand first message when all read
This commit is contained in:
@@ -4930,7 +4930,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||
autoExpanded = false;
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
boolean expand_first = prefs.getBoolean("expand_first", true);
|
||||
boolean expand_all = prefs.getBoolean("expand_all", false);
|
||||
long download = prefs.getInt("download", MessageHelper.DEFAULT_DOWNLOAD_SIZE);
|
||||
|
||||
if (download == 0)
|
||||
download = Long.MAX_VALUE;
|
||||
|
||||
@@ -4984,7 +4987,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||
expand = messages.get(0);
|
||||
else if (messages.size() > 0) {
|
||||
TupleMessageEx first = messages.get(adapter.getAscending() ? messages.size() - 1 : 0);
|
||||
if (first != null && EntityFolder.OUTBOX.equals(first.folderType))
|
||||
if (first != null &&
|
||||
((expand_first && unseen == 0) || EntityFolder.OUTBOX.equals(first.folderType)))
|
||||
expand = first;
|
||||
}
|
||||
|
||||
@@ -4994,7 +4998,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||
}
|
||||
|
||||
// Auto expand all seen messages
|
||||
boolean expand_all = prefs.getBoolean("expand_all", false);
|
||||
if (expand_all)
|
||||
for (TupleMessageEx message : messages)
|
||||
if (message != null &&
|
||||
|
||||
@@ -74,6 +74,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
||||
private SwitchCompat swSwipeClose;
|
||||
private SwitchCompat swSwipeMove;
|
||||
private SwitchCompat swAutoExpand;
|
||||
private SwitchCompat swExpandFirst;
|
||||
private SwitchCompat swExpandAll;
|
||||
private SwitchCompat swExpandOne;
|
||||
private SwitchCompat swAutoClose;
|
||||
@@ -92,7 +93,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
||||
"default_snooze",
|
||||
"pull", "autoscroll", "quick_filter", "quick_scroll",
|
||||
"doubletap", "swipenav", "volumenav", "reversed", "swipe_close", "swipe_move",
|
||||
"autoexpand", "expand_all", "expand_one", "collapse_multiple",
|
||||
"autoexpand", "expand_first", "expand_all", "expand_one", "collapse_multiple",
|
||||
"autoclose", "onclose", "undo_timeout",
|
||||
"autoread", "flag_snoozed", "autounflag", "auto_important", "reset_importance"
|
||||
};
|
||||
@@ -125,6 +126,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
||||
swSwipeClose = view.findViewById(R.id.swSwipeClose);
|
||||
swSwipeMove = view.findViewById(R.id.swSwipeMove);
|
||||
swAutoExpand = view.findViewById(R.id.swAutoExpand);
|
||||
swExpandFirst = view.findViewById(R.id.swExpandFirst);
|
||||
swExpandAll = view.findViewById(R.id.swExpandAll);
|
||||
swExpandOne = view.findViewById(R.id.swExpandOne);
|
||||
swCollapseMultiple = view.findViewById(R.id.swCollapseMultiple);
|
||||
@@ -288,6 +290,14 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("autoexpand", checked).apply();
|
||||
swExpandFirst.setEnabled(checked);
|
||||
}
|
||||
});
|
||||
|
||||
swExpandFirst.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("expand_first", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -459,6 +469,8 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
||||
swSwipeMove.setChecked(prefs.getBoolean("swipe_move", false));
|
||||
|
||||
swAutoExpand.setChecked(prefs.getBoolean("autoexpand", true));
|
||||
swExpandFirst.setChecked(prefs.getBoolean("expand_first", true));
|
||||
swExpandFirst.setEnabled(swAutoExpand.isChecked());
|
||||
swExpandAll.setChecked(prefs.getBoolean("expand_all", false));
|
||||
swExpandOne.setChecked(prefs.getBoolean("expand_one", true));
|
||||
swExpandOne.setEnabled(!swExpandAll.isChecked());
|
||||
|
||||
Reference in New Issue
Block a user