Set first Map marker as destination. Fix marker deletion
This commit is contained in:
parent
58b198c34b
commit
874ae6955e
3 changed files with 28 additions and 2 deletions
|
@ -1721,8 +1721,12 @@ public class OsmandSettings {
|
||||||
List<Integer> ns = getPositions(ps.size());
|
List<Integer> ns = getPositions(ps.size());
|
||||||
ps.remove(index);
|
ps.remove(index);
|
||||||
ds.remove(index);
|
ds.remove(index);
|
||||||
cs.remove(index);
|
if (cs.size() > index) {
|
||||||
ns.remove(index);
|
cs.remove(index);
|
||||||
|
}
|
||||||
|
if (ns.size() > index) {
|
||||||
|
ns.remove(index);
|
||||||
|
}
|
||||||
return savePoints(ps, ds, cs, ns);
|
return savePoints(ps, ds, cs, ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -598,6 +598,9 @@ public class MapActivityActions implements DialogProvider {
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
MapActivity.clearPrevActivityIntent();
|
MapActivity.clearPrevActivityIntent();
|
||||||
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
|
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
|
||||||
|
if (settings.USE_MAP_MARKERS.get()) {
|
||||||
|
setFirstMapMarkerAsTarget();
|
||||||
|
}
|
||||||
enterRoutePlanningMode(null, null);
|
enterRoutePlanningMode(null, null);
|
||||||
} else {
|
} else {
|
||||||
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
|
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
|
||||||
|
@ -853,4 +856,17 @@ public class MapActivityActions implements DialogProvider {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFirstMapMarkerAsTarget() {
|
||||||
|
if (getMyApplication().getMapMarkersHelper().getMapMarkersPositions().size() > 0) {
|
||||||
|
MapMarkersHelper.MapMarker marker = getMyApplication().getMapMarkersHelper().getMapMarkersPositions().get(0);
|
||||||
|
PointDescription pointDescription = marker.getOriginalPointDescription();
|
||||||
|
if (pointDescription.isLocation()
|
||||||
|
&& pointDescription.getName().equals(PointDescription.getAddressNotFoundStr(mapActivity))) {
|
||||||
|
pointDescription = new PointDescription(PointDescription.POINT_TYPE_LOCATION, "");
|
||||||
|
}
|
||||||
|
TargetPointsHelper targets = getMyApplication().getTargetPointsHelper();
|
||||||
|
targets.navigateToPoint(new LatLon(marker.getLatitude(), marker.getLongitude()),
|
||||||
|
true, targets.getIntermediatePoints().size() + 1, pointDescription);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,11 @@ import net.londatiga.android.QuickAction;
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.core.android.MapRendererContext;
|
import net.osmand.core.android.MapRendererContext;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
|
import net.osmand.plus.MapMarkersHelper;
|
||||||
|
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||||
import net.osmand.plus.OsmAndLocationProvider;
|
import net.osmand.plus.OsmAndLocationProvider;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
@ -386,6 +389,9 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
MapActivity.clearPrevActivityIntent();
|
MapActivity.clearPrevActivityIntent();
|
||||||
RoutingHelper routingHelper = mapActivity.getRoutingHelper();
|
RoutingHelper routingHelper = mapActivity.getRoutingHelper();
|
||||||
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
|
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
|
||||||
|
if (settings.USE_MAP_MARKERS.get()) {
|
||||||
|
mapActivity.getMapActions().setFirstMapMarkerAsTarget();
|
||||||
|
}
|
||||||
mapActivity.getMapActions().enterRoutePlanningMode(null, null);
|
mapActivity.getMapActions().enterRoutePlanningMode(null, null);
|
||||||
} else {
|
} else {
|
||||||
showRouteInfoControlDialog();
|
showRouteInfoControlDialog();
|
||||||
|
|
Loading…
Reference in a new issue