Always collapse multiple expanded messages

pull/147/head
M66B 6 years ago
parent 0904fe8caf
commit 084265a1ce

@ -2478,13 +2478,14 @@ public class FragmentMessages extends FragmentBase {
return true; return true;
} }
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); if (values.containsKey("expanded")) {
if (prefs.getBoolean("collapse", false)) SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
if (values.containsKey("expanded") && values.get("expanded").size() > 0) { if (values.get("expanded").size() > 1 || prefs.getBoolean("collapse", false)) {
values.get("expanded").clear(); values.get("expanded").clear();
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
return true; return true;
} }
}
return false; return false;
} }

@ -462,52 +462,65 @@
app:layout_constraintTop_toBottomOf="@id/swAutoExpand" /> app:layout_constraintTop_toBottomOf="@id/swAutoExpand" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoClose" android:id="@+id/swCollapse"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="12dp" android:layout_marginStart="12dp"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:layout_marginEnd="12dp" android:layout_marginEnd="12dp"
android:text="@string/title_advanced_autoclose" android:text="@string/title_advanced_collapse"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAutoExpandHint" app:layout_constraintTop_toBottomOf="@id/tvAutoExpandHint"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<TextView <TextView
android:id="@+id/tvAutoCloseHint" android:id="@+id/tvAutoCollapseHint"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="12dp" android:layout_marginStart="12dp"
android:layout_marginEnd="60dp" android:layout_marginEnd="60dp"
android:text="@string/title_advanced_autoclose_hint" android:text="@string/title_advanced_autocollapse_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic" android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoClose" /> app:layout_constraintTop_toBottomOf="@id/swCollapse" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoNext" android:id="@+id/swAutoClose"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="22dp"
android:layout_marginStart="12dp" android:layout_marginStart="12dp"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:layout_marginEnd="12dp" android:layout_marginEnd="12dp"
android:text="@string/title_advanced_autonext" android:text="@string/title_advanced_autoclose"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAutoCloseHint" app:layout_constraintTop_toBottomOf="@id/tvAutoCollapseHint"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<TextView
android:id="@+id/tvAutoCloseHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="60dp"
android:text="@string/title_advanced_autoclose_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoClose" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCollapse" android:id="@+id/swAutoNext"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="12dp" android:layout_marginStart="12dp"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:layout_marginEnd="12dp" android:layout_marginEnd="12dp"
android:text="@string/title_advanced_collapse" android:text="@string/title_advanced_autonext"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoNext" app:layout_constraintTop_toBottomOf="@id/tvAutoCloseHint"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
@ -519,7 +532,7 @@
android:layout_marginEnd="12dp" android:layout_marginEnd="12dp"
android:text="@string/title_advanced_autoread" android:text="@string/title_advanced_autoread"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swCollapse" app:layout_constraintTop_toBottomOf="@id/swAutoNext"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat

@ -141,6 +141,7 @@
<string name="title_advanced_section_misc">Miscellaneous</string> <string name="title_advanced_section_misc">Miscellaneous</string>
<string name="title_advanced_enabled">Synchronize</string> <string name="title_advanced_enabled">Synchronize</string>
<string name="title_advanced_updates">Check for updates</string>
<string name="title_advanced_metered">Use metered connections</string> <string name="title_advanced_metered">Use metered connections</string>
<string name="title_advanced_download">Automatically download messages and attachments on a metered connection up to</string> <string name="title_advanced_download">Automatically download messages and attachments on a metered connection up to</string>
@ -158,24 +159,21 @@
<string name="title_advanced_images">Automatically show images for known contacts</string> <string name="title_advanced_images">Automatically show images for known contacts</string>
<string name="title_advanced_actionbar">Conversation action bar</string> <string name="title_advanced_actionbar">Conversation action bar</string>
<string name="title_advanced_notify_preview">Show message preview in notifications</string>
<string name="title_advanced_light">Use notification light</string>
<string name="title_advanced_sound">Select notification sound</string>
<string name="title_advanced_pull_refresh">Pull down to refresh</string> <string name="title_advanced_pull_refresh">Pull down to refresh</string>
<string name="title_advanced_swipenav">Swipe left/right to go to next/previous conversation</string>
<string name="title_advanced_autoexpand">Automatically expand messages</string> <string name="title_advanced_autoexpand">Automatically expand messages</string>
<string name="title_advanced_collapse">Collapse messages in conversations on \'back\'</string>
<string name="title_advanced_autoclose">Automatically close conversations</string> <string name="title_advanced_autoclose">Automatically close conversations</string>
<string name="title_advanced_swipenav">Swipe left/right to go to next/previous conversation</string>
<string name="title_advanced_autonext">Automatically go to next conversation on close conversation</string> <string name="title_advanced_autonext">Automatically go to next conversation on close conversation</string>
<string name="title_advanced_autoread">Automatically mark messages read on moving messages</string> <string name="title_advanced_autoread">Automatically mark messages read on moving messages</string>
<string name="title_advanced_collapse">Collapse messages in conversations on \'back\'</string>
<string name="title_advanced_automove">Confirm moving messages</string> <string name="title_advanced_automove">Confirm moving messages</string>
<string name="title_advanced_confirm">Confirm actions that might leak privacy sensitive information</string>
<string name="title_advanced_autoresize">Automatically resize images for displaying on screens</string> <string name="title_advanced_autoresize">Automatically resize images for displaying on screens</string>
<string name="title_advanced_sender">Allow editing sender address</string> <string name="title_advanced_sender">Allow editing sender address</string>
<string name="title_advanced_autosend">Confirm sending messages</string> <string name="title_advanced_autosend">Confirm sending messages</string>
<string name="title_advanced_updates">Check for updates</string> <string name="title_advanced_notify_preview">Show message preview in notifications</string>
<string name="title_advanced_light">Use notification light</string>
<string name="title_advanced_sound">Select notification sound</string>
<string name="title_advanced_debug">Debug mode</string> <string name="title_advanced_debug">Debug mode</string>
<string name="title_advanced_enabled_hint">Globally disable or enable receiving and sending of messages</string> <string name="title_advanced_enabled_hint">Globally disable or enable receiving and sending of messages</string>
@ -186,6 +184,7 @@
<string name="title_advanced_name_email_hint">When disabled only names will be shown when available</string> <string name="title_advanced_name_email_hint">When disabled only names will be shown when available</string>
<string name="title_advanced_preview_hint">Only available when message text was downloaded</string> <string name="title_advanced_preview_hint">Only available when message text was downloaded</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_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_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> <string name="title_advanced_sender_hint">Most providers do not allow modified sender addresses</string>

Loading…
Cancel
Save