From a93afeaac5486f31f9e0ad90896d0ae467b4da4a Mon Sep 17 00:00:00 2001 From: sonora Date: Thu, 28 Jul 2016 21:45:04 +0200 Subject: [PATCH] The low impact fix for #2865 --- .../net/osmand/plus/routing/VoiceRouter.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index f88ef7f950..f1fbb55c6d 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -468,8 +468,19 @@ public class VoiceRouter { } else { playMakeTurn(currentSegment, next, null); } - if (nextNextInfo.distanceTo < TURN_IN_DISTANCE_END && isTargetPoint(nextNextInfo)) { - if (!next.getTurnType().goAhead()) { // Avoids isolated "and arrive.." prompt + if (!next.getTurnType().goAhead() && isTargetPoint(nextNextInfo)) { // !goAhead() avoids isolated "and arrive.." prompt, as goAhead() is not pronounced + if (nextNextInfo.distanceTo < TURN_IN_DISTANCE_END) { + // Issue #2865: Ensure a distance associated with the destination arrival is always announced, either here, or in subsequent "Turn in" prompt + // Distance fon non-straights already announced in "Turn (now)"'s nextnext code above + if ((nextNextInfo != null) && (nextNextInfo.directionInfo != null) && nextNextInfo.directionInfo.getTurnType().goAhead()) { + playThen(); + playGoAhead(nextNextInfo.distanceTo, empty); + } + playAndArriveAtDestination(nextNextInfo); + } else if (nextNextInfo.distanceTo < 1.2f * TURN_IN_DISTANCE_END) { + // 1.2 is safety margin should the subsequent "Turn in" prompt not fit in amy more + playThen(); + playGoAhead(nextNextInfo.distanceTo, empty); playAndArriveAtDestination(nextNextInfo); } } @@ -538,6 +549,14 @@ public class VoiceRouter { return false; } + private void playThen() { + CommandBuilder play = getNewCommandPlayerToPlay(); + if (play != null) { + notifyOnVoiceMessage(); + play.then().play(); + } + } + private void playGoAhead(int dist, Term streetName) { CommandBuilder play = getNewCommandPlayerToPlay(); if (play != null) {