diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index 303f119c3f..10595db2e3 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -399,12 +399,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL fragmentRef.get().rebuildMenu(centerMarker); } ContextMenuLayer contextMenuLayer = mapActivity.getMapLayers().getContextMenuLayer(); - for (OsmandMapLayer layer : mapActivity.getMapView().getLayers()) { - if (layer instanceof ContextMenuLayer.IMoveObjectProvider && ((ContextMenuLayer.IMoveObjectProvider) layer).isObjectMovable(object)) { - contextMenuLayer.setSelectedObjectContextMenuProvider((ContextMenuLayer.IContextMenuProvider) layer); - break; - } - } + contextMenuLayer.updateContextMenu(); centerMarker = false; } diff --git a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java index a34489ee2f..9a3fd5fe21 100644 --- a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java @@ -232,6 +232,15 @@ public class ContextMenuLayer extends OsmandMapLayer { this.selectOnMap = selectOnMap; } + public void updateContextMenu() { + for (OsmandMapLayer layer : view.getLayers()) { + if (layer instanceof ContextMenuLayer.IMoveObjectProvider && ((ContextMenuLayer.IMoveObjectProvider) layer).isObjectMovable(selectedObject)) { + selectedObjectContextMenuProvider = (IContextMenuProvider) layer; + break; + } + } + } + @Override public void populateObjectContextMenu(LatLon latLon, Object o, ContextMenuAdapter adapter, MapActivity mapActivity) { if (menu.hasHiddenBottomInfo()) {