From 654ce8fa457b769d7802cfdd8f1c46d1afb28ebc Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Wed, 11 Oct 2017 14:59:21 +0300 Subject: [PATCH] Fix context menu margin --- .../plus/mapcontextmenu/MapContextMenuFragment.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java index 7fd532ccf2..3f83428f8c 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java @@ -889,26 +889,31 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents { } int dp16 = dpToPx(16f); + boolean has16margin = false; int titleButtonHeight = 0; View titleButtonContainer = view.findViewById(R.id.title_button_container); if (titleButtonContainer.getVisibility() == View.VISIBLE) { titleButtonHeight = titleButtonContainer.getMeasuredHeight() - dp16; if (titleButtonHeight < 0) { titleButtonHeight = 0; + } else { + has16margin = true; } } int downloadButtonsHeight = 0; View downloadButtonsContainer = view.findViewById(R.id.download_buttons_container); if (downloadButtonsContainer.getVisibility() == View.VISIBLE) { - downloadButtonsHeight = downloadButtonsContainer.getMeasuredHeight() - dp16; + downloadButtonsHeight = downloadButtonsContainer.getMeasuredHeight() - (has16margin ? 0 : dp16); if (downloadButtonsHeight < 0) { downloadButtonsHeight = 0; + } else { + has16margin = true; } } int titleProgressHeight = 0; View titleProgressContainer = view.findViewById(R.id.title_progress_container); if (titleProgressContainer.getVisibility() == View.VISIBLE) { - titleProgressHeight = titleProgressContainer.getMeasuredHeight() - dp16; + titleProgressHeight = titleProgressContainer.getMeasuredHeight() - (has16margin ? 0 : dp16); if (titleProgressHeight < 0) { titleProgressHeight = 0; }