diff --git a/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java b/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java index af8591497b..417de58588 100644 --- a/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java +++ b/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java @@ -297,6 +297,9 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc if(newRoute && rh.isRoutePlanningMode() && mapView != null) { RotatedTileBox rt = mapView.getCurrentRotatedTileBox(); Location lt = rh.getLastProjection(); + if(lt == null) { + lt = app.getTargetPointsHelper().getPointToStartLocation(); + } if(lt != null) { double left = lt.getLongitude(), right = lt.getLongitude(); double top = lt.getLatitude(), bottom = lt.getLatitude(); diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index d12429b588..5237072b75 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -544,8 +544,8 @@ public class RoutingHelper { return false; } - private void setNewRoute(RouteCalculationResult res, Location start){ - final boolean newRoute = !this.route.isCalculated(); + private void setNewRoute(RouteCalculationResult prevRoute, RouteCalculationResult res, Location start){ + final boolean newRoute = !prevRoute.isCalculated(); if (isFollowingMode) { if(lastFixedLocation != null) { start = lastFixedLocation; @@ -574,8 +574,7 @@ public class RoutingHelper { if (!wrongMovementDirection || newRoute) { voiceRouter.newRouteIsCalculated(newRoute); } - } - app.getWaypointHelper().setNewRoute(res); + } app.runInUIThread(new Runnable() { @Override public void run() { @@ -584,7 +583,7 @@ public class RoutingHelper { } } }); - + app.getWaypointHelper().setNewRoute(res); } public int getLeftDistance(){ @@ -737,7 +736,7 @@ public class RoutingHelper { res = provider.recalculatePartOfflineRoute(res, params); } } - + RouteCalculationResult prev = route; synchronized (RoutingHelper.this) { if (res.isCalculated()) { route = res; @@ -748,10 +747,8 @@ public class RoutingHelper { currentRunningJob = null; } if(res.isCalculated()){ - setNewRoute(res, params.start); - } - - if (res.isCalculated()) { + setNewRoute(prev, res, params.start); + String msg = app.getString(R.string.new_route_calculated_dist) + ": " + OsmAndFormatter.getFormattedDistance(res.getWholeDistance(), app); if (res.getRoutingTime() != 0f) {