From 392d83dbb205bbd5aaaeba4a74855dbd0356a15a Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Sun, 10 Apr 2016 16:55:10 +0300 Subject: [PATCH] Fix AND-451(4) --- .../mapwidgets/MapMarkersWidgetsFactory.java | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java index 5f919cf716..d2a0c69489 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java @@ -54,8 +54,7 @@ public class MapMarkersWidgetsFactory { private ImageButton moreButton2nd; private LatLon loc; - private MapMarker marker; - private MapMarker marker2nd; + private LatLon lastKnownPosition; public MapMarkersWidgetsFactory(final MapActivity map) { this.map = map; @@ -184,8 +183,9 @@ public class MapMarkersWidgetsFactory { Location l = map.getMapViewTrackingUtilities().getMyLocation(); if (l != null) { loc = new LatLon(l.getLatitude(), l.getLongitude()); + lastKnownPosition = loc; } else { - loc = null; + loc = lastKnownPosition; } } @@ -256,13 +256,11 @@ public class MapMarkersWidgetsFactory { arrowImg.invalidate(); int dist = (int) mes[0]; - String txt = null; + String txt; if (loc != null) { txt = OsmAndFormatter.getFormattedDistance(dist, map.getMyApplication()); } else { - if ((firstLine && marker != this.marker) || (!firstLine && marker != this.marker2nd)) { - txt = "—"; - } + txt = "—"; } if (txt != null) { distText.setText(txt); @@ -281,13 +279,6 @@ public class MapMarkersWidgetsFactory { } addressText.setText(descr); - - if (firstLine) { - this.marker = marker; - } else { - this.marker2nd = marker; - } - } public TextInfoWidget createMapMarkerControl(final MapActivity map, final boolean firstMarker) {