Enable messages in route simulation

This commit is contained in:
vshcherb 2013-10-30 23:19:06 +01:00
parent f3f9c0038b
commit 91f5b23f57

View file

@ -529,13 +529,6 @@ public class OsmAndLocationProvider implements SensorEventListener {
public void onLocationChanged(Location location) { public void onLocationChanged(Location location) {
if (location != null) { if (location != null) {
lastTimeGPSLocationFixed = location.getTime(); lastTimeGPSLocationFixed = location.getTime();
if(gpsSignalLost) {
gpsSignalLost = false;
final RoutingHelper routingHelper = app.getRoutingHelper();
if (routingHelper.isFollowingMode() && routingHelper.getLeftDistance() > 0) {
routingHelper.getVoiceRouter().gpsLocationRecover();
}
}
} }
if(!locationSimulation.isRouteAnimating()) { if(!locationSimulation.isRouteAnimating()) {
setLocation(convertLocation(location, app)); setLocation(convertLocation(location, app));
@ -677,7 +670,7 @@ public class OsmAndLocationProvider implements SensorEventListener {
if(tunnel != null) { if(tunnel != null) {
simulatePosition = new SimulationProvider(); simulatePosition = new SimulationProvider();
simulatePosition.startSimulation(tunnel, location); simulatePosition.startSimulation(tunnel, location);
simulatePosition(); simulatePositionImpl();
} }
} }
}, START_LOCATION_SIMULATION_DELAY); }, START_LOCATION_SIMULATION_DELAY);
@ -690,6 +683,12 @@ public class OsmAndLocationProvider implements SensorEventListener {
@Override @Override
public void run() { public void run() {
simulatePositionImpl();
}
}, 1000);
}
private void simulatePositionImpl() {
if(simulatePosition != null){ if(simulatePosition != null){
net.osmand.Location loc = simulatePosition.getSimulatedLocation(); net.osmand.Location loc = simulatePosition.getSimulatedLocation();
if(loc != null){ if(loc != null){
@ -700,8 +699,6 @@ public class OsmAndLocationProvider implements SensorEventListener {
} }
} }
} }
}, 1000);
}
public void setLocationFromService(net.osmand.Location location, boolean continuous) { public void setLocationFromService(net.osmand.Location location, boolean continuous) {
@ -727,6 +724,13 @@ public class OsmAndLocationProvider implements SensorEventListener {
} }
if(location != null) { if(location != null) {
simulatePosition = null; simulatePosition = null;
if(gpsSignalLost) {
gpsSignalLost = false;
final RoutingHelper routingHelper = app.getRoutingHelper();
if (routingHelper.isFollowingMode() && routingHelper.getLeftDistance() > 0) {
routingHelper.getVoiceRouter().gpsLocationRecover();
}
}
} }
enhanceLocation(location); enhanceLocation(location);
scheduleCheckIfGpsLost(location); scheduleCheckIfGpsLost(location);