Added option to collapse messages in conversations on back

pull/147/head
M66B 6 years ago
parent e5f8c54ba8
commit 9897b63204

@ -1947,11 +1947,13 @@ public class FragmentMessages extends FragmentEx {
return true;
}
if (expanded.size() > 1) {
expanded.clear();
adapter.notifyDataSetChanged();
return true;
}
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
if (prefs.getBoolean("collapse", false))
if (expanded.size() > 0) {
expanded.clear();
adapter.notifyDataSetChanged();
return true;
}
return false;
}

@ -74,6 +74,7 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
private SwitchCompat swSwipe;
private SwitchCompat swActionbar;
private SwitchCompat swAutoclose;
private SwitchCompat swCollapse;
private SwitchCompat swConfirm;
private SwitchCompat swSender;
@ -111,6 +112,7 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
swSwipe = view.findViewById(R.id.swSwipe);
swActionbar = view.findViewById(R.id.swActionbar);
swAutoclose = view.findViewById(R.id.swAutoclose);
swCollapse = view.findViewById(R.id.swCollapse);
swConfirm = view.findViewById(R.id.swConfirm);
swSender = view.findViewById(R.id.swSender);
@ -303,6 +305,14 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
}
});
swCollapse.setChecked(prefs.getBoolean("collapse", false));
swCollapse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("collapse", checked).apply();
}
});
swConfirm.setChecked(prefs.getBoolean("confirm", false));
swConfirm.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override

@ -346,6 +346,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoclose" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCollapse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="12dp"
android:text="@string/title_advanced_collapse"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAutocloseHint" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swConfirm"
android:layout_width="match_parent"
@ -355,7 +366,7 @@
android:layout_marginEnd="12dp"
android:text="@string/title_advanced_confirm"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAutocloseHint" />
app:layout_constraintTop_toBottomOf="@id/swCollapse" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSender"

@ -124,6 +124,7 @@
<string name="title_advanced_swipe">Swipe actions</string>
<string name="title_advanced_actionbar">Conversation action bar</string>
<string name="title_advanced_autoclose">Automatically close conversations</string>
<string name="title_advanced_collapse">Collapse messages in conversations on \'back\'</string>
<string name="title_advanced_confirm">Confirm actions that might leak privacy sensitive information</string>
<string name="title_advanced_sender">Allow editing sender address</string>
<string name="title_advanced_download">Automatically download messages and attachments on a metered connection up to</string>

Loading…
Cancel
Save