Java 类com.facebook.SessionState 实例源码

项目:yelo-android    文件:EditProfileFragment.java   
@Override
public void call(final Session session, SessionState state, Exception exception) {


    if (state.isOpened()) {
        final Map<String, String> params = new HashMap<String, String>(3);
        params.put(HttpConstants.ACCESS_TOKEN, session.getAccessToken());
        //TODO enable field when the permission is accepted
        params.put(HttpConstants.FIELDS, HttpConstants.FaceBookConstants.ID + "," +
                HttpConstants.FaceBookConstants.NAME + "," +
                HttpConstants.FaceBookConstants.BIO + "," +
                HttpConstants.FaceBookConstants.ABOUT);

        RetroCallback retroCallback;
        retroCallback = new RetroCallback(this);
        retroCallback.setRequestId(HttpConstants.ApiResponseCodes.GET_FACEBOOK_PROFILE);
        retroCallbackList.add(retroCallback);
        mProgressBar.setVisibility(View.VISIBLE);
        mFacebookApi.getFacebookProfile(params, retroCallback);
    }

}
项目:blindr    文件:SplashscreenActivity.java   
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
    Log.i("SplashscreenActivity", "onSessionStateChange");
    Controller.getInstance().setSession(session);
    if(state.isOpened() && !mConnected){
        mConnected = true;
        session.refreshPermissions();
        List<String> permissions = session.getPermissions();
        Log.i("FACEBOOK_CONNECTION", "Logged in..." + permissions.toString());
        findViewById(R.id.authButton).setVisibility(View.GONE);
        findViewById(R.id.progressBar).setVisibility(View.VISIBLE);
        ((ProgressWheel) findViewById(R.id.progressBar)).spin();
        Server.connect(session.getAccessToken());
    } else if(state.isClosed()) {
        mConnected = false;
        Log.i("FACEBOOK_CONNECTION", "Logged out...");
    }
}
项目:house-devs    文件:LoginFragment.java   
/**
 * Changes the UI when an interaction with the Session object occurs with the user.
 * @param session       The current active Session.
 * @param sessionState  The current state of the active Session.
 * @param e             An Exception if there is one.
 */
private void onSessionStateChange(Session session, SessionState sessionState, Exception e) {
    if (sessionState == SessionState.OPENED) {
        Log.d(TAG, "Successful login!");
        new Request(session, "/me", null, HttpMethod.GET, new Request.Callback() {
            @Override
            public void onCompleted(Response response) {
                JSONObject obj = response.getGraphObject().getInnerJSONObject();
                Log.d(TAG, "Got back " + obj + " from Facebook API.");
                UserSession.getInstance().setFacebookData(obj);
                getUserData();
            }
        }).executeAsync();
    } else if (e != null) { // handle exception

    }
}
项目:snake-game-aws    文件:LoginActivity.java   
@Override
public void call(Session session, SessionState state, Exception exception) {
    if (session.isOpened()) {
        setFacebookSession(session);
        // make request to the /me API
        Request.newMeRequest(session, new Request.GraphUserCallback() {

            // callback after Graph API response with user object
            @Override
            public void onCompleted(GraphUser user, Response response) {
                if (user != null) {
                    Toast.makeText(LoginActivity.this,
                            "Hello " + user.getName(), Toast.LENGTH_LONG)
                            .show();
                }
            }
        }).executeAsync();
    }
}
项目:CallService-Facebook-sample    文件:UserHome.java   
private boolean ensureOpenSession() {
    if (Session.getActiveSession() == null
            || !Session.getActiveSession().isOpened()) {
        Session.openActiveSession(this, true, PERMISSIONS,
                new Session.StatusCallback() {
                    @Override
                    public void call(Session session, SessionState state,
                                     Exception exception) {
                        onSessionStateChanged(session, state, exception);
                    }
                });
        return false;
    }
    // friendPickerFragment.loadData(false);

    return true;
}
项目:CallService-Facebook-sample    文件:PickFriendsActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.pick_friends_activity);

    lifecycleHelper = new UiLifecycleHelper(this,
            new Session.StatusCallback() {
                @Override
                public void call(Session session, SessionState state,
                                 Exception exception) {
                    onSessionStateChanged(session, state, exception);
                }
            });
    lifecycleHelper.onCreate(savedInstanceState);

    this.savedInstanceState = savedInstanceState;

    loadFriendPicketFragment();

    ensureOpenSession();

}
项目:CallService-Facebook-sample    文件:PickFriendsActivity.java   
private boolean ensureOpenSession() {
    if (Session.getActiveSession() == null
            || !Session.getActiveSession().isOpened()) {
        Session.openActiveSession(this, true, PERMISSIONS,
                new Session.StatusCallback() {
                    @Override
                    public void call(Session session, SessionState state,
                                     Exception exception) {
                        onSessionStateChanged(session, state, exception);
                    }
                });
        return false;
    }
    if(friendPickerFragment == null) {
        String test;
                test= "0";
    }
    //friendPickerFragment.loadData(false);

    return true;
}
项目:CallService-Facebook-sample    文件:FbLoginActivity.java   
private boolean ensureOpenSession() {
    if (Session.getActiveSession() == null
            || !Session.getActiveSession().isOpened()) {
        Session.openActiveSession(this, true, PERMISSIONS,
                new Session.StatusCallback() {
                    @Override
                    public void call(Session session, SessionState state,
                                     Exception exception) {
                        onSessionStateChanged(session, state, exception);
                    }
                });
        return false;
    }
    makeMeRequest();
    return true;
}
项目:GeoNote    文件:MapViewFragment.java   
@Override
protected void onSessionStateChange(Session session, SessionState state, Exception exception){
    final TextView txtUserDetails = (TextView) mCurrentView.findViewById(R.id.mapViewLoggedInUser);
    if (session != null && session.isOpened()) {
        Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
            @Override
            public void onCompleted(GraphUser user,
                                    Response response) {
                if (user != null) {
                    txtUserDetails.setText("Logged in as " + user.getName());
                    System.out.println("onSessionStateChange: LoadNotes: session is open. username:"+user.getName());
                }
            }
        });
        Request.executeBatchAsync(request);
    } else if (session.isClosed()) {
        txtUserDetails.setText("");
        System.out.println("onSessionStateChange: LoadNotes: session was closed.");
    }
}
项目:GeoNote    文件:BaseFacebookHandlerFragment.java   
private void onSessionStateChangeP(Session session, SessionState state, Exception exception)
{
    if (session != null && session.isOpened()) {
        Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
            @Override
            public void onCompleted(GraphUser user,
                                    Response response) {
                if (user != null) {
                    LoggedInUser = user;
                }
            }
        });
        Request.executeBatchAsync(request);
    } else if (session.isClosed()) {
        LoggedInUser = null;
    }

    onSessionStateChange(session, state, exception);
}
项目:GeoNote    文件:SplashScreenFragment.java   
protected void onSessionStateChange(Session session, SessionState state, Exception exception){
    if (session != null && session.isOpened()) {
        logAndShowOnScreen("\nLogged in. Getting user details.");
        Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
            @Override
            public void onCompleted(GraphUser user,
                                    Response response) {
                if (user != null) {
                    System.out.println("onSessionStateChange: LoadNotes: session is open. username:"+user.getName());

                    loadNotes(getActivity(), user.getId());
                }
            }
        });
        Request.executeBatchAsync(request);
    } else {
        logAndShowOnScreen("\nUser not already logged in.");
        System.out.println("onSessionStateChange: LoadNotes: session was closed.");
        loadNotes(getActivity(), getLoggedInUsername());
    }
}
项目:rm-facebook-login    文件:MainActivity.java   
public void setupFacebookConnect(Bundle savedInstanceState) {
    Settings.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS);

    Session session = Session.getActiveSession();
    if (session == null) {
        if (savedInstanceState != null) {
            session = Session.restoreSession(this, null, statusCallback,
                    savedInstanceState);
        }
        if (session == null) {
            session = new Session(this);
        }
        Session.setActiveSession(session);
        if (session.getState().equals(SessionState.CREATED_TOKEN_LOADED)) {
            session.openForRead(new Session.OpenRequest(this)
                    .setCallback(statusCallback));
        }
    }
}
项目:Klyph    文件:LoginFragment.java   
private void onSessionStateChange(Session session, SessionState state, Exception exception)
{
    if (getView() != null)
    {
        if (state.isOpened())
        {
            authButton.setVisibility(View.GONE);
            progressBar.setVisibility(View.VISIBLE);
        }
        else if (state.isClosed())
        {
            authButton.setVisibility(View.VISIBLE);
            progressBar.setVisibility(View.GONE);
        }
    }
}
项目:aws-mobile-self-paced-labs-samples    文件:LoginActivity.java   
@Override
public void call(Session session, SessionState state, Exception exception) {
    if (session.isOpened()) {
        setFacebookSession(session);
        // make request to the /me API
        Request.newMeRequest(session, new Request.GraphUserCallback() {

            // callback after Graph API response with user object
            @Override
            public void onCompleted(GraphUser user, Response response) {
                if (user != null) {
                    Toast.makeText(LoginActivity.this,
                            "Hello " + user.getName(), Toast.LENGTH_LONG)
                            .show();
                }
            }
        }).executeAsync();
    }
}
项目:Shorcial    文件:Inicio.java   
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
    // Si hacemos login o logout, el estado de la sesion cambiará, por lo que en esta función se controla y se muestra el fragment correspondiente en funcion de si la sesión esta abierta o cerrada.
    if (isResumed) {
        FragmentManager manager = getSupportFragmentManager();
        int backStackSize = manager.getBackStackEntryCount();
        for (int i = 0; i < backStackSize; i++) {
            manager.popBackStack();
        }
        // check for the OPENED state instead of session.isOpened() since for the
        // OPENED_TOKEN_UPDATED state, the selection fragment should already be showing.
        if (state.equals(SessionState.OPENED)) {
            if (Utilities.checkGooglePlayServiceAvailability(this)) {
                goToHome(session);
            }
        } else if (state.isClosed()) {
            showFragment(LOGIN, false);
        }
    }
}
项目:Wabbit-Messenger---android-client    文件:FBMgr.java   
public void fbLogin(Activity activity, final Runnable pCallback){
    Session.openActiveSession(activity, true, new Session.StatusCallback() {
        @Override
        public void call(Session session, SessionState state, Exception exception) {
            if (session.isOpened()) {
                // make request to the /me API
                Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {
                    @Override
                    public void onCompleted(GraphUser user, Response response) {
                        mUser = user;

                        if(pCallback != null)
                            pCallback.run();
                    }
                });
            }
        }
    });
}
项目:yako    文件:MainActivity.java   
/**
 * Opens Facebook session if exists.
 * 
 * @param context
 */
public static void openFbSession(Context context) {
  if (fbToken == null) {
    fbToken = StoreHandler.getFacebookAccessToken(context);
    Date expirationDate = StoreHandler.getFacebookAccessTokenExpirationDate(context);
    // Log.d( "rgai", "expiration date readed -> " + expirationDate.toString());
    if (fbToken != null) {
      Session.openActiveSessionWithAccessToken(context,
              AccessToken.createFromExistingAccessToken(fbToken, expirationDate, new Date(2013, 1, 1),
                      AccessTokenSource.FACEBOOK_APPLICATION_NATIVE, Settings.getFacebookPermissions()),
              new Session.StatusCallback() {
                @Override
                public void call(Session sn, SessionState ss, Exception excptn) {}
              }
      );
    }
  }
}
项目:GeoNote    文件:BaseFacebookHandlerFragment.java   
private void onSessionStateChangeP(Session session, SessionState state, Exception exception)
{
    if (session != null && session.isOpened()) {
        Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
            @Override
            public void onCompleted(GraphUser user,
                                    Response response) {
                if (user != null) {
                    LoggedInUser = user;
                }
            }
        });
        Request.executeBatchAsync(request);
    } else if (session.isClosed()) {
        LoggedInUser = null;
    }

    onSessionStateChange(session, state, exception);
}
项目:DualRunner    文件:FBLogin.java   
public static void init(String appID) {
    Session session;
    if (FB.isLoggedIn()) {
        session = Session.getActiveSession();
        // this shouldn't be an issue for most people: the app id in the session not matching the one provided
        // instead it can probably happen if a developer wants to switch app ids at run time.
        if (appID != session.getApplicationId()) {
            Log.w(FB.TAG, "App Id in active session ("+ session.getApplicationId() +") doesn't match App Id passed in: " + appID);
            session = new Builder(FB.getUnityActivity()).setApplicationId(appID).build();
        }
    } else {
        session = new Builder(FB.getUnityActivity()).setApplicationId(appID).build();
    }
    Session.setActiveSession(session);

    final UnityMessage unityMessage = new UnityMessage("OnInitComplete");
    unityMessage.put("key_hash", FB.getKeyHash());

    // if there is an existing session, reopen it
    if (SessionState.CREATED_TOKEN_LOADED.equals(session.getState())) {
        Session.StatusCallback finalCallback = getFinalCallback(unityMessage, null);
        sessionOpenRequest(session, finalCallback, FB.getUnityActivity(), null, false);
    } else {
        unityMessage.send();
    }
}
项目:GeoNote    文件:MapViewFragment.java   
@Override
protected void onSessionStateChange(Session session, SessionState state, Exception exception){
    final TextView txtUserDetails = (TextView) mCurrentView.findViewById(R.id.mapViewLoggedInUser);
    if (session != null && session.isOpened()) {
        Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
            @Override
            public void onCompleted(GraphUser user,
                                    Response response) {
                if (user != null) {
                    txtUserDetails.setText("Logged in as " + user.getName());
                    System.out.println("onSessionStateChange: LoadNotes: session is open. username:"+user.getName());
                }
            }
        });
        Request.executeBatchAsync(request);
    } else if (session.isClosed()) {
        txtUserDetails.setText("");
        System.out.println("onSessionStateChange: LoadNotes: session was closed.");
    }
}
项目:AndroidBackendlessChat    文件:SessionTracker.java   
@Override
public void call(Session session, SessionState state, Exception exception) {
    if (wrapped != null && isTracking()) {
        wrapped.call(session, state, exception);
    }
    // if we're not tracking the Active Session, and the current session
    // is closed, then start tracking the Active Session.
    if (session == SessionTracker.this.session && state.isClosed()) {
        setSession(null);
    }
}
项目:AndroidBackendlessChat    文件:FacebookFragment.java   
/**
 * Gets the current state of the session or null if no session has been created.
 * 
 * @return the current state of the session
 */
protected final SessionState getSessionState() {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        return (currentSession != null) ? currentSession.getState() : null;
    }
    return null;
}
项目:AndroidBackendlessChat    文件:BFacebookManager.java   
/** Re authenticate after session state changed.*/
public static Promise<Object, BError, Void> onSessionStateChange(Session session, SessionState state, Exception exception) {
    if (DEBUG) Timber.i("Session changed state");

    // If we can start the login process with no errors this promise wont be used. 
    // The returned promise will be from the loginWithFacebook.
    Deferred<Object, BError, Void> deferred = new DeferredObject<>();

    if (exception != null)
    {
        exception.printStackTrace();
        if (exception instanceof FacebookOperationCanceledException)
        {
            deferred.reject(new BError(BError.Code.EXCEPTION, exception));
            return deferred.promise();
        }
    }

    if (state.isOpened()) {
        if (DEBUG) Timber.i("Session is open.");

        // We will need this session later to make request.
        userFacebookAccessToken = Session.getActiveSession().getAccessToken();

        return loginWithFacebook();

    } else if (state.isClosed()) {
        // Logged out of Facebook
        if (DEBUG) Timber.i("Session is closed.");
        deferred.reject(new BError(BError.Code.SESSION_CLOSED, "Facebook session is closed."));
    }


    return deferred.promise();
}
项目:AndroidBackendlessChat    文件:ChatSDKBaseActivity.java   
protected void onSessionStateChange(Session session, final SessionState state, Exception exception){
    BFacebookManager.onSessionStateChange(session, state, exception)
            .fail(new FailCallback<BError>() {
                @Override
                public void onFail(BError bError) {
                    if (DEBUG) Timber.e("onDoneWithError. Error: %s", bError.message);
                    // Facebook session is closed so we need to disconnect from firebase.
                    getNetworkAdapter().logout();
                    startLoginActivity(true);
                }
            });
}
项目:AndroidBackendlessChat    文件:ChatSDKAbstractLoginActivity.java   
public void onSessionStateChange(Session session, SessionState state, Exception exception){

        if (!getNetworkAdapter().facebookEnabled())
        {
            return;
        }

        if (exception != null)
        {
            exception.printStackTrace();
            if (exception instanceof FacebookOperationCanceledException)
            {
                return;
            }
        }else showOrUpdateProgDialog(getString(R.string.authenticating));

        BFacebookManager.onSessionStateChange(session, state, exception).done(new DoneCallback<Object>() {
            @Override
            public void onDone(Object o) {
                if (DEBUG) Timber.i("Connected to facebook");
                afterLogin();
            }
        }).fail(new FailCallback<BError>() {
            @Override
            public void onFail(BError bError) {
                if (DEBUG) Timber.i(TAG, "Error connecting to Facebook");
//                Toast.makeText(LoginActivity.this, "Failed connect to facebook.", Toast.LENGTH_SHORT).show();
                showAlertToast( getString(R.string.login_activity_facebook_connection_fail_toast) );
                BFacebookManager.logout(ChatSDKAbstractLoginActivity.this);
                dismissProgDialog();
            }
        });
    }
项目:chat-sdk-android-push-firebase    文件:SessionTracker.java   
@Override
public void call(Session session, SessionState state, Exception exception) {
    if (wrapped != null && isTracking()) {
        wrapped.call(session, state, exception);
    }
    // if we're not tracking the Active Session, and the current session
    // is closed, then start tracking the Active Session.
    if (session == SessionTracker.this.session && state.isClosed()) {
        setSession(null);
    }
}
项目:chat-sdk-android-push-firebase    文件:FacebookFragment.java   
/**
 * Gets the current state of the session or null if no session has been created.
 * 
 * @return the current state of the session
 */
protected final SessionState getSessionState() {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        return (currentSession != null) ? currentSession.getState() : null;
    }
    return null;
}
项目:chat-sdk-android-push-firebase    文件:BFacebookManager.java   
/** Re authenticate after session state changed.*/
public static Promise<Object, BError, Void> onSessionStateChange(Session session, SessionState state, Exception exception) {
    if (DEBUG) Timber.i("Session changed state");

    // If we can start the login process with no errors this promise wont be used. 
    // The returned promise will be from the loginWithFacebook.
    Deferred<Object, BError, Void> deferred = new DeferredObject<>();

    if (exception != null)
    {
        exception.printStackTrace();
        if (exception instanceof FacebookOperationCanceledException)
        {
            deferred.reject(new BError(BError.Code.EXCEPTION, exception));
            return deferred.promise();
        }
    }

    if (state.isOpened()) {
        if (DEBUG) Timber.i("Session is open.");

        // We will need this session later to make request.
        userFacebookAccessToken = Session.getActiveSession().getAccessToken();

        return loginWithFacebook();

    } else if (state.isClosed()) {
        // Logged out of Facebook
        if (DEBUG) Timber.i("Session is closed.");
        deferred.reject(new BError(BError.Code.SESSION_CLOSED, "Facebook session is closed."));
    }


    return deferred.promise();
}
项目:chat-sdk-android-push-firebase    文件:ChatSDKBaseActivity.java   
protected void onSessionStateChange(Session session, final SessionState state, Exception exception){
    BFacebookManager.onSessionStateChange(session, state, exception)
            .fail(new FailCallback<BError>() {
                @Override
                public void onFail(BError bError) {
                    if (DEBUG) Timber.e("onDoneWithError. Error: %s", bError.message);
                    // Facebook session is closed so we need to disconnect from firebase.
                    getNetworkAdapter().logout();
                    startLoginActivity(true);
                }
            });
}
项目:chat-sdk-android-push-firebase    文件:ChatSDKAbstractLoginActivity.java   
public void onSessionStateChange(Session session, SessionState state, Exception exception){

        if (!getNetworkAdapter().facebookEnabled())
        {
            return;
        }

        if (exception != null)
        {
            exception.printStackTrace();
            if (exception instanceof FacebookOperationCanceledException)
            {
                return;
            }
        }else showOrUpdateProgDialog(getString(R.string.authenticating));

        BFacebookManager.onSessionStateChange(session, state, exception).done(new DoneCallback<Object>() {
            @Override
            public void onDone(Object o) {
                if (DEBUG) Timber.i("Connected to facebook");
                afterLogin();
            }
        }).fail(new FailCallback<BError>() {
            @Override
            public void onFail(BError bError) {
                if (DEBUG) Timber.i(TAG, "Error connecting to Facebook");
//                Toast.makeText(LoginActivity.this, "Failed connect to facebook.", Toast.LENGTH_SHORT).show();
                showAlertToast( getString(R.string.login_activity_facebook_connection_fail_toast) );
                BFacebookManager.logout(ChatSDKAbstractLoginActivity.this);
                dismissProgDialog();
            }
        });
    }
项目:pedefacil    文件:FbLoginDelegate.java   
public void onSessionStateChange(Session session, SessionState state, Exception exception) {
    if (state.isOpened()) {
        requestUserData(session);
    } else if (state.isClosed()) {
        mUserHelper.setCurrentUser(null);
        if ( mUserSessionCallback != null ) {
            mUserSessionCallback.onLogout();
        }
    }
}
项目:aptoide-backup-apps    文件:MainActivity.java   
@Override
public void call(final Session session, SessionState state, Exception exception) {
    if (state.isOpened()) {
        Log.d("Facebook token", session.getAccessToken());
        Request meRequest = Request.newMeRequest(session, new Request.GraphUserCallback() {
            @Override
            public void onCompleted(GraphUser user, Response response) {
                Login login = new Login(user.getProperty("email").toString(), session.getAccessToken(), "facebook");
                new CheckUserCredentials(MainActivity.this).execute(login);
                session.closeAndClearTokenInformation();
            }
        });
        meRequest.executeAsync();
    }
}
项目:yelo-android    文件:SessionTracker.java   
@Override
public void call(Session session, SessionState state, Exception exception) {
    if (wrapped != null && isTracking()) {
        wrapped.call(session, state, exception);
    }
    // if we're not tracking the Active Session, and the current session
    // is closed, then start tracking the Active Session.
    if (session == SessionTracker.this.session && state.isClosed()) {
        setSession(null);
    }
}
项目:yelo-android    文件:FacebookFragment.java   
/**
 * Gets the current state of the session or null if no session has been created.
 * 
 * @return the current state of the session
 */
protected final SessionState getSessionState() {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        return (currentSession != null) ? currentSession.getState() : null;
    }
    return null;
}
项目:yelo-android    文件:LoginButton.java   
@Override
public void call(Session session, SessionState state,
                 Exception exception) {
    fetchUserInfo();
    setButtonText();

    // if the client has a status callback registered, call it, otherwise
    // call the default handleError method, but don't call both
    if (properties.sessionStatusCallback != null) {
        properties.sessionStatusCallback.call(session, state, exception);
    } else if (exception != null) {
        handleError(exception);
    }
}
项目:yelo-android    文件:UserSettingsFragment.java   
@Override
protected void onSessionStateChange(SessionState state, Exception exception) {
    fetchUserInfo();
    updateUI();

    if (sessionStatusCallback != null) {
        sessionStatusCallback.call(getSession(), state, exception);
    }
}
项目:yelo-android    文件:PickerFragment.java   
@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    sessionTracker = new SessionTracker(getActivity(), new Session.StatusCallback() {
        @Override
        public void call(Session session, SessionState state, Exception exception) {
            if (!session.isOpened()) {
                // When a session is closed, we want to clear out our data so it is not visible to subsequent users
                clearResults();
            }
        }
    });

    setSettingsFromBundle(savedInstanceState);

    loadingStrategy = createLoadingStrategy();
    loadingStrategy.attach(adapter);

    selectionStrategy = createSelectionStrategy();
    selectionStrategy.readSelectionFromBundle(savedInstanceState, SELECTION_BUNDLE_KEY);

    // Should we display a title bar? (We need to do this after we've retrieved our bundle settings.)
    if (showTitleBar) {
        inflateTitleBar((ViewGroup) getView());
    }

    if (activityCircle != null && savedInstanceState != null) {
        boolean shown = savedInstanceState.getBoolean(ACTIVITY_CIRCLE_SHOW_KEY, false);
        if (shown) {
            displayActivityCircle();
        } else {
            // Should be hidden already, but just to be sure.
            hideActivityCircle();
        }
    }
}
项目:BrillaMXAndroid    文件:Logout.java   
public void onSessionChange (Session session, SessionState sessionState, Exception e) {
    if (session != null && session.isOpened()) {
        // Está logueado
    } else {
        config.clear();
        Intent intent = new Intent(Logout.this, LoginStep1.class);
        startActivity(intent);
    }
}
项目:BrillaMXAndroid    文件:SessionTracker.java   
@Override
public void call(Session session, SessionState state, Exception exception) {
    if (wrapped != null && isTracking()) {
        wrapped.call(session, state, exception);
    }
    // if we're not tracking the Active Session, and the current session
    // is closed, then start tracking the Active Session.
    if (session == SessionTracker.this.session && state.isClosed()) {
        setSession(null);
    }
}
项目:BrillaMXAndroid    文件:FacebookFragment.java   
/**
 * Gets the current state of the session or null if no session has been created.
 * 
 * @return the current state of the session
 */
protected final SessionState getSessionState() {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        return (currentSession != null) ? currentSession.getState() : null;
    }
    return null;
}