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(); } }
/** 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); }
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(); } }
void connectCurrentClient() { switch (mClientCurrentlyConnecting) { case CLIENT_GAMES: mGamesClient.connect(); break; case CLIENT_APPSTATE: mAppStateClient.connect(); break; case CLIENT_PLUS: mPlusClient.connect(); break; } }
@Override public void onSignOutComplete() { dismissDialog(); if (mGamesClient.isConnected()) mGamesClient.disconnect(); }