Code example for AppStateClient

Methods: connectisConnected

0
        if (mPlusClient != null && mPlusClient.isConnected() &&
                (0 == (mConnectedClients & CLIENT_PLUS))) {
            Log.w(mDebugTag, "*** WARNING: PlusClient was already connected. Fixing.");
            mConnectedClients |= CLIENT_PLUS;
        } 
        if (mAppStateClient != null && mAppStateClient.isConnected() &&
                (0 == (mConnectedClients & CLIENT_APPSTATE))) {
            Log.w(mDebugTag, "*** WARNING: AppStateClient was already connected. Fixing");
            mConnectedClients |= CLIENT_APPSTATE;
        } 
 
        int pendingClients = mRequestedClients & ~mConnectedClients;
        debugLog("Pending clients: " + pendingClients);
 
        if (pendingClients == 0) {
            debugLog("All clients now connected. Sign-in successful!"); 
            succeedSignIn(); 
            return; 
        } 
 
        // which client should be the next one to connect? 
        if (mGamesClient != null && (0 != (pendingClients & CLIENT_GAMES))) {
            debugLog("Connecting GamesClient."); 
            mClientCurrentlyConnecting = CLIENT_GAMES;
        } else if (mPlusClient != null && (0 != (pendingClients & CLIENT_PLUS))) {
            debugLog("Connecting PlusClient."); 
            mClientCurrentlyConnecting = CLIENT_PLUS;
        } else if (mAppStateClient != null && (0 != (pendingClients & CLIENT_APPSTATE))) {
            debugLog("Connecting AppStateClient."); 
            mClientCurrentlyConnecting = CLIENT_APPSTATE;
        } else { 
            // hmmm, getting here would be a bug. 
            throw new AssertionError("Not all clients connected, yet no one is next. R="
                    + mRequestedClients + ", C=" + mConnectedClients);
        } 
 
        connectCurrentClient(); 
    } 
 
    void connectCurrentClient() { 
        assertState("connectCurrentClient", STATE_CONNECTING);
        switch (mClientCurrentlyConnecting) {
            case CLIENT_GAMES:
                mGamesClient.connect();
                break; 
            case CLIENT_APPSTATE:
                mAppStateClient.connect();
                break; 
            case CLIENT_PLUS:
                mPlusClient.connect();
                break; 
        } 
Connect your IDE to all the code out there  Get Codota for Java