This commit is contained in:
Alexander Sytnyk 2017-07-17 18:17:24 +03:00
parent ef3b497f7b
commit 1c1a6d869b
2 changed files with 23 additions and 19 deletions

View file

@ -330,6 +330,10 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
} }
public void backToLocationImpl() { public void backToLocationImpl() {
backToLocationImpl(15);
}
public void backToLocationImpl(int zoom) {
if (mapView != null) { if (mapView != null) {
OsmAndLocationProvider locationProvider = app.getLocationProvider(); OsmAndLocationProvider locationProvider = app.getLocationProvider();
if (!isMapLinkedToLocation()) { if (!isMapLinkedToLocation()) {
@ -337,7 +341,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
if (locationProvider.getLastKnownLocation() != null) { if (locationProvider.getLastKnownLocation() != null) {
net.osmand.Location lastKnownLocation = locationProvider.getLastKnownLocation(); net.osmand.Location lastKnownLocation = locationProvider.getLastKnownLocation();
AnimateDraggingMapThread thread = mapView.getAnimatedDraggingThread(); AnimateDraggingMapThread thread = mapView.getAnimatedDraggingThread();
int fZoom = mapView.getZoom() < 15 ? 15 : mapView.getZoom(); int fZoom = mapView.getZoom() < zoom ? zoom : mapView.getZoom();
movingToMyLocation = true; movingToMyLocation = true;
thread.startMoving(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude(), thread.startMoving(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude(),
fZoom, false, new Runnable() { fZoom, false, new Runnable() {

View file

@ -663,7 +663,7 @@ public class MapControlsLayer extends OsmandMapLayer {
touchEvent = 0; touchEvent = 0;
app.logEvent(mapActivity, "start_navigation"); app.logEvent(mapActivity, "start_navigation");
app.getSettings().APPLICATION_MODE.set(routingHelper.getAppMode()); app.getSettings().APPLICATION_MODE.set(routingHelper.getAppMode());
mapActivity.getMapViewTrackingUtilities().backToLocationImpl(); mapActivity.getMapViewTrackingUtilities().backToLocationImpl(17);
app.getSettings().FOLLOW_THE_ROUTE.set(true); app.getSettings().FOLLOW_THE_ROUTE.set(true);
routingHelper.setFollowingMode(true); routingHelper.setFollowingMode(true);
routingHelper.setRoutePlanningMode(false); routingHelper.setRoutePlanningMode(false);