Fix OsmAndLocationProvider#scheduleCheckIfGpsLost

This commit is contained in:
Alex Sytnyk 2018-05-25 18:25:44 +03:00
parent 28c00dd5d6
commit b05547e9f9

View file

@ -684,7 +684,8 @@ public class OsmAndLocationProvider implements SensorEventListener {
private void scheduleCheckIfGpsLost(final net.osmand.Location location) {
final RoutingHelper routingHelper = app.getRoutingHelper();
if (location != null) {
if (location != null && routingHelper.isFollowingMode() && routingHelper.getLeftDistance() > 0
&& simulatePosition == null) {
final long fixTime = location.getTime();
app.runMessageInUIThreadAndCancelPrevious(LOST_LOCATION_MSG_ID, new Runnable() {
@ -702,7 +703,6 @@ public class OsmAndLocationProvider implements SensorEventListener {
setLocation(null);
}
}, LOST_LOCATION_CHECK_DELAY);
if (routingHelper.isFollowingMode() && routingHelper.getLeftDistance() > 0 && simulatePosition == null) {
app.runMessageInUIThreadAndCancelPrevious(START_SIMULATE_LOCATION_MSG_ID, new Runnable() {
@Override
@ -722,7 +722,6 @@ public class OsmAndLocationProvider implements SensorEventListener {
}, START_LOCATION_SIMULATION_DELAY);
}
}
}
public void simulatePosition() {
app.runMessageInUIThreadAndCancelPrevious(RUN_SIMULATE_LOCATION_MSG_ID, new Runnable() {