User can no longer attempt to edit wikipedia POI

This commit is contained in:
GaidamakUA 2015-10-26 17:13:40 +02:00
parent 960685c91e
commit 68f9d7d364
3 changed files with 11 additions and 9 deletions

View file

@ -1,5 +1,7 @@
package net.osmand.plus.osmedit; package net.osmand.plus.osmedit;
import android.content.Context;
import net.osmand.PlatformUtil; import net.osmand.PlatformUtil;
import net.osmand.data.Amenity; import net.osmand.data.Amenity;
import net.osmand.osm.PoiType; import net.osmand.osm.PoiType;
@ -10,8 +12,6 @@ import net.osmand.util.MapUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import android.content.Context;
public class OpenstreetmapLocalUtil implements OpenstreetmapUtil { public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
private final Context ctx; private final Context ctx;
@ -50,8 +50,8 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
@Override @Override
public Node loadNode(Amenity n) { public Node loadNode(Amenity n) {
PoiType st = n.getType().getPoiTypeByKeyName(n.getSubType()); PoiType poiType = n.getType().getPoiTypeByKeyName(n.getSubType());
if(n.getId() % 2 == 1 || st == null){ if(n.getId() % 2 == 1 || poiType == null){
// that's way id // that's way id
return null; return null;
} }
@ -61,9 +61,9 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
Node entity = new Node(n.getLocation().getLatitude(), Node entity = new Node(n.getLocation().getLatitude(),
n.getLocation().getLongitude(), n.getLocation().getLongitude(),
nodeId); nodeId);
entity.putTag(st.getOsmTag(), st.getOsmValue()); entity.putTag(poiType.getOsmTag(), poiType.getOsmValue());
if(st.getOsmTag2() != null) { if(poiType.getOsmTag2() != null) {
entity.putTag(st.getOsmTag2(), st.getOsmValue2()); entity.putTag(poiType.getOsmTag2(), poiType.getOsmValue2());
} }
entity.putTag(OSMTagKey.NAME.getValue(), n.getName()); entity.putTag(OSMTagKey.NAME.getValue(), n.getName());
entity.putTag(OSMTagKey.OPENING_HOURS.getValue(), n.getOpeningHours()); entity.putTag(OSMTagKey.OPENING_HOURS.getValue(), n.getOpeningHours());

View file

@ -174,7 +174,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
return true; return true;
} }
}; };
if (selectedObj instanceof Amenity) { if (selectedObj instanceof Amenity && !((Amenity) selectedObj).getType().isWiki()) {
adapter.item(R.string.poi_context_menu_modify).iconColor(R.drawable.ic_action_edit_dark).listen(listener).position(1).reg(); adapter.item(R.string.poi_context_menu_modify).iconColor(R.drawable.ic_action_edit_dark).listen(listener).position(1).reg();
adapter.item(R.string.poi_context_menu_delete).iconColor(R.drawable.ic_action_delete_dark).listen(listener).position(2).reg(); adapter.item(R.string.poi_context_menu_delete).iconColor(R.drawable.ic_action_delete_dark).listen(listener).position(2).reg();
} else { } else {

View file

@ -100,7 +100,9 @@ public class UploadOpenstreetmapPointAsyncTask
@Override @Override
protected void onPostExecute(Map<OsmPoint, String> loadErrorsMap) { protected void onPostExecute(Map<OsmPoint, String> loadErrorsMap) {
if (progress.isShowing()) {
progress.dismiss(); progress.dismiss();
}
listener.uploadEnded(loadErrorsMap); listener.uploadEnded(loadErrorsMap);
} }