diff --git a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java index 25632fd823..ff4fab8f71 100644 --- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java @@ -321,6 +321,12 @@ public class MapMarkersHelper { refresh(); } + public void addMapMarker(MapMarker marker) { + settings.insertMapMarker(marker.getLatitude(), marker.getLongitude(), marker.pointDescription, + marker.colorIndex, marker.selected, marker.creationDate, 0); + readFromSettings(); + } + public void addMapMarker(LatLon point, PointDescription historyName) { List points = new ArrayList<>(1); List historyNames = new ArrayList<>(1); diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 6d98bfb771..f2f6b625a2 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -2179,8 +2179,8 @@ public class OsmandSettings { } public boolean insertPoint(double latitude, double longitude, - PointDescription historyDescription, int colorIndex, int pos, - boolean selected, int index) { + PointDescription historyDescription, int colorIndex, + boolean selected, long creationDate, int index) { List ps = getPoints(); List ds = getPointDescriptions(ps.size()); List cs = getColors(ps.size()); @@ -2190,7 +2190,7 @@ public class OsmandSettings { ds.add(index, PointDescription.serializeToString(historyDescription)); cs.add(index, colorIndex); bs.add(index, selected); - cds.add(index, System.currentTimeMillis()); + cds.add(index, creationDate == 0 ? System.currentTimeMillis() : creationDate); if (historyDescription != null && !historyDescription.isSearchingAddress(ctx)) { SearchHistoryHelper.getInstance(ctx).addNewItemToHistory(latitude, longitude, historyDescription); } @@ -2562,10 +2562,10 @@ public class OsmandSettings { } public boolean insertMapMarker(double latitude, double longitude, - PointDescription historyDescription, int colorIndex, int pos, - boolean selected, int index) { + PointDescription historyDescription, int colorIndex, + boolean selected, long creationDate, int index) { return mapMarkersStorage.insertPoint(latitude, longitude, historyDescription, colorIndex, - index, selected, pos); + selected, creationDate, index); } public boolean insertMapMarkers(double[] latitudes, double[] longitudes, diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersHistoryAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersHistoryAdapter.java index 2a0f8816d1..90b1a4abb4 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersHistoryAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersHistoryAdapter.java @@ -40,7 +40,7 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter