diff --git a/OsmAnd/src/net/osmand/plus/auto/TripHelper.java b/OsmAnd/src/net/osmand/plus/auto/TripHelper.java index b0d936d542a..2d81ab41eed 100644 --- a/OsmAnd/src/net/osmand/plus/auto/TripHelper.java +++ b/OsmAnd/src/net/osmand/plus/auto/TripHelper.java @@ -307,8 +307,16 @@ public Pair getDestination(@NonNull TargetPoint poi destBuilder.setImage(new CarIcon.Builder(IconCompat.createWithResource(app, R.drawable.ic_action_point_destination)).build()); - Distance distance = getDistance(app, routingHelper.getLeftDistance()); - int leftTimeSec = routingHelper.getLeftTime(); + int leftTimeSec; + int leftDistance; + if (routingHelper.hasIntermediatePointsToPass()) { + leftTimeSec = routingHelper.getLeftTimeNextIntermediate(); + leftDistance = routingHelper.getLeftDistanceNextIntermediate(); + } else { + leftTimeSec = routingHelper.getLeftTime(); + leftDistance = routingHelper.getLeftDistance(); + } + Distance distance = getDistance(app, leftDistance); DateTimeWithZone dateTime = DateTimeWithZone.create(System.currentTimeMillis() + leftTimeSec * 1000L, TimeZone.getDefault()); TravelEstimate.Builder travelEstimateBuilder = new TravelEstimate.Builder(distance, dateTime); travelEstimateBuilder.setRemainingTimeSeconds(leftTimeSec); diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index 6afb104afeb..bbdb3d70910 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -748,6 +748,10 @@ public int getLeftTimeNextIntermediate() { return route.getLeftTimeToNextIntermediate(lastFixedLocation); } + public boolean hasIntermediatePointsToPass() { + return route.getIntermediatePointsToPass() > 0; + } + public OsmandSettings getSettings() { return settings; }