Ejemplo n.º 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();
   }
 }
Ejemplo n.º 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);
  }
Ejemplo n.º 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();
    }
  }
Ejemplo n.º 4
0
 @Override
 public void onSignOutComplete() {
   dismissDialog();
   if (mGamesClient.isConnected()) mGamesClient.disconnect();
 }