Fix AND-451(4)

This commit is contained in:
Alexey Kulish 2016-04-10 16:55:10 +03:00
parent 95819c8f9f
commit 392d83dbb2

View file

@ -54,8 +54,7 @@ public class MapMarkersWidgetsFactory {
private ImageButton moreButton2nd; private ImageButton moreButton2nd;
private LatLon loc; private LatLon loc;
private MapMarker marker; private LatLon lastKnownPosition;
private MapMarker marker2nd;
public MapMarkersWidgetsFactory(final MapActivity map) { public MapMarkersWidgetsFactory(final MapActivity map) {
this.map = map; this.map = map;
@ -184,8 +183,9 @@ public class MapMarkersWidgetsFactory {
Location l = map.getMapViewTrackingUtilities().getMyLocation(); Location l = map.getMapViewTrackingUtilities().getMyLocation();
if (l != null) { if (l != null) {
loc = new LatLon(l.getLatitude(), l.getLongitude()); loc = new LatLon(l.getLatitude(), l.getLongitude());
lastKnownPosition = loc;
} else { } else {
loc = null; loc = lastKnownPosition;
} }
} }
@ -256,13 +256,11 @@ public class MapMarkersWidgetsFactory {
arrowImg.invalidate(); arrowImg.invalidate();
int dist = (int) mes[0]; int dist = (int) mes[0];
String txt = null; String txt;
if (loc != null) { if (loc != null) {
txt = OsmAndFormatter.getFormattedDistance(dist, map.getMyApplication()); txt = OsmAndFormatter.getFormattedDistance(dist, map.getMyApplication());
} else { } else {
if ((firstLine && marker != this.marker) || (!firstLine && marker != this.marker2nd)) { txt = "";
txt = "";
}
} }
if (txt != null) { if (txt != null) {
distText.setText(txt); distText.setText(txt);
@ -281,13 +279,6 @@ public class MapMarkersWidgetsFactory {
} }
addressText.setText(descr); addressText.setText(descr);
if (firstLine) {
this.marker = marker;
} else {
this.marker2nd = marker;
}
} }
public TextInfoWidget createMapMarkerControl(final MapActivity map, final boolean firstMarker) { public TextInfoWidget createMapMarkerControl(final MapActivity map, final boolean firstMarker) {