Speak destination point

This commit is contained in:
Victor Shcherb 2013-08-03 20:19:55 +02:00
parent ae8f839047
commit 85bda85884

View file

@ -386,15 +386,19 @@ public class RoutingHelper {
// 2. check if intermediate found
if(route.getIntermediatePointsToPass() > 0 && route.getDistanceToNextIntermediate(lastFixedLocation) < POSITION_TOLERANCE * 2) {
showMessage(app.getString(R.string.arrived_at_intermediate_point));
TargetPointsHelper targets = app.getInternalAPI().getTargetPointsHelper();
// List<String> ns = targets.getIntermediatePointNames(); names are not really suitable for voice
voiceRouter.arrivedIntermediatePoint("");
route.passIntermediatePoint();
TargetPointsHelper targets = app.getInternalAPI().getTargetPointsHelper();
List<String> ns = targets.getIntermediatePointNames();
int toDel = targets.getIntermediatePoints().size() - route.getIntermediatePointsToPass();
int currentIndex = toDel - 1;
String name = currentIndex < 0 || currentIndex >= ns.size() || ns.get(currentIndex ) == null ? "" : ns.get(currentIndex );
voiceRouter.arrivedIntermediatePoint(name);
while(toDel > 0) {
targets.removeWayPoint(false, 0);
toDel--;
}
while(intermediatePoints != null && route.getIntermediatePointsToPass() < intermediatePoints.size()) {
intermediatePoints.remove(0);
}
@ -404,9 +408,11 @@ public class RoutingHelper {
Location lastPoint = routeNodes.get(routeNodes.size() - 1);
if (currentRoute > routeNodes.size() - 3 && currentLocation.distanceTo(lastPoint) < POSITION_TOLERANCE * 1.5) {
showMessage(app.getString(R.string.arrived_at_destination));
voiceRouter.arrivedDestinationPoint("");
TargetPointsHelper targets = app.getInternalAPI().getTargetPointsHelper();
String description = targets.getPointNavigateDescription();
voiceRouter.arrivedDestinationPoint(description);
clearCurrentRoute(null, null);
// TargetPointsHelper targets = app.getInternalAPI().getTargetPointsHelper();
// targets.clearPointToNavigate(false);
return true;
}