Fix #8087
This commit is contained in:
parent
411e87f9e0
commit
5c10ad31f7
5 changed files with 15 additions and 16 deletions
|
@ -4,6 +4,7 @@ import java.util.Collections;
|
|||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.MapObject;
|
||||
import net.osmand.data.QuadPoint;
|
||||
|
@ -616,6 +617,12 @@ public class MapUtils {
|
|||
r.bottom = Math.min(r.bottom, latitude);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean areLatLonEqual(Location l1, Location l2) {
|
||||
return l1 == null && l2 == null
|
||||
|| (l1 != null && l2 != null && Math.abs(l1.getLatitude() - l2.getLatitude()) < 0.00001
|
||||
&& Math.abs(l1.getLongitude() - l2.getLongitude()) < 0.00001);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
|||
private boolean locationUpdateStarted;
|
||||
private boolean compassUpdateAllowed = true;
|
||||
private PointType pointType;
|
||||
private Location location;
|
||||
private float lastHeading;
|
||||
|
||||
private FavoritesListener favoritesListener;
|
||||
|
@ -213,7 +214,10 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
|||
|
||||
@Override
|
||||
public void updateLocation(Location location) {
|
||||
updateLocationUi();
|
||||
if (!MapUtils.areLatLonEqual(this.location, location)) {
|
||||
this.location = location;
|
||||
updateLocationUi();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1413,11 +1413,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
|
||||
@Override
|
||||
public void updateLocation(Location location) {
|
||||
boolean newLocation = this.location == null && location != null;
|
||||
boolean locationChanged = this.location != null && location != null
|
||||
&& this.location.getLatitude() != location.getLatitude()
|
||||
&& this.location.getLongitude() != location.getLongitude();
|
||||
if (newLocation || locationChanged) {
|
||||
if (!MapUtils.areLatLonEqual(this.location, location)) {
|
||||
this.location = location;
|
||||
updateLocationUi();
|
||||
}
|
||||
|
|
|
@ -160,11 +160,7 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
|
|||
|
||||
@Override
|
||||
public void updateLocation(Location location) {
|
||||
boolean newLocation = this.location == null && location != null;
|
||||
boolean locationChanged = this.location != null && location != null
|
||||
&& this.location.getLatitude() != location.getLatitude()
|
||||
&& this.location.getLongitude() != location.getLongitude();
|
||||
if (newLocation || locationChanged) {
|
||||
if (!MapUtils.areLatLonEqual(this.location, location)) {
|
||||
this.location = location;
|
||||
updateLocationUi();
|
||||
}
|
||||
|
|
|
@ -441,11 +441,7 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
|
|||
|
||||
@Override
|
||||
public void updateLocation(Location location) {
|
||||
boolean newLocation = this.location == null && location != null;
|
||||
boolean locationChanged = this.location != null && location != null
|
||||
&& this.location.getLatitude() != location.getLatitude()
|
||||
&& this.location.getLongitude() != location.getLongitude();
|
||||
if (newLocation || locationChanged) {
|
||||
if (!MapUtils.areLatLonEqual(this.location, location)) {
|
||||
this.location = location;
|
||||
updateLocationUi();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue