Enable messages in route simulation
This commit is contained in:
parent
f3f9c0038b
commit
91f5b23f57
1 changed files with 21 additions and 17 deletions
|
@ -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,19 +683,23 @@ public class OsmAndLocationProvider implements SensorEventListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(simulatePosition != null){
|
simulatePositionImpl();
|
||||||
net.osmand.Location loc = simulatePosition.getSimulatedLocation();
|
|
||||||
if(loc != null){
|
|
||||||
setLocation(loc);
|
|
||||||
simulatePosition();
|
|
||||||
} else {
|
|
||||||
simulatePosition = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void simulatePositionImpl() {
|
||||||
|
if(simulatePosition != null){
|
||||||
|
net.osmand.Location loc = simulatePosition.getSimulatedLocation();
|
||||||
|
if(loc != null){
|
||||||
|
setLocation(loc);
|
||||||
|
simulatePosition();
|
||||||
|
} else {
|
||||||
|
simulatePosition = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setLocationFromService(net.osmand.Location location, boolean continuous) {
|
public void setLocationFromService(net.osmand.Location location, boolean continuous) {
|
||||||
// if continuous notify about lost location
|
// if continuous notify about lost location
|
||||||
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue