Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-10-25 15:53:31 +02:00
commit 73f89c9aeb
2 changed files with 21 additions and 1 deletions

View file

@ -20,6 +20,7 @@ import net.osmand.plus.NavigationService;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper.TargetPoint;
import net.osmand.plus.routing.RouteCalculationResult;
import net.osmand.plus.routing.RouteCalculationResult.NextDirectionInfo;
import net.osmand.plus.routing.RouteDirectionInfo;
@ -33,6 +34,7 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static net.osmand.plus.NavigationService.USED_BY_NAVIGATION;
@ -160,6 +162,20 @@ public class NavigationNotification extends OsmandNotification {
notificationText.append(ri.getDescriptionRoutePart());
notificationText.append("\n");
}
int distanceToNextIntermediate = routingHelper.getLeftDistanceNextIntermediate();
if (distanceToNextIntermediate > 0) {
int nextIntermediateIndex = routingHelper.getRoute().getNextIntermediate();
List<TargetPoint> intermediatePoints = app.getTargetPointsHelper().getIntermediatePoints();
if (nextIntermediateIndex < intermediatePoints.size()) {
TargetPoint nextIntermediate = intermediatePoints.get(nextIntermediateIndex);
notificationText.append(OsmAndFormatter.getFormattedDistance(distanceToNextIntermediate, app))
.append("")
.append(nextIntermediate.getOnlyName());
notificationText.append("\n");
}
}
notificationText.append(distanceStr).append("").append(durationStr);
} else {

View file

@ -729,6 +729,10 @@ public class RouteCalculationResult {
nextIntermediate ++ ;
}
public int getNextIntermediate() {
return nextIntermediate;
}
public Location getLocationFromRouteDirection(RouteDirectionInfo i){
if(i != null && locations != null && i.routePointOffset < locations.size()){
return locations.get(i.routePointOffset);