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..9147de6de9 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java @@ -186,13 +186,17 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card @Override public int getToolbarHeight() { - return toolbarHeightPx; + return isPortrait() ? toolbarHeightPx : 0; } public float getMiddleStateKoef() { return 0.5f; } + public int getMinY() { + return getFullScreenTopPosY(); + } + @Override public int getSupportedMenuStatesPortrait() { return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN | MenuState.FULL_SCREEN; @@ -230,11 +234,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(); + } + } } } }); @@ -275,6 +286,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card setupToolbar(); updateHeader(); setupButtons(view); + updateCardsLayout(); calculateLayoutAndUpdateMenuState(); } return view; @@ -432,6 +444,17 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card } } + private void updateCardsLayout() { + FrameLayout bottomContainer = getBottomContainer(); + if (menuType == TrackMenuType.OPTIONS) { + AndroidUtils.setBackground(app, bottomContainer, isNightMode(), + R.color.list_background_color_light, R.color.list_background_color_dark); + } else { + AndroidUtils.setBackground(app, bottomContainer, isNightMode(), + R.color.activity_background_color_light, R.color.activity_background_color_dark); + } + } + @Override protected void calculateLayout(View view, boolean initLayout) { menuTitleHeight = routeMenuTopShadowAll.getHeight() @@ -841,6 +864,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card menuType = type; setupCards(); updateHeader(); + updateCardsLayout(); calculateLayoutAndUpdateMenuState(); break; }