From 2bd2839f495cde38c94748553dad521a4e9c5d05 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 28 Jan 2021 15:32:21 +0200 Subject: [PATCH] Fix context menu visibility --- .../controllers/SelectedGpxMenuController.java | 1 + .../net/osmand/plus/track/TrackMenuFragment.java | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/SelectedGpxMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/SelectedGpxMenuController.java index acdce38b90..5ea0766469 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/SelectedGpxMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/SelectedGpxMenuController.java @@ -42,6 +42,7 @@ public class SelectedGpxMenuController extends MenuController { leftTitleButtonController = new TitleButtonController() { @Override public void buttonPressed() { + mapContextMenu.hide(false); TrackMenuFragment.showInstance(mapActivity, selectedGpxPoint.getSelectedGpxFile()); } }; diff --git a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java index 597dc4c485..0c7c88b7a3 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java @@ -230,11 +230,18 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card if (getCurrentMenuState() != MenuState.HEADER_ONLY && isPortrait()) { openMenuHeaderOnly(); } else { - MapActivity mapActivity = getMapActivity(); - if (mapActivity != null && mapActivity.getSupportFragmentManager().getBackStackEntryCount() == 1) { - mapActivity.launchPrevActivityIntent(); - } dismiss(); + + MapActivity mapActivity = getMapActivity(); + if (mapActivity != null) { + MapContextMenu contextMenu = mapActivity.getContextMenu(); + if (contextMenu.isActive() && contextMenu.getPointDescription() != null + && contextMenu.getPointDescription().isGpxPoint()) { + contextMenu.show(); + } else { + mapActivity.launchPrevActivityIntent(); + } + } } } });