diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index c8b99273a8..6ea6648db7 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -229,6 +229,38 @@ public class VoiceRouter { } } + public void approachWaypoint(Location location, List points){ + CommandBuilder p = getNewCommandPlayerToPlay(); + if (p == null){ + return; + } + double[] dist = new double[1]; + makeSound(); + String text = getText(location, points, dist); + p.goAhead(dist[0], null).andArriveAtWayPoint(text).play(); + } + + public void approachFavorite(Location location, List points){ + CommandBuilder p = getNewCommandPlayerToPlay(); + if (p == null){ + return; + } + double[] dist = new double[1]; + makeSound(); + String text = getText(location, points, dist); + p.goAhead(dist[0], null).andArriveAtFavorite(text).play(); + } + + public void approachPoi(Location location, List points){ + CommandBuilder p = getNewCommandPlayerToPlay(); + if (p == null){ + return; + } + double[] dist = new double[1]; + String text = getText(location, points, dist); + p.goAhead(dist[0], null).andArriveAtPoiWaypoint(text).play(); + } + public void announceWaypoint(List points) { CommandBuilder p = getNewCommandPlayerToPlay(); if (p == null){ @@ -258,38 +290,6 @@ public class VoiceRouter { p.arrivedAtPoi(text).play(); } - public void approachFavorite(Location location, List points){ - CommandBuilder p = getNewCommandPlayerToPlay(); - if (p == null){ - return; - } - double[] dist = new double[1]; - makeSound(); - String text = getText(location, points, dist); - p.goAhead(dist[0], null).andArriveAtFavorite(text).play(); - } - - public void approachWaypoint(Location location, List points){ - CommandBuilder p = getNewCommandPlayerToPlay(); - if (p == null){ - return; - } - double[] dist = new double[1]; - makeSound(); - String text = getText(location, points, dist); - p.goAhead(dist[0], null).andArriveAtWayPoint(text).play(); - } - - public void approachPoi(Location location, List points){ - CommandBuilder p = getNewCommandPlayerToPlay(); - if (p == null){ - return; - } - double[] dist = new double[1]; - String text = getText(location, points, dist); - p.goAhead(dist[0], null).andArriveAtPoiWaypoint(text).play(); - } - protected String getText(Location location, List points, double[] dist) { String text = ""; for (LocationPointWrapper point : points) { @@ -739,13 +739,14 @@ public class VoiceRouter { play.arrivedAtIntermediatePoint(getSpeakablePointName(name)).play(); } } - - public void arrivedWayPoint(String name) { - CommandBuilder play = getNewCommandPlayerToPlay(); - if(play != null){ - play.arrivedAtWayPoint(getSpeakablePointName(name)).play(); - } - } + + // This is not needed, used are only arrivedIntermediatePoint (for points on the route) or announceWaypoint (for points near the route=) + //public void arrivedWayPoint(String name) { + // CommandBuilder play = getNewCommandPlayerToPlay(); + // if(play != null){ + // play.arrivedAtWayPoint(getSpeakablePointName(name)).play(); + // } + //} public void onApplicationTerminate(Context ctx) { if (player != null) { diff --git a/OsmAnd/src/net/osmand/plus/voice/CommandBuilder.java b/OsmAnd/src/net/osmand/plus/voice/CommandBuilder.java index 79f6f9465f..cbecae25fb 100644 --- a/OsmAnd/src/net/osmand/plus/voice/CommandBuilder.java +++ b/OsmAnd/src/net/osmand/plus/voice/CommandBuilder.java @@ -185,23 +185,35 @@ public class CommandBuilder { public CommandBuilder arrivedAtDestination(String name){ return alt(prepareStruct(C_REACHED_DESTINATION, name), prepareStruct(C_REACHED_DESTINATION)); } - - public CommandBuilder arrivedAtIntermediatePoint(String name) { - return alt(prepareStruct(C_REACHED_INTERMEDIATE, name), prepareStruct(C_REACHED_INTERMEDIATE)); - } - + public CommandBuilder andArriveAtIntermediatePoint(String name){ return alt(prepareStruct(C_AND_ARRIVE_INTERMEDIATE, name), prepareStruct(C_AND_ARRIVE_INTERMEDIATE)); } - + + public CommandBuilder arrivedAtIntermediatePoint(String name) { + return alt(prepareStruct(C_REACHED_INTERMEDIATE, name), prepareStruct(C_REACHED_INTERMEDIATE)); + } + + public CommandBuilder andArriveAtWayPoint(String name){ + return addCommand(C_AND_ARRIVE_WAYPOINT, name); + } + public CommandBuilder arrivedAtWayPoint(String name) { return addCommand(C_REACHED_WAYPOINT, name); } + public CommandBuilder andArriveAtFavorite(String name) { + return addCommand(C_AND_ARRIVE_FAVORITE, name); + } + public CommandBuilder arrivedAtFavorite(String name) { return addCommand(C_REACHED_FAVORITE, name); } + public CommandBuilder andArriveAtPoiWaypoint(String name) { + return addCommand(C_AND_ARRIVE_POI_WAYPOINT, name); + } + public CommandBuilder arrivedAtPoi(String name) { return addCommand(C_REACHED_POI, name); } @@ -242,16 +254,4 @@ public class CommandBuilder { alreadyExecuted = true; return this.commandPlayer.execute(listStruct); } - - public CommandBuilder andArriveAtWayPoint(String name){ - return addCommand(C_AND_ARRIVE_WAYPOINT, name); - } - - public CommandBuilder andArriveAtPoiWaypoint(String name) { - return addCommand(C_AND_ARRIVE_POI_WAYPOINT, name); - } - - public CommandBuilder andArriveAtFavorite(String name) { - return addCommand(C_AND_ARRIVE_FAVORITE, name); - } } \ No newline at end of file