mirror of https://github.com/M66B/FairEmail.git
Removed normal screen limitations
This commit is contained in:
parent
73e824c3ec
commit
cbb39fa46f
|
@ -239,11 +239,20 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack
|
|||
else
|
||||
boot.execute(this, new Bundle(), "main:accounts");
|
||||
} else {
|
||||
// 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();
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
Configuration config = getResources().getConfiguration();
|
||||
|
||||
// Default enable compact mode for smaller screens
|
||||
if (!config.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE))
|
||||
editor.putBoolean("compact", true);
|
||||
|
||||
// Default disable landscape columns for small screens
|
||||
if (!config.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL)) {
|
||||
editor.putBoolean("landscape", false);
|
||||
editor.putBoolean("landscape3", false);
|
||||
}
|
||||
|
||||
editor.apply();
|
||||
|
||||
if (Helper.isNight(this))
|
||||
setTheme(R.style.AppThemeBlueOrangeDark);
|
||||
|
|
|
@ -175,20 +175,19 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
startup = prefs.getString("startup", "unified");
|
||||
|
||||
Configuration config = getResources().getConfiguration();
|
||||
final boolean normal = config.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL);
|
||||
final boolean portrait2 = prefs.getBoolean("portrait2", false);
|
||||
final boolean portrait2c = prefs.getBoolean("portrait2c", false);
|
||||
final boolean portrait3 = prefs.getBoolean("portrait3", false);
|
||||
final boolean landscape = prefs.getBoolean("landscape", true);
|
||||
final boolean landscape3 = prefs.getBoolean("landscape3", true);
|
||||
Log.i("Orientation=" + config.orientation + " normal=" + normal +
|
||||
Log.i("Orientation=" + config.orientation +
|
||||
" portrait 2=" + portrait2 + " 2c=" + portrait2c + " nav=" + portrait3 +
|
||||
" landscape 2=" + landscape + " nav=" + landscape3);
|
||||
|
||||
int viewId;
|
||||
if (config.orientation == ORIENTATION_PORTRAIT && portrait2c)
|
||||
viewId = R.layout.activity_view_landscape_split;
|
||||
else if (config.orientation == ORIENTATION_PORTRAIT || !(normal && landscape))
|
||||
else if (config.orientation == ORIENTATION_PORTRAIT || !landscape)
|
||||
viewId = (portrait2 ? R.layout.activity_view_portrait_split : R.layout.activity_view_portrait);
|
||||
else
|
||||
viewId = R.layout.activity_view_landscape_split;
|
||||
|
@ -235,9 +234,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
Log.i("Drawer opened");
|
||||
owner.start();
|
||||
|
||||
if (normal &&
|
||||
((portrait3 && config.orientation == Configuration.ORIENTATION_PORTRAIT) ||
|
||||
(landscape3 && config.orientation == Configuration.ORIENTATION_LANDSCAPE))) {
|
||||
if (((portrait3 && config.orientation == Configuration.ORIENTATION_PORTRAIT) ||
|
||||
(landscape3 && config.orientation == Configuration.ORIENTATION_LANDSCAPE))) {
|
||||
drawerLayout.setDrawerLockMode(LOCK_MODE_LOCKED_OPEN);
|
||||
childContent.setPaddingRelative(childDrawer.getLayoutParams().width, 0, 0, 0);
|
||||
}
|
||||
|
@ -252,9 +250,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
else
|
||||
owner.stop();
|
||||
|
||||
if (normal &&
|
||||
((portrait3 && config.orientation == Configuration.ORIENTATION_PORTRAIT) ||
|
||||
(landscape3 && config.orientation == Configuration.ORIENTATION_LANDSCAPE)))
|
||||
if (((portrait3 && config.orientation == Configuration.ORIENTATION_PORTRAIT) ||
|
||||
(landscape3 && config.orientation == Configuration.ORIENTATION_LANDSCAPE)))
|
||||
childContent.setPaddingRelative(
|
||||
Math.round(slideOffset * childDrawer.getLayoutParams().width), 0, 0, 0);
|
||||
}
|
||||
|
|
|
@ -505,6 +505,15 @@ public class ApplicationEx extends Application
|
|||
boolean experiments = prefs.getBoolean("experiments", false);
|
||||
if (experiments)
|
||||
editor.putBoolean("deepl_enabled", true);
|
||||
} else if (version < 1678) {
|
||||
Configuration config = context.getResources().getConfiguration();
|
||||
boolean normal = config.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL);
|
||||
if (!normal) {
|
||||
if (!prefs.contains("landscape"))
|
||||
editor.putBoolean("landscape", false);
|
||||
if (!prefs.contains("landscape3"))
|
||||
editor.putBoolean("landscape3", false);
|
||||
}
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !BuildConfig.DEBUG)
|
||||
|
|
|
@ -50,13 +50,11 @@ public class DrawerLayoutEx extends DrawerLayout {
|
|||
|
||||
void setup(Configuration config, View drawerContainer, ActionBarDrawerToggle drawerToggle) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
boolean normal = config.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL);
|
||||
boolean portrait3 = prefs.getBoolean("portrait3", false);
|
||||
boolean landscape3 = prefs.getBoolean("landscape3", true);
|
||||
|
||||
if (normal &&
|
||||
((portrait3 && config.orientation == Configuration.ORIENTATION_PORTRAIT) ||
|
||||
(landscape3 && config.orientation == Configuration.ORIENTATION_LANDSCAPE))) {
|
||||
if (((portrait3 && config.orientation == Configuration.ORIENTATION_PORTRAIT) ||
|
||||
(landscape3 && config.orientation == Configuration.ORIENTATION_LANDSCAPE))) {
|
||||
setScrimColor(Color.TRANSPARENT);
|
||||
openDrawer(drawerContainer, false);
|
||||
drawerToggle.onDrawerOpened(drawerContainer);
|
||||
|
|
|
@ -1023,9 +1023,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
private void setOptions() {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
|
||||
boolean normal = getResources().getConfiguration()
|
||||
.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL);
|
||||
|
||||
String startup = prefs.getString("startup", "unified");
|
||||
String[] startupValues = getResources().getStringArray(R.array.startupValues);
|
||||
for (int pos = 0; pos < startupValues.length; pos++)
|
||||
|
@ -1048,11 +1045,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
swPortrait2.setChecked(prefs.getBoolean("portrait2", false));
|
||||
swPortrait2c.setChecked(prefs.getBoolean("portrait2c", false) && !swPortrait2.isChecked());
|
||||
swPortrait3.setChecked(prefs.getBoolean("portrait3", false));
|
||||
swPortrait3.setEnabled(normal);
|
||||
swLandscape.setChecked(prefs.getBoolean("landscape", true));
|
||||
swLandscape.setEnabled(normal);
|
||||
swLandscape3.setChecked(prefs.getBoolean("landscape3", true));
|
||||
swLandscape3.setEnabled(normal);
|
||||
swNavMessageCount.setChecked(prefs.getBoolean("nav_count", false));
|
||||
|
||||
swThreading.setChecked(prefs.getBoolean("threading", true));
|
||||
|
|
|
@ -1712,15 +1712,25 @@ public class Log {
|
|||
long nheap = Debug.getNativeHeapAllocatedSize() / 1024L;
|
||||
sb.append(String.format("Heap usage: %s/%s KiB native: %s KiB\r\n", hused, hmax, nheap));
|
||||
|
||||
Configuration config = context.getResources().getConfiguration();
|
||||
String size;
|
||||
if (config.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_XLARGE))
|
||||
size = "XL";
|
||||
else if (config.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE))
|
||||
size = "L";
|
||||
else if (config.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL))
|
||||
size = "M";
|
||||
else if (config.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_SMALL))
|
||||
size = "M";
|
||||
else
|
||||
size = "?";
|
||||
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||
Display display = wm.getDefaultDisplay();
|
||||
Point size = new Point();
|
||||
display.getSize(size);
|
||||
Point dim = new Point();
|
||||
display.getSize(dim);
|
||||
float density = context.getResources().getDisplayMetrics().density;
|
||||
sb.append(String.format("Density %f resolution: %.2f x %.2f dp %b\r\n",
|
||||
density,
|
||||
size.x / density, size.y / density,
|
||||
context.getResources().getConfiguration().isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL)));
|
||||
sb.append(String.format("Density %f resolution: %.2f x %.2f dp %s\r\n",
|
||||
density, dim.x / density, dim.y / density, size));
|
||||
|
||||
int uiMode = context.getResources().getConfiguration().uiMode;
|
||||
sb.append(String.format("UI mode: 0x"))
|
||||
|
@ -1773,6 +1783,8 @@ public class Log {
|
|||
sb.append(String.format("UUID: %s\r\n", uuid == null ? "-" : uuid));
|
||||
}
|
||||
|
||||
sb.append(String.format("Configuration: %s\r\n", config.toString()));
|
||||
|
||||
sb.append("\r\n");
|
||||
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue