1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-27 10:17:18 +00:00

Make sure unpinning is possible

This commit is contained in:
M66B 2021-08-12 15:34:29 +02:00
parent 7e270b0c78
commit d5b95d4eee

View file

@ -910,12 +910,14 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
private int getDrawerWidth() {
if (!nav_expanded)
return Helper.dp2pixels(this, 48);
return Helper.dp2pixels(this, 48); // One icon + padding
DisplayMetrics dm = getResources().getDisplayMetrics();
if (nav_pinned) {
int maxWidth = dm.widthPixels - Helper.dp2pixels(this, 300);
return Math.min(Helper.dp2pixels(this, 300), maxWidth);
int minWidth = Helper.dp2pixels(this, 72); // Make sure unpinning is possible
int dp300 = Helper.dp2pixels(this, 300);
int maxWidth = dm.widthPixels - dp300;
return Math.max(Math.min(dp300, maxWidth), minWidth);
} else {
int actionBarHeight;
TypedValue tv = new TypedValue();