Add message for gps recover. It is still a question what to pronounce 'continue go ahead' or 'gps signal recovers'

This commit is contained in:
vshcherb 2013-10-24 10:24:17 +02:00
parent e3e2c16a0f
commit 618a0c413f
3 changed files with 26 additions and 0 deletions

View file

@ -51,6 +51,7 @@ public class OsmAndLocationProvider implements SensorEventListener {
private static final int NOT_SWITCH_TO_NETWORK_WHEN_GPS_LOST_MS = 12000;
private long lastTimeGPSLocationFixed = 0;
private boolean gpsSignalLost;
private boolean sensorRegistered = false;
private float[] mGravs = new float[3];
@ -417,6 +418,13 @@ public class OsmAndLocationProvider implements SensorEventListener {
public void onLocationChanged(Location location) {
if (location != null) {
lastTimeGPSLocationFixed = location.getTime();
if(gpsSignalLost) {
gpsSignalLost = false;
final RoutingHelper routingHelper = app.getRoutingHelper();
if (routingHelper.isFollowingMode() && routingHelper.getLeftDistance() > 0) {
routingHelper.getVoiceRouter().gpsLocationRecover();
}
}
}
if(!locationSimulation.isRouteAnimating()) {
setLocation(convertLocation(location, app));
@ -537,6 +545,7 @@ public class OsmAndLocationProvider implements SensorEventListener {
// false positive case, still strange how we got here with removeMessages
return;
}
gpsSignalLost = true;
if (routingHelper.isFollowingMode() && routingHelper.getLeftDistance() > 0) {
routingHelper.getVoiceRouter().gpsLocationLost();
}

View file

@ -562,6 +562,14 @@ public class VoiceRouter {
play.gpsLocationLost().play();
}
}
public void gpsLocationRecover() {
CommandBuilder play = getNewCommandPlayerToPlay();
if (play != null) {
play.gpsLocationRecover().play();
}
}
public void newRouteIsCalculated(boolean newRoute) {
CommandBuilder play = getNewCommandPlayerToPlay();
@ -641,5 +649,7 @@ public class VoiceRouter {
}
}
}

View file

@ -40,6 +40,7 @@ public class CommandBuilder {
protected static final String C_ROUTE_RECALC = "route_recalc"; //$NON-NLS-1$
protected static final String C_ROUTE_NEW_CALC = "route_new_calc"; //$NON-NLS-1$
protected static final String C_LOCATION_LOST = "location_lost"; //$NON-NLS-1$
protected static final String C_LOCATION_RECOVERED = "location_recovered"; //$NON-NLS-1$
/**
*
@ -208,6 +209,10 @@ public class CommandBuilder {
return addCommand(C_LOCATION_LOST);
}
public CommandBuilder gpsLocationRecover() {
return addCommand(C_LOCATION_RECOVERED);
}
public CommandBuilder newRouteCalculated(double dist, int time){
return alt(prepareStruct(C_ROUTE_NEW_CALC, dist, time), prepareStruct(C_ROUTE_NEW_CALC, dist));
}
@ -227,6 +232,8 @@ public class CommandBuilder {
return this.commandPlayer.execute(listStruct);
}
}