From 6027fce59c5159148aa53ac2b4aa921842de15f3 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 17 Oct 2017 11:37:03 +0300 Subject: [PATCH 1/4] Fix endless "looking up address" after adding map marker --- OsmAnd/src/net/osmand/plus/MapMarkersHelper.java | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java index 1f8023a472..ebd85e0527 100644 --- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java @@ -769,6 +769,7 @@ public class MapMarkersHelper { mapMarkers.add(0, marker); addMarkerToGroup(marker); reorderActiveMarkersIfNeeded(); + lookupAddress(marker); } } } From c3a1c39775680c6e48e61dedb7752c9684306915 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 17 Oct 2017 13:09:03 +0300 Subject: [PATCH 2/4] Fix update query; fix opening of old markers --- OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java | 4 ++-- OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index 93fdc99e77..dcab53a5cb 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -30,7 +30,6 @@ import net.osmand.plus.R; import net.osmand.plus.TargetPointsHelper.TargetPoint; import net.osmand.plus.TargetPointsHelper.TargetPointChangedListener; import net.osmand.plus.activities.MapActivity; -import net.osmand.plus.dashboard.DashboardOnMap; import net.osmand.plus.helpers.GpxUiHelper; import net.osmand.plus.mapcontextmenu.MenuController.ContextMenuToolbarController; import net.osmand.plus.mapcontextmenu.MenuController.MenuState; @@ -44,6 +43,7 @@ import net.osmand.plus.mapcontextmenu.editors.RtePtEditor; import net.osmand.plus.mapcontextmenu.editors.WptPtEditor; import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu; import net.osmand.plus.mapcontextmenu.other.ShareMenu; +import net.osmand.plus.mapmarkers.MapMarkersDialogFragment; import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.views.ContextMenuLayer; @@ -717,7 +717,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL if (pointDescription.isMapMarker()) { hide(); MapActivity.clearPrevActivityIntent(); - mapActivity.getDashboard().setDashboardVisibility(true, DashboardOnMap.DashboardType.MAP_MARKERS); + MapMarkersDialogFragment.showInstance(mapActivity); } else { mapActivity.getMapActions().addMapMarker(latLon.getLatitude(), latLon.getLongitude(), getPointDescriptionForMarker()); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java index c6a7a27b51..19b7687f4e 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java @@ -140,7 +140,7 @@ public class MapMarkersDbHelper { if (oldVersion < 10) { db.execSQL("ALTER TABLE " + MARKERS_TABLE_NAME + " ADD " + MARKERS_COL_SELECTED + " int"); db.execSQL("UPDATE " + MARKERS_TABLE_NAME + - " SET" + MARKERS_COL_SELECTED + " = ? " + + " SET " + MARKERS_COL_SELECTED + " = ? " + "WHERE " + MARKERS_COL_SELECTED + " IS NULL", new Object[]{0}); } } From d9643760ab42394e6dde683310939253f28d4cc7 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 17 Oct 2017 13:54:10 +0300 Subject: [PATCH 3/4] Fix condition --- OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index dcab53a5cb..843e268078 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -898,7 +898,8 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL public PointDescription getPointDescriptionForMarker() { PointDescription pd = getPointDescriptionForTarget(); - if (Algorithms.isEmpty(pd.getName()) && !nameStr.equals(PointDescription.getAddressNotFoundStr(mapActivity))) { + if (Algorithms.isEmpty(pd.getName()) && !Algorithms.isEmpty(nameStr) + && !nameStr.equals(PointDescription.getAddressNotFoundStr(mapActivity))) { return new PointDescription(PointDescription.POINT_TYPE_MAP_MARKER, nameStr); } else { return pd; From cd7f33ed70b21890858cecaed81a9f928b229891 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 17 Oct 2017 14:28:32 +0300 Subject: [PATCH 4/4] Fix onUpgrade --- OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java index 19b7687f4e..4d6798e7a4 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java @@ -21,7 +21,7 @@ import java.util.Random; public class MapMarkersDbHelper { - private static final int DB_VERSION = 10; + private static final int DB_VERSION = 11; public static final String DB_NAME = "map_markers_db"; private static final String MARKERS_TABLE_NAME = "map_markers"; @@ -139,6 +139,8 @@ public class MapMarkersDbHelper { } if (oldVersion < 10) { db.execSQL("ALTER TABLE " + MARKERS_TABLE_NAME + " ADD " + MARKERS_COL_SELECTED + " int"); + } + if (oldVersion < 11) { db.execSQL("UPDATE " + MARKERS_TABLE_NAME + " SET " + MARKERS_COL_SELECTED + " = ? " + "WHERE " + MARKERS_COL_SELECTED + " IS NULL", new Object[]{0});