diff --git a/app/src/main/java/eu/faircode/email/ToastEx.java b/app/src/main/java/eu/faircode/email/ToastEx.java index b87ee0e20b..fbdfb37620 100644 --- a/app/src/main/java/eu/faircode/email/ToastEx.java +++ b/app/src/main/java/eu/faircode/email/ToastEx.java @@ -49,9 +49,18 @@ public class ToastEx extends Toast { tv.setText(text); toast.setView(view); toast.setDuration(duration); + // 56dp - int dp = Helper.dp2pixels(context, 2 * 56); - toast.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, dp); + int resId = context.getResources().getIdentifier( + "design_bottom_navigation_height", "dimen", context.getPackageName()); + int px = Helper.dp2pixels(context, 2 * 56); + if (resId > 0) + try { + px = 2 * context.getResources().getDimensionPixelSize(resId); + } catch (Throwable ex) { + Log.e(ex); + } + toast.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, px); return toast; }