diff --git a/app/src/main/java/eu/faircode/email/ActivityView.java b/app/src/main/java/eu/faircode/email/ActivityView.java index 419888848c..5e20eec50b 100644 --- a/app/src/main/java/eu/faircode/email/ActivityView.java +++ b/app/src/main/java/eu/faircode/email/ActivityView.java @@ -1032,15 +1032,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB if (nav_pinned) return getDrawerWidthPinned(); else { + int actionBarHeight = Helper.getActionBarHeight(this); DisplayMetrics dm = getResources().getDisplayMetrics(); - - int actionBarHeight; - TypedValue tv = new TypedValue(); - if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) - actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, dm); - else - actionBarHeight = Helper.dp2pixels(this, 56); - int screenWidth = Math.min(dm.widthPixels, dm.heightPixels); // Screen width 320 - action bar 56 = 264 dp // Icons 6 x (24 width + 2x6 padding) = 216 dp diff --git a/app/src/main/java/eu/faircode/email/Helper.java b/app/src/main/java/eu/faircode/email/Helper.java index 5cf215a8cf..5249096dc6 100644 --- a/app/src/main/java/eu/faircode/email/Helper.java +++ b/app/src/main/java/eu/faircode/email/Helper.java @@ -62,6 +62,7 @@ import android.text.Spannable; import android.text.TextUtils; import android.text.format.DateUtils; import android.text.format.Time; +import android.util.DisplayMetrics; import android.util.TypedValue; import android.view.KeyEvent; import android.view.LayoutInflater; @@ -612,6 +613,17 @@ public class Helper { // View + static int getActionBarHeight(Context context) { + int actionBarHeight; + TypedValue tv = new TypedValue(); + if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) { + DisplayMetrics dm = context.getResources().getDisplayMetrics(); + return TypedValue.complexToDimensionPixelSize(tv.data, dm); + } + else + return Helper.dp2pixels(context, 56); + } + static Intent getChooser(Context context, Intent intent) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) { PackageManager pm = context.getPackageManager();