removed unnecessary changes
This commit is contained in:
parent
92235adeb1
commit
9de34ecf0c
3 changed files with 9 additions and 21 deletions
|
@ -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());
|
||||
|
|
|
@ -165,7 +165,7 @@ public class TransportStopController extends MenuController {
|
|||
if (amenity != null) {
|
||||
AmenityMenuController.addTypeMenuItem(amenity, builder);
|
||||
} else {
|
||||
addMyLocationToPlainItems(latLon);
|
||||
super.addPlainMenuItems(typeStr, pointDescription, latLon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,8 +207,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();
|
||||
}
|
||||
|
@ -224,18 +229,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)
|
||||
|
|
Loading…
Reference in a new issue