Update provider in layer after adding point

This commit is contained in:
PavelRatushny 2017-10-09 12:50:22 +03:00
parent b904e2d205
commit 6169630188
2 changed files with 10 additions and 6 deletions

View file

@ -399,12 +399,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
fragmentRef.get().rebuildMenu(centerMarker); fragmentRef.get().rebuildMenu(centerMarker);
} }
ContextMenuLayer contextMenuLayer = mapActivity.getMapLayers().getContextMenuLayer(); ContextMenuLayer contextMenuLayer = mapActivity.getMapLayers().getContextMenuLayer();
for (OsmandMapLayer layer : mapActivity.getMapView().getLayers()) { contextMenuLayer.updateContextMenu();
if (layer instanceof ContextMenuLayer.IMoveObjectProvider && ((ContextMenuLayer.IMoveObjectProvider) layer).isObjectMovable(object)) {
contextMenuLayer.setSelectedObjectContextMenuProvider((ContextMenuLayer.IContextMenuProvider) layer);
break;
}
}
centerMarker = false; centerMarker = false;
} }

View file

@ -232,6 +232,15 @@ public class ContextMenuLayer extends OsmandMapLayer {
this.selectOnMap = selectOnMap; 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 @Override
public void populateObjectContextMenu(LatLon latLon, Object o, ContextMenuAdapter adapter, MapActivity mapActivity) { public void populateObjectContextMenu(LatLon latLon, Object o, ContextMenuAdapter adapter, MapActivity mapActivity) {
if (menu.hasHiddenBottomInfo()) { if (menu.hasHiddenBottomInfo()) {