Skip to content

Commit

Permalink
Should prevent "is your activity running?" issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Rantanen authored and pcgod committed Nov 24, 2010
1 parent e6a2448 commit 53af937
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/org/pcgod/mumbleclient/app/ConnectedActivityLogic.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public void onConnectionStateChanged(final int state) throws RemoteException {
public void onServiceConnected(
final ComponentName className,
final IBinder binder) {
if (paused) {
// Don't bother doing anything if the activity is already paused.
return;
}

final MumbleService service = ((MumbleService.LocalBinder) binder).getService();
mHost.setService(service);
Log.i("Mumble", "mService set");
Expand All @@ -75,6 +80,7 @@ public void onServiceDisconnected(final ComponentName arg0) {

private IServiceObserver mInternalObserver;
private final Host mHost;
private boolean paused = false;

protected IServiceObserver mObserver;

Expand All @@ -83,6 +89,8 @@ public ConnectedActivityLogic(final Host host) {
}

public void onPause() {
paused = true;

if (mInternalObserver != null) {
mHost.getService().unregisterObserver(mInternalObserver);
mInternalObserver = null;
Expand All @@ -97,6 +105,8 @@ public void onPause() {
}

public void onResume() {
paused = false;

final Intent intent = new Intent(
mHost.getApplicationContext(),
MumbleService.class);
Expand Down

0 comments on commit 53af937

Please sign in to comment.