From d2aa6c331e786519f093d56111991160840cac9c Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 28 Jan 2021 14:33:31 +0200 Subject: [PATCH] Fix back to context menu from gpx menu --- .../controllers/SelectedGpxMenuController.java | 4 +--- .../src/net/osmand/plus/track/TrackMenuFragment.java | 12 ++++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/SelectedGpxMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/SelectedGpxMenuController.java index 427e0cce35..acdce38b90 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/SelectedGpxMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/SelectedGpxMenuController.java @@ -42,9 +42,7 @@ public class SelectedGpxMenuController extends MenuController { leftTitleButtonController = new TitleButtonController() { @Override public void buttonPressed() { - SelectedGpxFile selectedGpxFile = selectedGpxPoint.getSelectedGpxFile(); - mapActivity.getContextMenu().hide(false); - TrackMenuFragment.showInstance(mapActivity, selectedGpxFile.getGpxFile().path, selectedGpxFile.isShowCurrentTrack()); + TrackMenuFragment.showInstance(mapActivity, selectedGpxPoint.getSelectedGpxFile()); } }; leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_open_track); diff --git a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java index 533268fd62..b145fc903d 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java @@ -227,11 +227,15 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card FragmentActivity activity = requireMyActivity(); activity.getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) { public void handleOnBackPressed() { - MapActivity mapActivity = getMapActivity(); - if (mapActivity != null) { - mapActivity.launchPrevActivityIntent(); + if (getCurrentMenuState() != MenuState.HEADER_ONLY && isPortrait()) { + openMenuHeaderOnly(); + } else { + MapActivity mapActivity = getMapActivity(); + if (mapActivity != null && mapActivity.getSupportFragmentManager().getBackStackEntryCount() == 1) { + mapActivity.launchPrevActivityIntent(); + } + dismiss(); } - dismiss(); } }); }