diff options
author | max-klaus <max.klaus@osmand.net> | 2019-10-24 14:59:24 +0300 |
---|---|---|
committer | max-klaus <max.klaus@osmand.net> | 2019-10-24 14:59:24 +0300 |
commit | 2a8ca3e519f966b12e63cc0567e8053388b2b892 (patch) | |
tree | f3bad600c741186dcc2ec744d635b55190fef45d | |
parent | 3aca9c04839fc3042804d161b6b803c02fa9d595 (diff) | |
download | Osmand-2a8ca3e519f966b12e63cc0567e8053388b2b892.tar.gz |
Fix #5068
-rw-r--r-- | OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java b/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java index e07e04d1d4..52cfae025e 100644 --- a/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java +++ b/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java @@ -340,14 +340,16 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc public void backToLocationImpl(int zoom, boolean forceZoom) { if (mapView != null) { OsmAndLocationProvider locationProvider = app.getLocationProvider(); + net.osmand.Location lastKnownLocation = locationProvider.getLastKnownLocation(); + net.osmand.Location lastStaleKnownLocation = locationProvider.getLastStaleKnownLocation(); + net.osmand.Location location = lastKnownLocation != null ? lastKnownLocation : lastStaleKnownLocation; if (!isMapLinkedToLocation()) { setMapLinkedToLocation(true); - net.osmand.Location lastKnownLocation = locationProvider.getLastKnownLocation(); - if (lastKnownLocation != null) { + if (location != null) { AnimateDraggingMapThread thread = mapView.getAnimatedDraggingThread(); int fZoom = mapView.getZoom() < zoom && (forceZoom || app.getSettings().AUTO_ZOOM_MAP.get()) ? zoom : mapView.getZoom(); movingToMyLocation = true; - thread.startMoving(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude(), + thread.startMoving(location.getLatitude(), location.getLongitude(), fZoom, false, new Runnable() { @Override public void run() { @@ -357,7 +359,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc } mapView.refreshMap(); } - if (locationProvider.getLastKnownLocation() == null) { + if (location == null) { app.showToastMessage(R.string.unknown_location); } } |