diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/TransportStopMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/TransportStopMenuBuilder.java index a4266c1f4c..daf43689d2 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/TransportStopMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/TransportStopMenuBuilder.java @@ -10,20 +10,15 @@ import net.osmand.plus.mapcontextmenu.MenuBuilder; public class TransportStopMenuBuilder extends MenuBuilder { private final TransportStop transportStop; - private Amenity amenity; public TransportStopMenuBuilder(MapActivity mapActivity, final TransportStop transportStop) { super(mapActivity); this.transportStop = transportStop; - acquireOriginObject(); - } - - private void acquireOriginObject() { - amenity = transportStop.getAmenity(); } @Override public void buildInternal(View view) { + Amenity amenity = transportStop.getAmenity(); if (amenity != null) { AmenityMenuBuilder builder = new AmenityMenuBuilder(mapActivity, amenity); builder.setLatLon(getLatLon()); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java index 4ed5f21c47..0b9f654ce9 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java @@ -171,7 +171,7 @@ public class TransportStopController extends MenuController { if (amenity != null) { AmenityMenuController.addTypeMenuItem(amenity, builder); } else { - addMyLocationToPlainItems(latLon); + super.addPlainMenuItems(typeStr, pointDescription, latLon); } } } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java index a6bde3bc8d..b195d55420 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java @@ -208,8 +208,13 @@ public class OsmEditingPlugin extends OsmandPlugin { } }; boolean isEditable = false; - if (selectedObj instanceof Amenity) { - Amenity amenity = (Amenity) selectedObj; + if (selectedObj instanceof Amenity || (selectedObj instanceof TransportStop && ((TransportStop) selectedObj).getAmenity() != null)) { + Amenity amenity; + if (selectedObj instanceof Amenity) { + amenity = (Amenity) selectedObj; + } else { + amenity = ((TransportStop) selectedObj).getAmenity(); + } final PoiType poiType = amenity.getType().getPoiTypeByKeyName(amenity.getSubType()); isEditable = !amenity.getType().isWiki() && poiType !=null && !poiType.isNotEditableOsm(); } @@ -225,18 +230,6 @@ public class OsmEditingPlugin extends OsmandPlugin { .setOrder(MODIFY_OSM_CHANGE_ITEM_ORDER) .setListener(listener) .createItem()); - } else if (selectedObj instanceof TransportStop && ((TransportStop) selectedObj).getAmenity() != null) { - TransportStop transportStop = (TransportStop) selectedObj; - Amenity amenity = transportStop.getAmenity(); - final PoiType poiType = amenity.getType().getPoiTypeByKeyName(amenity.getSubType()); - isEditable = !amenity.getType().isWiki() && poiType != null && !poiType.isNotEditableOsm(); - if (isEditable) { - adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.poi_context_menu_modify, mapActivity) - .setIcon(R.drawable.ic_action_edit_dark) - .setOrder(MODIFY_POI_ITEM_ORDER) - .setListener(listener) - .createItem()); - } } else { adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.context_menu_item_create_poi, mapActivity) .setIcon(R.drawable.ic_action_plus_dark)