From f14a84dc19d06efd587a61dbef7fcaf0a27816f6 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Wed, 31 Jan 2018 20:53:53 +0300 Subject: [PATCH] Fix context menu landscape layout --- .../MapContextMenuFragment.java | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java index 74393e70fd..3300b84cc5 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java @@ -605,13 +605,15 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo private float getToolbarAlpha(int y) { float a = 0; - if (y < minHalfY) { - a = 1f - (y - bottomToolbarPosY) * (1f / (minHalfY - bottomToolbarPosY)); - } - if (a < 0) { - a = 0; - } else if (a > 1) { - a = 1; + if (menu != null && !menu.isLandscapeLayout()) { + if (y < minHalfY) { + a = 1f - (y - bottomToolbarPosY) * (1f / (minHalfY - bottomToolbarPosY)); + } + if (a < 0) { + a = 0; + } else if (a > 1) { + a = 1; + } } return a; } @@ -623,14 +625,16 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo private float getTopButtonAlpha(int y) { float a = 0; - int headerTopY = getHeaderOnlyTopY(); - if (y < headerTopY) { - a = 1f - (y - minHalfY) * (1f / (headerTopY - minHalfY)); - } - if (a < 0) { - a = 0; - } else if (a > 1) { - a = 1; + if (menu != null && !menu.isLandscapeLayout()) { + int headerTopY = getHeaderOnlyTopY(); + if (y < headerTopY) { + a = 1f - (y - minHalfY) * (1f / (headerTopY - minHalfY)); + } + if (a < 0) { + a = 0; + } else if (a > 1) { + a = 1; + } } return a; }