diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java index ffe6663146..f2e5f955da 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java @@ -305,6 +305,7 @@ public class EditPoiDialogFragment extends DialogFragment { private void save() { Node original = editPoiData.getEntity(); + final boolean offlineEdit = mOpenstreetmapUtil instanceof OpenstreetmapLocalUtil; Node node = new Node(original.getLatitude(), original.getLongitude(), original.getId()); OsmPoint.Action action = node.getId() == -1 ? OsmPoint.Action.CREATE : OsmPoint.Action.MODIFY; for (Map.Entry tag : editPoiData.getTagValues().entrySet()) { @@ -319,6 +320,9 @@ public class EditPoiDialogFragment extends DialogFragment { node.putTag(editPoiData.getPoiCategory().getDefaultTag(), tag.getValue()); } + if(offlineEdit && !Algorithms.isEmpty(tag.getValue())) { + node.putTag(tag.getKey(), tag.getValue()); + } } else if (!Algorithms.isEmpty(tag.getKey()) && !Algorithms.isEmpty(tag.getValue())) { node.putTag(tag.getKey(), tag.getValue()); } @@ -330,7 +334,7 @@ public class EditPoiDialogFragment extends DialogFragment { @Override public void run() { OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class); - if (plugin != null && mOpenstreetmapUtil instanceof OpenstreetmapLocalUtil) { + if (plugin != null && offlineEdit) { List points = plugin.getDBPOI().getOpenstreetmapPoints(); if (getActivity() instanceof MapActivity && points.size() > 0) { OsmPoint point = points.get(points.size() - 1); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java index 911cbc773e..15a058ad1b 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java @@ -61,7 +61,7 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil { Node entity = new Node(n.getLocation().getLatitude(), n.getLocation().getLongitude(), nodeId); - entity.putTag(EditPoiData.POI_TYPE_TAG, poiType.getOsmValue()); + entity.putTag(EditPoiData.POI_TYPE_TAG, poiType.getTranslation()); if(poiType.getOsmTag2() != null) { entity.putTag(poiType.getOsmTag2(), poiType.getOsmValue2()); } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java index 89fbbd8036..69e3258c97 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java @@ -364,7 +364,7 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil { if (entity != null && MapUtils.getDistance(entity.getLatLon(), n.getLocation()) < 50) { PoiType poiType = n.getType().getPoiTypeByKeyName(n.getSubType()); entity.removeTag(poiType.getOsmTag()); - entity.putTag(EditPoiData.POI_TYPE_TAG, poiType.getOsmValue()); + entity.putTag(EditPoiData.POI_TYPE_TAG, poiType.getTranslation()); return entity; } return null; diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java index 341881c0bd..2cbb1df1a0 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java @@ -570,6 +570,8 @@ public class OsmEditsFragment extends OsmAndListFragment sz.endTag("", "create"); sz.startTag("", "modify"); writeContent(sz, points, OsmPoint.Action.MODIFY); + writeContent(sz, points, OsmPoint.Action.REOPEN); + sz.endTag("", "modify"); sz.startTag("", "delete"); writeContent(sz, points, OsmPoint.Action.DELETE); @@ -601,6 +603,9 @@ public class OsmEditsFragment extends OsmAndListFragment sz.attribute("", "version", "1"); for (String tag : p.getEntity().getTagKeySet()) { String val = p.getEntity().getTag(tag); + if (val == null || val.length() == 0 || tag.length() == 0 || "poi_type_tag".equals(tag)) { + continue; + } sz.startTag("", "tag"); sz.attribute("", "k", tag); sz.attribute("", "v", val);