From c1d0dfb383805b132691b134ae7d26853a3d9e77 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Tue, 5 Sep 2017 17:07:45 +0300 Subject: [PATCH] Fix working with PointDescription --- .../osmand/plus/mapmarkers/MapMarkersDbHelper.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java index a10041f5a8..df74c66d3c 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java @@ -10,6 +10,7 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; import net.osmand.plus.api.SQLiteAPI.SQLiteConnection; import net.osmand.plus.api.SQLiteAPI.SQLiteCursor; +import net.osmand.plus.helpers.SearchHistoryHelper; import java.util.LinkedList; import java.util.List; @@ -163,13 +164,19 @@ public class MapMarkersDbHelper { marker.creationDate = currentTime; double lat = marker.getLatitude(); double lon = marker.getLongitude(); - String descr = marker.getName(context); //fixme + String descr = PointDescription.serializeToString(marker.getOriginalPointDescription()); int active = marker.history ? 0 : 1; long visited = 0; int groupKey = 0; int colorIndex = marker.colorIndex; int displayPlace = marker.displayPlace == WIDGET ? 0 : 1; + PointDescription pointDescription = marker.getOriginalPointDescription(); + if (pointDescription != null && !pointDescription.isSearchingAddress(context)) { + SearchHistoryHelper.getInstance(context) + .addNewItemToHistory(marker.getLatitude(), marker.getLongitude(), pointDescription); + } + if (!marker.history) { db.execSQL("UPDATE " + MARKERS_TABLE_NAME + " SET " + MARKERS_COL_NEXT_KEY + " = ? " + "WHERE " + MARKERS_COL_NEXT_KEY + " = ?", new Object[]{marker.id, TAIL_NEXT_VALUE}); @@ -243,14 +250,14 @@ public class MapMarkersDbHelper { SQLiteConnection db = openConnection(false); if (db != null) { try { + String descr = PointDescription.serializeToString(marker.getOriginalPointDescription()); db.execSQL("UPDATE " + MARKERS_TABLE_NAME + " SET " + MARKERS_COL_LAT + " = ?, " + MARKERS_COL_LON + " = ?, " + MARKERS_COL_DESCRIPTION + " = ?, " + MARKERS_COL_COLOR + " = ? " + "WHERE " + MARKERS_COL_ID + " = ?", - new Object[]{marker.getLatitude(), marker.getLongitude(), marker.getName(context), //fixme - marker.colorIndex, marker.id}); + new Object[]{marker.getLatitude(), marker.getLongitude(), descr, marker.colorIndex, marker.id}); } finally { db.close(); }