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

View file

@ -174,7 +174,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
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_delete).iconColor(R.drawable.ic_action_delete_dark).listen(listener).position(2).reg();
} else {

View file

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