Java 类com.facebook.widget.UserSettingsFragment 实例源码

项目:MeNextAndroid    文件:MainActivity.java   
@Override
protected void onSaveInstanceState(Bundle outState) {
    FragmentManager fm = getSupportFragmentManager();
    super.onSaveInstanceState(outState);
    uiHelper.onSaveInstanceState(outState);
    fm.putFragment(outState, SplashFragment.class.getName(), fragments[SPLASH]);
    fm.putFragment(outState, JoinedFragment.class.getName(), fragments[JOINED]);
    fm.putFragment(outState, PartyFragment.class.getName(), fragments[PARTY]);
    fm.putFragment(outState, SearchFragment.class.getName(), fragments[SEARCH]);
    fm.putFragment(outState, UserSettingsFragment.class.getName(), fragments[SETTINGS]);
    for (int i = 0; i < fragments.length; i++) {
        if(fragments[i].isVisible()) {
            outState.putInt(STATE_OPEN_FRAGMENT, i);
        }
    }
}
项目:facebook-android-sdk    文件:LoginUsingLoginFragmentActivity.java   
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.login_fragment_activity);

    FragmentManager fragmentManager = getSupportFragmentManager();
    userSettingsFragment = (UserSettingsFragment) fragmentManager.findFragmentById(R.id.login_fragment);
    userSettingsFragment.setSessionStatusCallback(new Session.StatusCallback() {
        @Override
        public void call(Session session, SessionState state, Exception exception) {
            Log.d("LoginUsingLoginFragmentActivity", String.format("New session state: %s", state.toString()));
        }
    });
}
项目:FacebookNewsfeedSample-Android    文件:LoginUsingLoginFragmentActivity.java   
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.login_fragment_activity);

    FragmentManager fragmentManager = getSupportFragmentManager();
    userSettingsFragment = (UserSettingsFragment) fragmentManager.findFragmentById(R.id.login_fragment);
    userSettingsFragment.setSessionStatusCallback(new Session.StatusCallback() {
        @Override
        public void call(Session session, SessionState state, Exception exception) {
            Log.d("LoginUsingLoginFragmentActivity", String.format("New session state: %s", state.toString()));
        }
    });
}
项目:android-101    文件:LoginActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    // TODO: get key hashes
    // try {
    // PackageInfo info =
    // getPackageManager().getPackageInfo("scufsj.android101.facebooksample",
    // PackageManager.GET_SIGNATURES);
    //
    // for (Signature signature : info.signatures) {
    // MessageDigest md = MessageDigest.getInstance("SHA");
    // md.update(signature.toByteArray());
    // Log.e("KeyHash:", Base64.encodeToString(md.digest(),
    // Base64.DEFAULT));
    // }
    // } catch (NameNotFoundException e) {
    // // TODO Auto-generated catch block
    // e.printStackTrace();
    // } catch (NoSuchAlgorithmException e) {
    // // TODO Auto-generated catch block
    // e.printStackTrace();
    // }

    FragmentManager fragmentManager = getSupportFragmentManager();
    userSettingsFragment = (UserSettingsFragment) fragmentManager.findFragmentById(R.id.login_fragment);
    userSettingsFragment.setSessionStatusCallback(new Session.StatusCallback() {
        @Override
        public void call(Session session, SessionState state, Exception exception) {
            Log.d("LoginActivity", String.format("New session state: %s", state.toString()));
            if (session.isOpened()) {
                // TODO: call friends list activity

                // Ex: make request to the /me API
                // Request.executeMeRequestAsync(session, new
                // Request.GraphUserCallback() {
                //
                // // callback after Graph API response
                // // with user object
                // @Override
                // public void onCompleted(GraphUser user, Response
                // response) {
                // if (user != null) {
                // Log.d("LoginActivity", "Hello " + user.getName() + "!");
                // }
                // }
                // });
            }
        }
    });
}