Revert "Avoid concurrent modification of location listeners"

This reverts commit 8af96a20b5.
This commit is contained in:
max-klaus 2021-02-26 18:01:32 +03:00
parent 9d68026b38
commit 58a07ad777

View file

@ -373,30 +373,22 @@ public class OsmAndLocationProvider implements SensorEventListener {
public void addLocationListener(@NonNull OsmAndLocationListener listener) {
if (!locationListeners.contains(listener)) {
List<OsmAndLocationListener> listeners = new ArrayList<>(locationListeners);
listeners.add(listener);
locationListeners = listeners;
locationListeners.add(listener);
}
}
public void removeLocationListener(@NonNull OsmAndLocationListener listener) {
List<OsmAndLocationListener> listeners = new ArrayList<>(locationListeners);
listeners.remove(listener);
locationListeners = listeners;
locationListeners.remove(listener);
}
public void addCompassListener(@NonNull OsmAndCompassListener listener) {
if (!compassListeners.contains(listener)) {
List<OsmAndCompassListener> listeners = new ArrayList<>(compassListeners);
listeners.add(listener);
compassListeners = listeners;
compassListeners.add(listener);
}
}
public void removeCompassListener(@NonNull OsmAndCompassListener listener) {
List<OsmAndCompassListener> listeners = new ArrayList<>(compassListeners);
listeners.remove(listener);
compassListeners = listeners;
compassListeners.remove(listener);
}
@Nullable