In navigation from markers use app mode from plan route context

This commit is contained in:
Alex 2017-10-13 15:44:54 +03:00
parent 84aca23321
commit 1e12835a94
3 changed files with 17 additions and 1 deletions

View file

@ -49,6 +49,7 @@ import net.osmand.plus.dialogs.FavoriteDialogs;
import net.osmand.plus.download.IndexItem;
import net.osmand.plus.liveupdates.OsmLiveActivity;
import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
import net.osmand.plus.mapmarkers.MarkersPlanRouteContext;
import net.osmand.plus.measurementtool.MeasurementToolFragment;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
@ -496,6 +497,11 @@ public class MapActivityActions implements DialogProvider {
}
public ApplicationMode getRouteMode(LatLon from) {
MarkersPlanRouteContext planRouteContext = mapActivity.getMyApplication().getMapMarkersHelper().getPlanRouteContext();
if (planRouteContext.isNavigationFromMarkers() && planRouteContext.getSnappedMode() != ApplicationMode.DEFAULT) {
planRouteContext.setNavigationFromMarkers(false);
return planRouteContext.getSnappedMode();
}
ApplicationMode mode = settings.DEFAULT_APPLICATION_MODE.get();
ApplicationMode selected = settings.APPLICATION_MODE.get();
if (selected != ApplicationMode.DEFAULT) {

View file

@ -42,6 +42,7 @@ public class MarkersPlanRouteContext {
private boolean fragmentVisible;
private boolean markersListOpened;
private boolean adjustMapOnStart = true;
private boolean navigationFromMarkers;
Map<Pair<WptPt, WptPt>, List<WptPt>> getSnappedToRoadPoints() {
return snappedToRoadPoints;
@ -51,7 +52,7 @@ public class MarkersPlanRouteContext {
return snapTrkSegment;
}
ApplicationMode getSnappedMode() {
public ApplicationMode getSnappedMode() {
return snappedMode;
}
@ -99,6 +100,14 @@ public class MarkersPlanRouteContext {
this.adjustMapOnStart = adjustMapOnStart;
}
public boolean isNavigationFromMarkers() {
return navigationFromMarkers;
}
public void setNavigationFromMarkers(boolean navigationFromMarkers) {
this.navigationFromMarkers = navigationFromMarkers;
}
public MarkersPlanRouteContext(OsmandApplication app) {
this.app = app;
}

View file

@ -524,6 +524,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
targetPointsHelper.clearStartPoint(false);
targetPointsHelper.clearPointToNavigate(false);
}
planRouteContext.setNavigationFromMarkers(true);
dismiss();
mapActivity.getMapLayers().getMapControlsLayer().doRoute(hasTargets);
}