fix issue with back on route prompt

This commit is contained in:
sonora 2016-05-20 12:30:56 +02:00
parent e6a0064586
commit 8460856d98
2 changed files with 10 additions and 9 deletions

View file

@ -82,9 +82,6 @@ public class RoutingHelper {
private RouteCalculationProgressCallback progressRoute; private RouteCalculationProgressCallback progressRoute;
private boolean announceBackOnRoute = false;
// private ProgressBar progress; // private ProgressBar progress;
// private Handler progressHandler; // private Handler progressHandler;
@ -322,7 +319,6 @@ public class RoutingHelper {
if(dist > 350) { if(dist > 350) {
if (isFollowingMode) { if (isFollowingMode) {
voiceRouter.announceOffRoute(dist); voiceRouter.announceOffRoute(dist);
announceBackOnRoute = true;
} }
} }
} }
@ -373,9 +369,8 @@ public class RoutingHelper {
if(!thread.isParamsChanged()) { if(!thread.isParamsChanged()) {
thread.stopCalculation(); thread.stopCalculation();
} }
if (announceBackOnRoute && isFollowingMode){ if (isFollowingMode){
voiceRouter.announceBackOnRoute(); voiceRouter.announceBackOnRoute();
announceBackOnRoute = false;
} }
} }
} }

View file

@ -48,6 +48,7 @@ public class VoiceRouter {
private long waitAnnouncedSpeedLimit = 0; private long waitAnnouncedSpeedLimit = 0;
private long waitAnnouncedOffRoute = 0; private long waitAnnouncedOffRoute = 0;
private boolean suppressDest = false; private boolean suppressDest = false;
private boolean announceBackOnRoute = false;
// private long lastTimeRouteRecalcAnnounced = 0; // private long lastTimeRouteRecalcAnnounced = 0;
@ -220,6 +221,7 @@ public class VoiceRouter {
if (p != null) { if (p != null) {
notifyOnVoiceMessage(); notifyOnVoiceMessage();
p.offRoute(dist).play(); p.offRoute(dist).play();
announceBackOnRoute = true;
} }
if(waitAnnouncedOffRoute == 0) { if(waitAnnouncedOffRoute == 0) {
waitAnnouncedOffRoute = 60000; waitAnnouncedOffRoute = 60000;
@ -232,10 +234,13 @@ public class VoiceRouter {
public void announceBackOnRoute() { public void announceBackOnRoute() {
CommandBuilder p = getNewCommandPlayerToPlay(); CommandBuilder p = getNewCommandPlayerToPlay();
if (announceBackOnRoute == true) {
if (p != null) { if (p != null) {
notifyOnVoiceMessage(); notifyOnVoiceMessage();
p.backOnRoute().play(); p.backOnRoute().play();
} }
announceBackOnRoute = false;
}
} }
public void approachWaypoint(Location location, List<LocationPointWrapper> points){ public void approachWaypoint(Location location, List<LocationPointWrapper> points){
@ -426,6 +431,7 @@ public class VoiceRouter {
currentStatus = STATUS_UNKNOWN; currentStatus = STATUS_UNKNOWN;
suppressDest = false; suppressDest = false;
playedAndArriveAtTarget = false; playedAndArriveAtTarget = false;
announceBackOnRoute = false;
if (playGoAheadDist != -1) { if (playGoAheadDist != -1) {
playGoAheadDist = 0; playGoAheadDist = 0;
} }