simplify voice router code

This commit is contained in:
sonora 2016-07-18 22:20:09 +02:00
parent fa774ae68d
commit 6c2e1bf5a9

View file

@ -115,7 +115,7 @@ public class VoiceRouter {
if(player == null){
return null;
}
lastAnnouncement = System.currentTimeMillis();
lastAnnouncement = System.currentTimeMillis();
return player.newCommandBuilder();
}
@ -800,33 +800,17 @@ public class VoiceRouter {
public void newRouteIsCalculated(boolean newRoute) {
CommandBuilder play = getNewCommandPlayerToPlay();
if (play != null) {
if (!newRoute) {
// Suppress "route recalculated" prompt for 60sec (this workaround now outdated after more intelligent route recalculation and directional voice prompt suppression)
//if (router.getCurrentGPXRoute() == null && (System.currentTimeMillis() - lastTimeRouteRecalcAnnounced > 60000)) {
// Suppress "route recalculated" prompt for GPX-routing, it makes no sense
//if (router.getCurrentGPXRoute() == null) {
notifyOnVoiceMessage();
play.routeRecalculated(router.getLeftDistance(), router.getLeftTime()).play();
currentStatus = STATUS_UNKNOWN;
suppressDest = false;
//lastTimeRouteRecalcAnnounced = System.currentTimeMillis();
//}
} else {
notifyOnVoiceMessage();
play.newRouteCalculated(router.getLeftDistance(), router.getLeftTime()).play();
playGoAheadDist = -1;
currentStatus = STATUS_UNKNOWN;
suppressDest = false;
}
notifyOnVoiceMessage();
play.routeRecalculated(router.getLeftDistance(), router.getLeftTime()).play();
} else if (player == null) {
pendingCommand = new VoiceCommandPending(!newRoute ? VoiceCommandPending.ROUTE_RECALCULATED
: VoiceCommandPending.ROUTE_CALCULATED, this);
if (newRoute) {
playGoAheadDist = -1;
}
currentStatus = STATUS_UNKNOWN;
suppressDest = false;
}
if (newRoute) {
playGoAheadDist = -1;
}
currentStatus = STATUS_UNKNOWN;
suppressDest = false;
nextRouteDirection = null;
}