Merge pull request #4592 from osmandapp/fix_markers_looking_up_address

Fix endless "looking up address" after adding map marker
This commit is contained in:
Alexey 2017-10-17 14:33:32 +03:00 committed by GitHub
commit 30049e8c19
3 changed files with 9 additions and 5 deletions

View file

@ -769,6 +769,7 @@ public class MapMarkersHelper {
mapMarkers.add(0, marker);
addMarkerToGroup(marker);
reorderActiveMarkersIfNeeded();
lookupAddress(marker);
}
}
}

View file

@ -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());
@ -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;

View file

@ -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});