diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-07-09 22:11:11 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-07-09 22:11:11 +0200 |
commit | 83f53eb8e93212313aa8003d1e478d7eb9d7986c (patch) | |
tree | f01fe9af12e22e7e856747bca19003e0c9887db7 /src/main/java/de/pixart/messenger/ui | |
parent | da802b4248998584c9233a1b268020f8df2696af (diff) |
use sets instead of list for listeners
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/XmppActivity.java | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index e52e3dbaf..f52b2d72c 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -61,7 +61,6 @@ import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.RejectedExecutionException; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import de.pixart.messenger.Config; @@ -99,7 +98,6 @@ public abstract class XmppActivity extends ActionBarActivity { public XmppConnectionService xmppConnectionService; public boolean xmppConnectionServiceBound = false; - protected final AtomicBoolean registeredListeners = new AtomicBoolean(false); protected int mColorRed; protected int mColorWarningButton; @@ -122,9 +120,7 @@ public abstract class XmppActivity extends ActionBarActivity { XmppConnectionBinder binder = (XmppConnectionBinder) service; xmppConnectionService = binder.getService(); xmppConnectionServiceBound = true; - if (registeredListeners.compareAndSet(false, true)) { - registerListeners(); - } + registerListeners(); invalidateOptionsMenu(); onBackendConnected(); } @@ -228,9 +224,7 @@ public abstract class XmppActivity extends ActionBarActivity { connectToBackend(); } } else { - if (registeredListeners.compareAndSet(false, true)) { - this.registerListeners(); - } + this.registerListeners(); this.onBackendConnected(); } } @@ -246,9 +240,7 @@ public abstract class XmppActivity extends ActionBarActivity { protected void onStop() { super.onStop(); if (xmppConnectionServiceBound) { - if (registeredListeners.compareAndSet(true, false)) { - this.unregisterListeners(); - } + this.unregisterListeners(); unbindService(mConnection); xmppConnectionServiceBound = false; } |