From ce334f1b7c770b722cc1e2b9ff80940709e5d2eb Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Wed, 27 Jan 2016 12:02:58 +0300 Subject: [PATCH] Fix https://github.com/osmandapp/Osmand/issues/2078 --- .../mapcontextmenu/MapContextMenuFragment.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java index 3a295e79de..d6aea8dd3f 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java @@ -76,6 +76,8 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents { private int menuBottomViewHeight; private int menuFullHeight; private int menuFullHeightMax; + private int menuTopViewHeightExcludingTitle; + private int menuTitleTopBottomPadding; private int screenHeight; private int viewHeight; @@ -717,8 +719,19 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents { menuFullHeight = view.findViewById(R.id.context_menu_main).getHeight(); int dy = 0; - if (!menu.isLandscapeLayout() && menuTopViewHeight != 0) { - dy = Math.max(0, newMenuTopViewHeight - menuTopViewHeight - (newMenuTopShadowAllHeight - menuTopShadowAllHeight)); + if (!menu.isLandscapeLayout()) { + TextView line1 = (TextView) view.findViewById(R.id.context_menu_line1); + if (menuTopViewHeight != 0) { + int titleHeight = line1.getLineCount() * line1.getLineHeight() + menuTitleTopBottomPadding; + if (titleHeight < line1.getMeasuredHeight()) { + titleHeight = line1.getMeasuredHeight(); + } + newMenuTopViewHeight = menuTopViewHeightExcludingTitle + titleHeight; + dy = Math.max(0, newMenuTopViewHeight - menuTopViewHeight - (newMenuTopShadowAllHeight - menuTopShadowAllHeight)); + } else { + menuTopViewHeightExcludingTitle = newMenuTopViewHeight - line1.getMeasuredHeight(); + menuTitleTopBottomPadding = line1.getMeasuredHeight() - line1.getLineCount() * line1.getLineHeight(); + } } menuTopViewHeight = newMenuTopViewHeight; menuTopShadowAllHeight = newMenuTopShadowAllHeight;