From 8460856d98ac0bed7240eb859428e4a3d49a9f02 Mon Sep 17 00:00:00 2001 From: sonora Date: Fri, 20 May 2016 12:30:56 +0200 Subject: [PATCH] fix issue with back on route prompt --- .../src/net/osmand/plus/routing/RoutingHelper.java | 7 +------ OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java | 12 +++++++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index 708decc36c..46da4a5748 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -82,9 +82,6 @@ public class RoutingHelper { private RouteCalculationProgressCallback progressRoute; - private boolean announceBackOnRoute = false; - - // private ProgressBar progress; // private Handler progressHandler; @@ -322,7 +319,6 @@ public class RoutingHelper { if(dist > 350) { if (isFollowingMode) { voiceRouter.announceOffRoute(dist); - announceBackOnRoute = true; } } } @@ -373,9 +369,8 @@ public class RoutingHelper { if(!thread.isParamsChanged()) { thread.stopCalculation(); } - if (announceBackOnRoute && isFollowingMode){ + if (isFollowingMode){ voiceRouter.announceBackOnRoute(); - announceBackOnRoute = false; } } } diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index a32e8200aa..287a753c21 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -48,6 +48,7 @@ public class VoiceRouter { private long waitAnnouncedSpeedLimit = 0; private long waitAnnouncedOffRoute = 0; private boolean suppressDest = false; + private boolean announceBackOnRoute = false; // private long lastTimeRouteRecalcAnnounced = 0; @@ -220,6 +221,7 @@ public class VoiceRouter { if (p != null) { notifyOnVoiceMessage(); p.offRoute(dist).play(); + announceBackOnRoute = true; } if(waitAnnouncedOffRoute == 0) { waitAnnouncedOffRoute = 60000; @@ -232,9 +234,12 @@ public class VoiceRouter { public void announceBackOnRoute() { CommandBuilder p = getNewCommandPlayerToPlay(); - if (p != null) { - notifyOnVoiceMessage(); - p.backOnRoute().play(); + if (announceBackOnRoute == true) { + if (p != null) { + notifyOnVoiceMessage(); + p.backOnRoute().play(); + } + announceBackOnRoute = false; } } @@ -426,6 +431,7 @@ public class VoiceRouter { currentStatus = STATUS_UNKNOWN; suppressDest = false; playedAndArriveAtTarget = false; + announceBackOnRoute = false; if (playGoAheadDist != -1) { playGoAheadDist = 0; }