diff --git a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java index 044de5d840..d1a0ff686e 100644 --- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java @@ -203,9 +203,7 @@ public class MapMarkersHelper { if (marker != null) { cancelPointAddressRequests(marker.point); markersDbHelper.moveMarkerToHistory(marker); - mapMarkers.remove(marker); - marker.history = true; - mapMarkersHistory.add(marker); + loadMarkers(); refresh(); } } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java index 03e2253f09..d8d077e39e 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java @@ -323,9 +323,6 @@ public class MapMarkersDbHelper { } public void restoreMapMarkerFromHistory(MapMarker marker) { - if (!marker.history) { - return; - } SQLiteConnection db = openConnection(false); if (db != null) { try { @@ -333,8 +330,9 @@ public class MapMarkersDbHelper { db.execSQL("UPDATE " + MARKERS_TABLE_NAME + " SET " + MARKERS_COL_ACTIVE + " = ?, " + MARKERS_COL_NEXT_KEY + " = ? " + - "WHERE " + MARKERS_COL_ID + " = ?", - new Object[]{1, active.size() > 0 ? active.get(0).id : TAIL_NEXT_VALUE, marker.id}); + "WHERE " + MARKERS_COL_ID + " = ? " + + "AND " + MARKERS_COL_ACTIVE + " = ?", + new Object[]{1, active.size() > 0 ? active.get(0).id : TAIL_NEXT_VALUE, marker.id, 0}); } finally { db.close(); } @@ -362,14 +360,13 @@ public class MapMarkersDbHelper { } public void removeMarkerFromHistory(MapMarker marker) { - if (!marker.history) { - return; - } SQLiteConnection db = openConnection(true); if (db != null) { try { - db.execSQL("DELETE FROM " + MARKERS_TABLE_NAME + " WHERE " + MARKERS_COL_ID + " = ?", - new Object[]{marker.id}); + db.execSQL("DELETE FROM " + MARKERS_TABLE_NAME + + " WHERE " + MARKERS_COL_ID + " = ?" + + " AND " + MARKERS_COL_ACTIVE + " = ?", + new Object[]{marker.id, 0}); } finally { db.close(); }