Enable 3-col mode on large screens

This commit is contained in:
M66B 2020-01-28 12:43:56 +01:00
parent cb5e9827c4
commit f03c4d2ba1
5 changed files with 10 additions and 5 deletions

View File

@ -175,8 +175,10 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack
else
boot.execute(this, new Bundle(), "main:accounts");
} else {
// Enable compact view on small screens
if (!getResources().getConfiguration().isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE))
// Enable 3-col mode on large screen / compact view on small screens
if (getResources().getConfiguration().isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE))
prefs.edit().putBoolean("landscape3", true).apply();
else
prefs.edit().putBoolean("compact", true).apply();
setTheme(R.style.AppThemeBlueOrangeLight);

View File

@ -226,6 +226,10 @@ public class ApplicationEx extends Application {
editor.putBoolean("resize_attachments", autoresize);
editor.remove("autoresize");
}
} else if (version < 930) {
boolean large = context.getResources().getConfiguration()
.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE);
editor.putBoolean("landscape3", large);
}
if (BuildConfig.DEBUG && false) {

View File

@ -52,7 +52,7 @@ public class DrawerLayoutEx extends DrawerLayout {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean normal = config.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL);
boolean landscape = prefs.getBoolean("landscape", true);
boolean landscape3 = prefs.getBoolean("landscape3", true);
boolean landscape3 = prefs.getBoolean("landscape3", false);
if (normal && landscape && landscape3 &&
config.orientation == Configuration.ORIENTATION_LANDSCAPE) {

View File

@ -599,7 +599,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swLandscape.setChecked(prefs.getBoolean("landscape", true));
swLandscape.setEnabled(normal);
swLandscape3.setChecked(prefs.getBoolean("landscape3", true));
swLandscape3.setChecked(prefs.getBoolean("landscape3", false));
swLandscape3.setEnabled(normal && swLandscape.isChecked());
String startup = prefs.getString("startup", "unified");

View File

@ -53,7 +53,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_landscape3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"