mirror of https://github.com/M66B/FairEmail.git
Revised collapse on back
This commit is contained in:
parent
9b4ae5aaa6
commit
07ec7b9e8b
|
@ -3601,8 +3601,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
|
||||
int count = (values.containsKey("expanded") ? values.get("expanded").size() : 0);
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
boolean collapse = prefs.getBoolean("collapse", false);
|
||||
if ((count == 1 && collapse) || count > 1) {
|
||||
boolean collapse_single = prefs.getBoolean("collapse_single", false);
|
||||
boolean collapse_multiple = prefs.getBoolean("collapse_multiple", true);
|
||||
if ((collapse_single && count == 1) || (collapse_multiple && count > 1)) {
|
||||
values.get("expanded").clear();
|
||||
updateExpanded();
|
||||
adapter.notifyDataSetChanged();
|
||||
|
|
|
@ -49,7 +49,8 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
private SwitchCompat swExpandOne;
|
||||
private SwitchCompat swAutoClose;
|
||||
private Spinner spOnClose;
|
||||
private SwitchCompat swCollapse;
|
||||
private SwitchCompat swCollapseSingle;
|
||||
private SwitchCompat swCollapseMultiple;
|
||||
private SwitchCompat swAutoRead;
|
||||
private SwitchCompat swAutoUnflag;
|
||||
private SwitchCompat swAutoMove;
|
||||
|
@ -57,7 +58,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"pull", "autoscroll", "doubletap", "swipenav", "reversed", "autoexpand", "expand_one", "autoclose", "onclose",
|
||||
"collapse", "autoread", "autounflag", "automove", "discard_delete"
|
||||
"collapse_single", "collapse_multiple", "autoread", "autounflag", "automove", "discard_delete"
|
||||
};
|
||||
|
||||
@Override
|
||||
|
@ -79,7 +80,8 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
swExpandOne = view.findViewById(R.id.swExpandOne);
|
||||
swAutoClose = view.findViewById(R.id.swAutoClose);
|
||||
spOnClose = view.findViewById(R.id.spOnClose);
|
||||
swCollapse = view.findViewById(R.id.swCollapse);
|
||||
swCollapseSingle = view.findViewById(R.id.swCollapseSingle);
|
||||
swCollapseMultiple = view.findViewById(R.id.swCollapseMultiple);
|
||||
swAutoRead = view.findViewById(R.id.swAutoRead);
|
||||
swAutoUnflag = view.findViewById(R.id.swAutoUnflag);
|
||||
swAutoMove = view.findViewById(R.id.swAutoMove);
|
||||
|
@ -165,10 +167,17 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
}
|
||||
});
|
||||
|
||||
swCollapse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
swCollapseSingle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("collapse", checked).apply();
|
||||
prefs.edit().putBoolean("collapse_single", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swCollapseMultiple.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("collapse_multiple", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -265,7 +274,8 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
|
||||
spOnClose.setEnabled(!swAutoClose.isChecked());
|
||||
|
||||
swCollapse.setChecked(prefs.getBoolean("collapse", false));
|
||||
swCollapseSingle.setChecked(prefs.getBoolean("collapse_single", false));
|
||||
swCollapseMultiple.setChecked(prefs.getBoolean("collapse_multiple", true));
|
||||
swAutoRead.setChecked(prefs.getBoolean("autoread", false));
|
||||
swAutoUnflag.setChecked(prefs.getBoolean("autounflag", false));
|
||||
swAutoMove.setChecked(!prefs.getBoolean("automove", false));
|
||||
|
|
|
@ -105,27 +105,26 @@
|
|||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swCollapse"
|
||||
android:id="@+id/swCollapseSingle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_collapse"
|
||||
android:text="@string/title_advanced_collapse_single"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swExpandOne"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAutoCollapseHint"
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swCollapseMultiple"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="@string/title_advanced_autocollapse_hint"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textStyle="italic"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_collapse_multiple"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swCollapse" />
|
||||
app:layout_constraintTop_toBottomOf="@id/swCollapseSingle"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swAutoClose"
|
||||
|
@ -136,7 +135,7 @@
|
|||
android:text="@string/title_advanced_autoclose"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAutoCollapseHint"
|
||||
app:layout_constraintTop_toBottomOf="@id/swCollapseMultiple"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -276,7 +276,8 @@
|
|||
<string name="title_advanced_reversed">Reverse navigation direction</string>
|
||||
<string name="title_advanced_autoexpand">Automatically expand messages</string>
|
||||
<string name="title_advanced_expand_one">Expand only one message at a time</string>
|
||||
<string name="title_advanced_collapse">Collapse messages in conversations on \'back\'</string>
|
||||
<string name="title_advanced_collapse_single">Collapse single message in a conversation on \'back\'</string>
|
||||
<string name="title_advanced_collapse_multiple">Collapse multiple messages in a conversation on \'back\'</string>
|
||||
<string name="title_advanced_autoclose">Automatically close conversations</string>
|
||||
<string name="title_advanced_onclose">On closing a conversation</string>
|
||||
<string name="title_advanced_autoread">Automatically mark messages read on moving messages</string>
|
||||
|
@ -355,7 +356,6 @@
|
|||
<string name="title_advanced_inline_hint">Inline images are images included in the message</string>
|
||||
|
||||
<string name="title_advanced_autoexpand_hint">Automatically open message when there is just one message or just one unread message in a conversation</string>
|
||||
<string name="title_advanced_autocollapse_hint">Multiple expanded messages will always be closed on \'back\'</string>
|
||||
<string name="title_advanced_autoclose_hint">Automatically close conversations when all messages are archived, sent or trashed</string>
|
||||
<string name="title_advanced_sender_hint">Most providers do not allow modified sender addresses</string>
|
||||
|
||||
|
|
Loading…
Reference in New Issue