Added option to change message column width

pull/194/merge
M66B 3 years ago
parent 575348354a
commit 3453080f7f

@ -2,6 +2,11 @@
🌎 [Google Translate](https://translate.google.com/translate?sl=en&u=https://github.com/M66B/FairEmail/blob/master/CHANGELOG.md)
### Next version
* Added slider to change message column width
* Small improvements and minor bug fixes
### [Epidexipteryx](https://en.wikipedia.org/wiki/Epidexipteryx)
### 1.1830 - 2022-02-02

@ -2,6 +2,11 @@
🌎 [Google Translate](https://translate.google.com/translate?sl=en&u=https://github.com/M66B/FairEmail/blob/master/CHANGELOG.md)
### Next version
* Added slider to change message column width
* Small improvements and minor bug fixes
### [Epidexipteryx](https://en.wikipedia.org/wiki/Epidexipteryx)
### 1.1830 - 2022-02-02

@ -220,6 +220,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
Log.i("Orientation=" + config.orientation + " layout=" + layout +
" portrait rows=" + portrait2 + " cols=" + portrait2c + " min=" + portrait_min_size +
" landscape cols=" + landscape + " min=" + landscape);
boolean duo = Helper.isSurfaceDuo();
// 1=small, 2=normal, 3=large, 4=xlarge
if (layout > 0)
@ -244,17 +245,26 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
content_separator = findViewById(R.id.content_separator);
content_pane = findViewById(R.id.content_pane);
// Special: Surface Duo
boolean duo = Helper.isSurfaceDuo();
if (duo && content_pane != null) {
View content_frame = findViewById(R.id.content_frame);
ViewGroup.LayoutParams lparam = content_frame.getLayoutParams();
if (lparam instanceof LinearLayout.LayoutParams) {
((LinearLayout.LayoutParams) lparam).weight = 1; // 50/50
content_frame.setLayoutParams(lparam);
if (content_pane != null) {
// Special: Surface Duo
if (duo) {
View content_frame = findViewById(R.id.content_frame);
ViewGroup.LayoutParams lparam = content_frame.getLayoutParams();
if (lparam instanceof LinearLayout.LayoutParams) {
((LinearLayout.LayoutParams) lparam).weight = 1; // 50/50
content_frame.setLayoutParams(lparam);
}
// https://docs.microsoft.com/en-us/dual-screen/android/duo-dimensions
content_separator.getLayoutParams().width = Helper.dp2pixels(this, 34);
} else {
int column_width = prefs.getInt("column_width", 67);
ViewGroup.LayoutParams lparam = content_pane.getLayoutParams();
if (lparam instanceof LinearLayout.LayoutParams) {
((LinearLayout.LayoutParams) lparam).weight =
(float) (100 - column_width) / column_width * 2;
content_pane.setLayoutParams(lparam);
}
}
// https://docs.microsoft.com/en-us/dual-screen/android/duo-dimensions
content_separator.getLayoutParams().width = Helper.dp2pixels(this, 34);
}
owner = new TwoStateOwner(this, "drawer");

@ -133,6 +133,7 @@ public class FragmentOptions extends FragmentBase {
"send_pending",
"startup", "cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_highlight",
"portrait2", "portrait2c", "portrait_min_size", "landscape", "landscape_min_size",
"column_width",
"nav_count", "nav_unseen_drafts", "navbar_colorize",
"indentation", "group_category", "date", "date_fixed", "date_bold", "threading", "threading_unread",
"highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide",

@ -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));

@ -433,6 +433,29 @@
app:layout_constraintTop_toBottomOf="@id/tvLandscapeSplitMinHint"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvColumnWidth"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_column_width"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swClosePane" />
<SeekBar
android:id="@+id/sbColumnWidth"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:max="100"
android:min="0"
android:progress="66"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvColumnWidth" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNavOptions"
android:layout_width="0dp"
@ -441,7 +464,7 @@
android:text="@string/title_advanced_nav_options"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swClosePane"
app:layout_constraintTop_toBottomOf="@id/sbColumnWidth"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -437,6 +437,7 @@
<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_column_width">Message column width: %1$s %%</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>

@ -2,6 +2,11 @@
&#x1F30E; [Google Translate](https://translate.google.com/translate?sl=en&u=https://github.com/M66B/FairEmail/blob/master/CHANGELOG.md)
### Next version
* Added slider to change message column width
* Small improvements and minor bug fixes
### [Epidexipteryx](https://en.wikipedia.org/wiki/Epidexipteryx)
### 1.1830 - 2022-02-02

Loading…
Cancel
Save