mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-30 21:58:52 +02:00
Added option for fixed nav menu in portrait mode
This commit is contained in:
@@ -177,9 +177,12 @@ 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 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 +
|
||||
" normal=" + normal +
|
||||
" portrait=" + portrait2 + "/" + portrait3 +
|
||||
" landscape=" + landscape + "/" + landscape3);
|
||||
|
||||
int viewId;
|
||||
@@ -230,8 +233,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
||||
Log.i("Drawer opened");
|
||||
owner.start();
|
||||
|
||||
if (normal && landscape3 &&
|
||||
config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
if (normal &&
|
||||
((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);
|
||||
}
|
||||
@@ -246,8 +250,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
||||
else
|
||||
owner.stop();
|
||||
|
||||
if (normal && landscape3 &&
|
||||
config.orientation == Configuration.ORIENTATION_LANDSCAPE)
|
||||
if (normal &&
|
||||
((portrait3 && config.orientation == Configuration.ORIENTATION_PORTRAIT) ||
|
||||
(landscape3 && config.orientation == Configuration.ORIENTATION_LANDSCAPE)))
|
||||
childContent.setPaddingRelative(
|
||||
Math.round(slideOffset * childDrawer.getLayoutParams().width), 0, 0, 0);
|
||||
}
|
||||
@@ -258,7 +263,11 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
||||
|
||||
int drawerWidth;
|
||||
DisplayMetrics dm = getResources().getDisplayMetrics();
|
||||
if (viewId != R.layout.activity_view_landscape_split || !landscape3) {
|
||||
if (viewId == R.layout.activity_view_landscape_split && landscape3)
|
||||
drawerWidth = Helper.dp2pixels(this, 300);
|
||||
else if (viewId != R.layout.activity_view_landscape_split && portrait3)
|
||||
drawerWidth = Math.min(Helper.dp2pixels(this, 300), dm.widthPixels / 2);
|
||||
else {
|
||||
int actionBarHeight;
|
||||
TypedValue tv = new TypedValue();
|
||||
if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))
|
||||
@@ -269,8 +278,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
||||
int screenWidth = Math.min(dm.widthPixels, dm.heightPixels);
|
||||
int dp320 = Helper.dp2pixels(this, 320);
|
||||
drawerWidth = Math.min(screenWidth - actionBarHeight, dp320);
|
||||
} else
|
||||
drawerWidth = Helper.dp2pixels(this, 300);
|
||||
}
|
||||
|
||||
ViewGroup.LayoutParams lparam = drawerContainer.getLayoutParams();
|
||||
lparam.width = drawerWidth;
|
||||
|
||||
Reference in New Issue
Block a user