Added two row portrait mode

pull/183/head
M66B 5 years ago
parent dcd280e3a5
commit 704b65c229

@ -154,6 +154,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
Configuration config = getResources().getConfiguration();
final boolean normal = config.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL);
final boolean portrait2 = prefs.getBoolean("portrait2", false);
final boolean landscape = prefs.getBoolean("landscape", true);
final boolean landscape3 = prefs.getBoolean("landscape3", true);
Log.i("Orientation=" + config.orientation + " normal=" + normal +
@ -161,7 +162,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
boolean portrait = (config.orientation == ORIENTATION_PORTRAIT || !normal || !landscape);
view = LayoutInflater.from(this).inflate(portrait
? R.layout.activity_view_portrait
? (portrait2 ? R.layout.activity_view_portrait_split : R.layout.activity_view_portrait)
: R.layout.activity_view_landscape, null);
setContentView(view);

@ -78,7 +78,7 @@ public class FragmentOptions extends FragmentBase {
static String[] OPTIONS_RESTART = new String[]{
"first", "app_support", "notify_archive", "message_swipe", "message_select", "folder_actions", "folder_sync",
"subscriptions",
"landscape", "landscape3", "startup", "cards", "indentation", "date", "threading", "threading_unread",
"portrait2", "landscape", "landscape3", "startup", "cards", "indentation", "date", "threading", "threading_unread",
"highlight_unread", "color_stripe",
"avatars", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
"name_email", "prefer_contact", "distinguish_contacts", "show_recipients", "authentication",

@ -60,6 +60,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swCards;
private SwitchCompat swDate;
private SwitchCompat swNavBarColorize;
private SwitchCompat swPortrait2;
private SwitchCompat swLandscape;
private SwitchCompat swLandscape3;
@ -120,7 +121,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swAuthentication;
private final static String[] RESET_OPTIONS = new String[]{
"theme", "startup", "cards", "date", "navbar_colorize", "landscape", "landscape3",
"theme", "startup", "cards", "date", "navbar_colorize", "portrait2", "landscape", "landscape3",
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_color",
"highlight_unread", "color_stripe",
"avatars", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
@ -149,6 +150,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swCards = view.findViewById(R.id.swCards);
swDate = view.findViewById(R.id.swDate);
swNavBarColorize = view.findViewById(R.id.swNavBarColorize);
swPortrait2 = view.findViewById(R.id.swPortrait2);
swLandscape = view.findViewById(R.id.swLandscape);
swLandscape3 = view.findViewById(R.id.swLandscape3);
@ -255,6 +257,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swPortrait2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("portrait2", checked).apply();
}
});
swLandscape.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -748,6 +757,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swCards.setChecked(prefs.getBoolean("cards", true));
swDate.setChecked(prefs.getBoolean("date", true));
swNavBarColorize.setChecked(prefs.getBoolean("navbar_colorize", false));
swPortrait2.setChecked(prefs.getBoolean("portrait2", false));
swLandscape.setChecked(prefs.getBoolean("landscape", true));
swLandscape.setEnabled(normal);
swLandscape3.setChecked(prefs.getBoolean("landscape3", false));

@ -0,0 +1,47 @@
<eu.faircode.email.DrawerLayoutEx xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="eu.faircode.email.ActivityView">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="false"
android:focusableInTouchMode="false"
android:orientation="vertical">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2" />
<View
android:id="@+id/content_separator"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/colorSeparator" />
<FrameLayout
android:id="@+id/content_pane"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/drawer_container"
android:layout_width="270dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="?attr/colorDrawerBackground"
android:orientation="vertical">
<include
layout="@layout/include_nav"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</androidx.core.widget.NestedScrollView>
</eu.faircode.email.DrawerLayoutEx>

@ -145,6 +145,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNavBarColorize" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swPortrait2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_portrait2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvNavBarColorizeHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swLandscape"
android:layout_width="0dp"
@ -154,7 +166,7 @@
android:text="@string/title_advanced_landscape"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvNavBarColorizeHint"
app:layout_constraintTop_toBottomOf="@id/swPortrait2"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -318,6 +318,7 @@
<string name="title_advanced_caption_message_header">Message header</string>
<string name="title_advanced_caption_message_body">Message body</string>
<string name="title_advanced_portrait2">Use two rows in portrait mode</string>
<string name="title_advanced_landscape">Use two columns in landscape mode</string>
<string name="title_advanced_landscape3">Show navigation menu in landscape mode by default</string>
<string name="title_advanced_startup">Show on start screen</string>

Loading…
Cancel
Save