diff --git a/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java b/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java index 78342c607e..e03d3c71a0 100644 --- a/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java +++ b/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java @@ -48,6 +48,7 @@ public class OsmAndLocationProvider implements SensorEventListener { public static final String SIMULATED_PROVIDER = "OsmAnd"; + public static final long LOCATION_SHELF_LIFE = 1000 * 60 * 60; // 60 minutes public interface OsmAndLocationListener { void updateLocation(net.osmand.Location location); diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java index 7304f7f524..5e46bda6b9 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java @@ -113,7 +113,7 @@ public class MapInfoWidgetsFactory { } public TextInfoWidget createRulerControl(final MapActivity map) { - final String title = "-"; + final String title = "—"; final TextInfoWidget rulerControl = new TextInfoWidget(map) { RulerControlLayer rulerLayer = map.getMapLayers().getRulerControlLayer(); LatLon cacheFirstTouchPoint = new LatLon(0, 0); diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java index 79923b443f..4be236c653 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java @@ -12,6 +12,7 @@ import net.osmand.plus.IconsCache; import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.OsmAndFormatter; +import net.osmand.plus.OsmAndLocationProvider; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.dashboard.DashLocationFragment; @@ -55,7 +56,7 @@ public class MapMarkersWidgetsFactory { private ImageButton moreButton2nd; private LatLon loc; - private LatLon lastKnownPosition; + private Location lastKnownPosition; public MapMarkersWidgetsFactory(final MapActivity map) { this.map = map; @@ -189,9 +190,16 @@ public class MapMarkersWidgetsFactory { Location l = map.getMapViewTrackingUtilities().getMyLocation(); if (l != null) { loc = new LatLon(l.getLatitude(), l.getLongitude()); - lastKnownPosition = loc; + lastKnownPosition = l; + } else if (lastKnownPosition == null) { + loc = null; } else { - loc = lastKnownPosition; + if (System.currentTimeMillis() - lastKnownPosition.getTime() < OsmAndLocationProvider.LOCATION_SHELF_LIFE) { + loc = new LatLon(lastKnownPosition.getLatitude(), lastKnownPosition.getLongitude()); + } else { + loc = null; + lastKnownPosition = null; + } } }