diff options
Diffstat (limited to 'main/src/cgeo/geocaching/maps/CGeoMap.java')
| -rw-r--r-- | main/src/cgeo/geocaching/maps/CGeoMap.java | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index fbbd80d..cf90430 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -450,6 +450,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto mapView.repaintRequired(null); mapView.getMapController().setZoom(Settings.getMapZoom()); + mapView.getMapController().setCenter(Settings.getMapCenter()); if (null == mapStateIntent) { followMyLocation = mapMode == MapMode.LIVE_OFFLINE || mapMode == MapMode.LIVE_ONLINE; @@ -855,11 +856,12 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto } Settings.setMapZoom(mapView.getMapZoomLevel()); + Settings.setMapCenter(mapView.getMapViewCenter()); } // Set center of map to my location if appropriate. private void myLocationInMiddle(final IGeoData geo) { - if (followMyLocation) { + if (followMyLocation && !geo.isPseudoLocation()) { centerMap(geo.getCoords()); } } @@ -876,19 +878,26 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto private static final float MIN_LOCATION_DELTA = 0.01f; Location currentLocation = new Location(""); + boolean locationValid = false; float currentHeading; private long timeLastPositionOverlayCalculation = 0; @Override protected void updateGeoData(final IGeoData geo) { - currentLocation = geo.getLocation(); + if (geo.isPseudoLocation()) { + locationValid = false; + } else { + locationValid = true; - if (!Settings.isUseCompass() || geo.getSpeed() > 5) { // use GPS when speed is higher than 18 km/h - currentHeading = geo.getBearing(); - } + currentLocation = geo.getLocation(); + + if (!Settings.isUseCompass() || geo.getSpeed() > 5) { // use GPS when speed is higher than 18 km/h + currentHeading = geo.getBearing(); + } - repaintPositionOverlay(); + repaintPositionOverlay(); + } } @Override @@ -939,6 +948,11 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto } boolean needsRepaintForDistance() { + + if (!locationValid) { + return false; + } + final Location lastLocation = overlayPosition.getCoordinates(); float dist = Float.MAX_VALUE; |
