diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index defbcb878b..a02acabfd1 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -609,8 +609,12 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL public void onSingleTapOnMap() { if (menuController == null || !menuController.handleSingleTapOnMap()) { - updateMapCenter(null); - close(); + if (menuController != null && !menuController.isClosable()) { + hide(); + } else { + updateMapCenter(null); + close(); + } if (mapActivity.getMapLayers().getMapQuickActionLayer().isLayerOn()) { mapActivity.getMapLayers().getMapQuickActionLayer().refreshLayer(); } @@ -994,6 +998,10 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL return menuController == null || menuController.fabVisible(); } + public boolean isClosable() { + return menuController == null || menuController.isClosable(); + } + public boolean buttonsVisible() { return menuController == null || menuController.buttonsVisible(); } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java index 00a836b75d..1291be7d50 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java @@ -69,6 +69,7 @@ public class MenuBuilder { private LatLon latLon; private boolean hidden; private boolean showNearestWiki = false; + private boolean showOnlinePhotos = true; protected List nearestWiki = new ArrayList<>(); private List menuPlugins = new ArrayList<>(); private CardsRowBuilder onlinePhotoCardsRow; @@ -207,6 +208,14 @@ public class MenuBuilder { this.showNearestWiki = showNearestWiki; } + public boolean isShowOnlinePhotos() { + return showOnlinePhotos; + } + + public void setShowOnlinePhotos(boolean showOnlinePhotos) { + this.showOnlinePhotos = showOnlinePhotos; + } + public void setShowNearestWiki(boolean showNearestWiki, long objectId) { this.objectId = objectId; this.showNearestWiki = showNearestWiki; @@ -228,7 +237,9 @@ public class MenuBuilder { buildPlainMenuItems(view); } buildInternal(view); - buildNearestPhotosRow(view); + if (showOnlinePhotos) { + buildNearestPhotosRow(view); + } buildPluginRows(view); buildAfter(view); } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java index c858409ee6..f1217b37de 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java @@ -348,6 +348,10 @@ public abstract class MenuController extends BaseMenuController { return false; } + public boolean isClosable() { + return true; + } + public boolean needStreetName() { return !displayDistanceDirection(); } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportRouteController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportRouteController.java index 6dbb00845a..9726df1a33 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportRouteController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportRouteController.java @@ -27,6 +27,7 @@ public class TransportRouteController extends MenuController { final TransportStopRoute transportRoute) { super(new MenuBuilder(mapActivity), pointDescription, mapActivity); this.transportRoute = transportRoute; + builder.setShowOnlinePhotos(false); toolbarController = new ContextMenuToolbarController(this); toolbarController.setTitle(getNameStr()); toolbarController.setOnBackButtonClickListener(new OnClickListener() { @@ -83,6 +84,10 @@ public class TransportRouteController extends MenuController { return false; } + @Override + public boolean isClosable() { + return false; + } @Override public boolean buttonsVisible() { @@ -157,12 +162,13 @@ public class TransportRouteController extends MenuController { MapContextMenu menu = getMapActivity().getContextMenu(); PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_STOP, getMapActivity().getString(R.string.transport_Stop), name); - resetRoute(); - menu.show(stop.getLocation(), pd, stop); - WeakReference rr = menu.findMenuFragment(); - if (rr != null && rr.get() != null) { - rr.get().centerMarkerLocation(); - } + + //resetRoute(); + LatLon stopLocation = stop.getLocation(); + getMapActivity().getMyApplication().getSettings() + .setMapLocationToShow(stopLocation.getLatitude(), stopLocation.getLongitude(), + 15, pd, false, stop); + MapActivity.launchMapActivityMoveToTop(getMapActivity()); } }); } diff --git a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java index ccb324260f..dd4d1aae71 100644 --- a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java @@ -854,8 +854,12 @@ public class ContextMenuLayer extends OsmandMapLayer { if (movementListener.onTouchEvent(event)) { if (menu.isVisible()) { - menu.updateMapCenter(null); - menu.close(); + if (!menu.isClosable()) { + menu.hide(); + } else { + menu.updateMapCenter(null); + menu.close(); + } } if (multiSelectionMenu.isVisible()) { multiSelectionMenu.hide();