diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 5828a9ab5a..36d777862d 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -862,10 +862,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven boolean night = app.getDaynightHelper().isNightModeForMapControls(); boolean quickSearchTopBar = getTopToolbarController(TopToolbarControllerType.QUICK_SEARCH) != null; boolean contextMenuTopBar = getTopToolbarController(TopToolbarControllerType.CONTEXT_MENU) != null; - boolean contextTopBar = getTopToolbarController(TopToolbarControllerType.CONTEXT) != null; boolean mapTopBar = findViewById(R.id.map_top_bar).getVisibility() == View.VISIBLE; boolean markerTopBar = findViewById(R.id.map_markers_top_bar).getVisibility() == View.VISIBLE; - if (((quickSearchTopBar || mapTopBar) && mapControlsVisible) || contextMenuTopBar || contextTopBar) { + if (((quickSearchTopBar || mapTopBar) && mapControlsVisible) || contextMenuTopBar) { colorId = night ? R.color.status_bar_route_dark : R.color.status_bar_route_light; } else if (markerTopBar && mapControlsVisible) { colorId = R.color.status_bar_dark; diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index c361f19efc..7c1938320c 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -76,7 +76,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL private PointDescription pointDescription; private Object object; private MenuController menuController; - private ContextToolbarController toolbarController; private LatLon mapCenter; private int mapPosition = 0; @@ -126,25 +125,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL } public MapContextMenu() { - toolbarController = new ContextToolbarController(); - toolbarController.setOnBackButtonClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - show(); - } - }); - toolbarController.setOnTitleClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - show(); - } - }); - toolbarController.setOnCloseButtonClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - close(); - } - }); } @Nullable @@ -464,19 +444,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL init(latLon, pointDescription, object); } - private void showToolbar() { - if (mapActivity != null) { - toolbarController.setTitle(getTitleStr()); - mapActivity.showTopToolbar(toolbarController); - } - } - - private void hideToolbar() { - if (mapActivity != null) { - mapActivity.hideTopToolbar(toolbarController); - } - } - public void onFragmentResume() { if (active && displayDistanceDirection()) { updateLocation(false, true, false); @@ -511,7 +478,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL if (menuController != null) { menuController.setActive(false); } - hideToolbar(); mapActivity.refreshMap(); } } @@ -536,9 +502,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL fragmentRef.get().dismissMenu(); result = true; } - if (active) { - showToolbar(); - } } return result; } @@ -789,6 +752,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL if (fragmentRef != null) { fragmentRef.get().refreshTitle(); } + if (searchDoneAction != null) { if (searchDoneAction.dlg != null) { try { @@ -802,13 +766,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL searchDoneAction.run(); searchDoneAction = null; } - if (active) { - toolbarController.setTitle(getTitleStr()); - if (mapActivity != null - && mapActivity.getTopToolbarController(TopToolbarControllerType.CONTEXT) != null) { - mapActivity.refreshMap(); - } - } } @Nullable @@ -1410,12 +1367,4 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL private abstract class MenuAction implements Runnable { protected ProgressDialog dlg; } - - public static class ContextToolbarController extends TopToolbarController { - - public ContextToolbarController() { - super(TopToolbarControllerType.CONTEXT); - } - } - } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java index f07beb1f37..461a163f00 100644 --- a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java @@ -1028,7 +1028,14 @@ public class ContextMenuLayer extends OsmandMapLayer { public boolean onTouchEvent(MotionEvent event, RotatedTileBox tileBox) { if (movementListener.onTouchEvent(event)) { - menu.hide(); + if (menu.isVisible()) { + if (!menu.isClosable()) { + menu.hide(); + } else { + menu.updateMapCenter(null); + menu.close(); + } + } if (multiSelectionMenu.isVisible()) { multiSelectionMenu.hide(); } diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java index 29608e3577..a565e1acda 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java @@ -55,8 +55,7 @@ public class MapInfoWidgetsFactory { CONTEXT_MENU, TRACK_DETAILS, DISCOUNT, - MEASUREMENT_TOOL, - CONTEXT + MEASUREMENT_TOOL } public TextInfoWidget createAltitudeControl(final MapActivity map) {