Added option to change message column width

This commit is contained in:
M66B
2022-02-03 09:09:39 +01:00
parent 575348354a
commit 3453080f7f
8 changed files with 93 additions and 12 deletions

View File

@@ -75,6 +75,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swLandscape;
private Spinner spLandscapeMinSize;
private SwitchCompat swClosePane;
private TextView tvColumnWidth;
private SeekBar sbColumnWidth;
private SwitchCompat swNavOptions;
private SwitchCompat swNavMessageCount;
private SwitchCompat swNavUnseenDrafts;
@@ -168,7 +170,7 @@ 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",
"group_category", "date", "date_fixed", "date_bold",
"portrait2", "portrait2c", "landscape", "close_pane",
"portrait2", "portrait2c", "landscape", "close_pane", "column_width",
"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",
@@ -213,6 +215,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swLandscape = view.findViewById(R.id.swLandscape);
spLandscapeMinSize = view.findViewById(R.id.spLandscapeMinSize);
swClosePane = view.findViewById(R.id.swClosePane);
tvColumnWidth = view.findViewById(R.id.tvColumnWidth);
sbColumnWidth = view.findViewById(R.id.sbColumnWidth);
swNavOptions = view.findViewById(R.id.swNavOptions);
swNavMessageCount = view.findViewById(R.id.swNavMessageCount);
swNavUnseenDrafts = view.findViewById(R.id.swNavUnseenDrafts);
@@ -458,6 +462,28 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
sbColumnWidth.setEnabled(!Helper.isSurfaceDuo());
sbColumnWidth.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (progress < 10)
progress = 10;
if (progress > 90)
progress = 90;
prefs.edit().putInt("column_width", progress).apply();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// Do nothing
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// Do nothing
}
});
swNavOptions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -1169,6 +1195,11 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swLandscape.setChecked(prefs.getBoolean("landscape", true));
spLandscapeMinSize.setSelection(prefs.getInt("landscape_min_size", 0));
swClosePane.setChecked(prefs.getBoolean("close_pane", !Helper.isSurfaceDuo()));
int column_width = prefs.getInt("column_width", 67);
tvColumnWidth.setText(getString(R.string.title_advanced_column_width, NF.format(column_width)));
sbColumnWidth.setProgress(column_width);
swNavOptions.setChecked(prefs.getBoolean("nav_options", true));
swNavMessageCount.setChecked(prefs.getBoolean("nav_count", false));
swNavUnseenDrafts.setChecked(prefs.getBoolean("nav_unseen_drafts", false));