From d89d48474ad37ab00dc0016234c3369b7587a2f5 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Wed, 21 Oct 2020 15:41:36 +0300 Subject: [PATCH] Import OSM Edit tags --- .../backend/backup/OsmEditsSettingsItem.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/OsmEditsSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/OsmEditsSettingsItem.java index f0af94a009..e2c06d14d6 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/OsmEditsSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/OsmEditsSettingsItem.java @@ -5,12 +5,16 @@ import android.content.Context; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + import net.osmand.osm.edit.Entity; import net.osmand.osm.edit.Node; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; import net.osmand.plus.osmedit.OpenstreetmapPoint; +import net.osmand.plus.osmedit.OpenstreetmapsDbHelper; import net.osmand.plus.osmedit.OsmEditingPlugin; import net.osmand.plus.osmedit.OsmPoint; @@ -19,7 +23,9 @@ import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; public class OsmEditsSettingsItem extends CollectionSettingsItem { @@ -71,6 +77,14 @@ public class OsmEditsSettingsItem extends CollectionSettingsItem tagMap = new Gson().fromJson( + tags, new TypeToken>() { + }.getType() + ); String action = entityJson.getString(ACTION_KEY); Entity entity; entity = new Node(lat, lon, id); + entity.replaceTags(tagMap); OpenstreetmapPoint point = new OpenstreetmapPoint(); point.setComment(comment); point.setEntity(entity); @@ -144,7 +164,8 @@ public class OsmEditsSettingsItem extends CollectionSettingsItem