removed unnecessary changes

This commit is contained in:
Chumva 2018-06-08 18:16:08 +03:00 committed by crimean
parent 6854d9e690
commit 695f065fd7
3 changed files with 9 additions and 21 deletions

View file

@ -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());

View file

@ -171,7 +171,7 @@ public class TransportStopController extends MenuController {
if (amenity != null) {
AmenityMenuController.addTypeMenuItem(amenity, builder);
} else {
addMyLocationToPlainItems(latLon);
super.addPlainMenuItems(typeStr, pointDescription, latLon);
}
}
}

View file

@ -208,8 +208,13 @@ public class OsmEditingPlugin extends OsmandPlugin {
}
};
boolean isEditable = false;
if (selectedObj instanceof Amenity || (selectedObj instanceof TransportStop && ((TransportStop) selectedObj).getAmenity() != null)) {
Amenity amenity;
if (selectedObj instanceof Amenity) {
Amenity amenity = (Amenity) selectedObj;
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)