Revert "Avoid concurrent modification of location listeners"
This reverts commit 8af96a20b5
.
This commit is contained in:
parent
9d68026b38
commit
58a07ad777
1 changed files with 4 additions and 12 deletions
|
@ -373,30 +373,22 @@ public class OsmAndLocationProvider implements SensorEventListener {
|
||||||
|
|
||||||
public void addLocationListener(@NonNull OsmAndLocationListener listener) {
|
public void addLocationListener(@NonNull OsmAndLocationListener listener) {
|
||||||
if (!locationListeners.contains(listener)) {
|
if (!locationListeners.contains(listener)) {
|
||||||
List<OsmAndLocationListener> listeners = new ArrayList<>(locationListeners);
|
locationListeners.add(listener);
|
||||||
listeners.add(listener);
|
|
||||||
locationListeners = listeners;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeLocationListener(@NonNull OsmAndLocationListener listener) {
|
public void removeLocationListener(@NonNull OsmAndLocationListener listener) {
|
||||||
List<OsmAndLocationListener> listeners = new ArrayList<>(locationListeners);
|
locationListeners.remove(listener);
|
||||||
listeners.remove(listener);
|
|
||||||
locationListeners = listeners;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCompassListener(@NonNull OsmAndCompassListener listener) {
|
public void addCompassListener(@NonNull OsmAndCompassListener listener) {
|
||||||
if (!compassListeners.contains(listener)) {
|
if (!compassListeners.contains(listener)) {
|
||||||
List<OsmAndCompassListener> listeners = new ArrayList<>(compassListeners);
|
compassListeners.add(listener);
|
||||||
listeners.add(listener);
|
|
||||||
compassListeners = listeners;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeCompassListener(@NonNull OsmAndCompassListener listener) {
|
public void removeCompassListener(@NonNull OsmAndCompassListener listener) {
|
||||||
List<OsmAndCompassListener> listeners = new ArrayList<>(compassListeners);
|
compassListeners.remove(listener);
|
||||||
listeners.remove(listener);
|
|
||||||
compassListeners = listeners;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
Loading…
Reference in a new issue