Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-04-10 15:55:35 +02:00
commit f8dec6fcb3

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,14 +256,12 @@ 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) {