Added option to collapse row/column on closing conversation

This commit is contained in:
M66B 2021-12-27 12:53:49 +01:00
parent 43c2d0fe6a
commit 04271c6286
4 changed files with 29 additions and 4 deletions

View File

@ -1110,10 +1110,11 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
drawerToggle.setDrawerIndicatorEnabled(count == 1);
if (content_pane != null) {
boolean duo = Helper.isSurfaceDuo();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean close_pane = prefs.getBoolean("close_pane", !Helper.isSurfaceDuo());
boolean thread = "thread".equals(getSupportFragmentManager().getBackStackEntryAt(count - 1).getName());
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.content_pane);
int visibility = (!thread || fragment == null ? (duo ? View.INVISIBLE : View.GONE) : View.VISIBLE);
int visibility = (!thread || fragment == null ? (close_pane ? View.GONE : View.INVISIBLE) : View.VISIBLE);
content_separator.setVisibility(visibility);
content_pane.setVisibility(visibility);
}

View File

@ -73,6 +73,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private Spinner spPortraitMinSize;
private SwitchCompat swLandscape;
private Spinner spLandscapeMinSize;
private SwitchCompat swClosePane;
private SwitchCompat swNavOptions;
private SwitchCompat swNavMessageCount;
private SwitchCompat swNavUnseenDrafts;
@ -166,7 +167,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private final static String[] RESET_OPTIONS = new String[]{
"theme", "startup", "cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_highlight",
"date", "date_fixed", "date_bold",
"portrait2", "portrait2c", "landscape", "nav_options", "nav_count", "nav_unseen_drafts", "navbar_colorize",
"portrait2", "portrait2c", "landscape", "close_pane",
"nav_options", "nav_count", "nav_unseen_drafts", "navbar_colorize",
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_color",
"highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide",
"avatars", "bimi", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
@ -208,6 +210,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
spPortraitMinSize = view.findViewById(R.id.spPortraitMinSize);
swLandscape = view.findViewById(R.id.swLandscape);
spLandscapeMinSize = view.findViewById(R.id.spLandscapeMinSize);
swClosePane = view.findViewById(R.id.swClosePane);
swNavOptions = view.findViewById(R.id.swNavOptions);
swNavMessageCount = view.findViewById(R.id.swNavMessageCount);
swNavUnseenDrafts = view.findViewById(R.id.swNavUnseenDrafts);
@ -439,6 +442,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swClosePane.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("close_pane", checked).apply();
}
});
swNavOptions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -1145,6 +1155,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
spPortraitMinSize.setSelection(prefs.getInt("portrait_min_size", 0));
swLandscape.setChecked(prefs.getBoolean("landscape", true));
spLandscapeMinSize.setSelection(prefs.getInt("landscape_min_size", 0));
swClosePane.setChecked(prefs.getBoolean("close_pane", !Helper.isSurfaceDuo()));
swNavOptions.setChecked(prefs.getBoolean("nav_options", true));
swNavMessageCount.setChecked(prefs.getBoolean("nav_count", false));
swNavUnseenDrafts.setChecked(prefs.getBoolean("nav_unseen_drafts", false));

View File

@ -409,6 +409,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spLandscapeMinSize" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swClosePane"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_close_pane"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvLandscapeSplitMinHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNavOptions"
android:layout_width="0dp"
@ -417,7 +429,7 @@
android:text="@string/title_advanced_nav_options"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvLandscapeSplitMinHint"
app:layout_constraintTop_toBottomOf="@id/swClosePane"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

View File

@ -432,6 +432,7 @@
<string name="title_advanced_two_row">Use two rows</string>
<string name="title_advanced_two_col">Use two columns</string>
<string name="title_advanced_min_screen_size">Minimum screen size for splitting the screen</string>
<string name="title_advanced_close_pane">Collapse row or column when closing a conversation</string>
<string name="title_advanced_nav_options">Show navigation menu options</string>
<string name="title_advanced_nav_pin">Pin navigation menu</string>
<string name="title_advanced_nav_hide_title">Hide navigation menu options?</string>