예제 #1
0
 void killConnections(int whatClients) {
   if ((whatClients & CLIENT_GAMES) != 0 && mGamesClient != null && mGamesClient.isConnected()) {
     mConnectedClients &= ~CLIENT_GAMES;
     mGamesClient.disconnect();
   }
   if ((whatClients & CLIENT_PLUS) != 0 && mPlusClient != null && mPlusClient.isConnected()) {
     mConnectedClients &= ~CLIENT_PLUS;
     mPlusClient.disconnect();
   }
   if ((whatClients & CLIENT_APPSTATE) != 0
       && mAppStateClient != null
       && mAppStateClient.isConnected()) {
     mConnectedClients &= ~CLIENT_APPSTATE;
     mAppStateClient.disconnect();
   }
 }
예제 #2
0
  /** Sign out and disconnect from the APIs. */
  public void signOut() {
    mConnectionResult = null;
    mAutoSignIn = false;
    mSignedIn = false;
    mSignInError = false;

    if (mPlusClient != null && mPlusClient.isConnected()) {
      mPlusClient.clearDefaultAccount();
    }
    if (mGamesClient != null && mGamesClient.isConnected()) {
      showProgressDialog(false);
      mGamesClient.signOut(this);
    }

    // kill connects to all clients but games, which must remain
    // connected til we get onSignOutComplete()
    killConnections(CLIENT_ALL & ~CLIENT_GAMES);
  }
예제 #3
0
  public void reconnectClients(int whatClients) {
    showProgressDialog(true);

    if ((whatClients & CLIENT_GAMES) != 0 && mGamesClient != null && mGamesClient.isConnected()) {
      mConnectedClients &= ~CLIENT_GAMES;
      mGamesClient.reconnect();
    }
    if ((whatClients & CLIENT_APPSTATE) != 0
        && mAppStateClient != null
        && mAppStateClient.isConnected()) {
      mConnectedClients &= ~CLIENT_APPSTATE;
      mAppStateClient.reconnect();
    }
    if ((whatClients & CLIENT_PLUS) != 0 && mPlusClient != null && mPlusClient.isConnected()) {
      mConnectedClients &= ~CLIENT_PLUS;
      mPlusClient.disconnect();
      mPlusClient.connect();
    }
  }
예제 #4
0
 void connectCurrentClient() {
   switch (mClientCurrentlyConnecting) {
     case CLIENT_GAMES:
       mGamesClient.connect();
       break;
     case CLIENT_APPSTATE:
       mAppStateClient.connect();
       break;
     case CLIENT_PLUS:
       mPlusClient.connect();
       break;
   }
 }
예제 #5
0
 @Override
 public void onSignOutComplete() {
   dismissDialog();
   if (mGamesClient.isConnected()) mGamesClient.disconnect();
 }