diff --git a/OsmAnd/src/net/osmand/AndroidUtils.java b/OsmAnd/src/net/osmand/AndroidUtils.java index f41b67710f..e27d316644 100644 --- a/OsmAnd/src/net/osmand/AndroidUtils.java +++ b/OsmAnd/src/net/osmand/AndroidUtils.java @@ -388,13 +388,18 @@ public class AndroidUtils { : ctx.getResources().getColor(R.color.text_color_secondary_light)); } - public static int getTextWidth(float textSize, String text) { Paint paint = new Paint(); paint.setTextSize(textSize); return (int) paint.measureText(text); } - + + public static int getTextHeight(Paint paint) { + Paint.FontMetrics fm = paint.getFontMetrics(); + float height = fm.bottom - fm.top; + return (int) height; + } + public static int dpToPx(Context ctx, float dp) { Resources r = ctx.getResources(); return (int) TypedValue.applyDimension( diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/AddPointBottomSheetDialog.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/AddPointBottomSheetDialog.java index f143c26163..0ede9b6514 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/AddPointBottomSheetDialog.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/AddPointBottomSheetDialog.java @@ -3,7 +3,6 @@ package net.osmand.plus.routepreparationmenu; import android.Manifest; import android.app.Activity; import android.content.Intent; -import android.content.pm.PackageManager; import android.graphics.Color; import android.graphics.Typeface; import android.os.Bundle; @@ -550,6 +549,15 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment { view.setOnClickListener(listener); Activity activity = getActivity(); if (activity != null) { + TextView title = view.findViewById(R.id.title); + TextView description = view.findViewById(R.id.description); + + int titleHeight = AndroidUtils.getTextHeight(title.getPaint()); + int descriptionHeight = AndroidUtils.getTextHeight(description.getPaint()); + int minTextHeight = titleHeight + descriptionHeight * 2; + if (view.getHeight() < minTextHeight) { + view.setMinimumHeight(minTextHeight); + } RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) view.getLayoutParams(); if (AndroidUiHelper.isOrientationPortrait(getActivity())) { layoutParams.width = (int) (AndroidUtils.getScreenWidth(activity) / 2.5);