Search in sources :

Example 1 with FacebookDialogFragment

use of com.facebook.internal.FacebookDialogFragment in project facebook-android-sdk by facebook.

the class WebViewLoginMethodHandler method tryAuthorize.

@Override
boolean tryAuthorize(final LoginClient.Request request) {
    Bundle parameters = getParameters(request);
    WebDialog.OnCompleteListener listener = new WebDialog.OnCompleteListener() {

        @Override
        public void onComplete(Bundle values, FacebookException error) {
            onWebDialogComplete(request, values, error);
        }
    };
    e2e = LoginClient.getE2E();
    addLoggingExtra(ServerProtocol.DIALOG_PARAM_E2E, e2e);
    FragmentActivity fragmentActivity = loginClient.getActivity();
    WebDialog.Builder builder = new AuthDialogBuilder(fragmentActivity, request.getApplicationId(), parameters).setE2E(e2e).setIsRerequest(request.isRerequest()).setOnCompleteListener(listener);
    loginDialog = builder.build();
    FacebookDialogFragment dialogFragment = new FacebookDialogFragment();
    dialogFragment.setRetainInstance(true);
    dialogFragment.setDialog(loginDialog);
    dialogFragment.show(fragmentActivity.getSupportFragmentManager(), FacebookDialogFragment.TAG);
    return true;
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) Bundle(android.os.Bundle) FacebookException(com.facebook.FacebookException) WebDialog(com.facebook.internal.WebDialog) FacebookDialogFragment(com.facebook.internal.FacebookDialogFragment)

Example 2 with FacebookDialogFragment

use of com.facebook.internal.FacebookDialogFragment in project facebook-android-sdk by facebook.

the class FacebookActivity method getFragment.

protected Fragment getFragment() {
    Intent intent = getIntent();
    FragmentManager manager = getSupportFragmentManager();
    Fragment fragment = manager.findFragmentByTag(FRAGMENT_TAG);
    if (fragment == null) {
        if (FacebookDialogFragment.TAG.equals(intent.getAction())) {
            FacebookDialogFragment dialogFragment = new FacebookDialogFragment();
            dialogFragment.setRetainInstance(true);
            dialogFragment.show(manager, FRAGMENT_TAG);
            fragment = dialogFragment;
        } else if (DeviceShareDialogFragment.TAG.equals(intent.getAction())) {
            DeviceShareDialogFragment dialogFragment = new DeviceShareDialogFragment();
            dialogFragment.setRetainInstance(true);
            dialogFragment.setShareContent((ShareContent) intent.getParcelableExtra("content"));
            dialogFragment.show(manager, FRAGMENT_TAG);
            fragment = dialogFragment;
        } else {
            fragment = new LoginFragment();
            fragment.setRetainInstance(true);
            manager.beginTransaction().add(R.id.com_facebook_fragment_container, fragment, FRAGMENT_TAG).commit();
        }
    }
    return fragment;
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) FacebookDialogFragment(com.facebook.internal.FacebookDialogFragment) Intent(android.content.Intent) DeviceShareDialogFragment(com.facebook.share.internal.DeviceShareDialogFragment) FacebookDialogFragment(com.facebook.internal.FacebookDialogFragment) Fragment(android.support.v4.app.Fragment) LoginFragment(com.facebook.login.LoginFragment) DeviceShareDialogFragment(com.facebook.share.internal.DeviceShareDialogFragment) LoginFragment(com.facebook.login.LoginFragment) ShareContent(com.facebook.share.model.ShareContent)

Aggregations

FacebookDialogFragment (com.facebook.internal.FacebookDialogFragment)2 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 Fragment (android.support.v4.app.Fragment)1 FragmentActivity (android.support.v4.app.FragmentActivity)1 FragmentManager (android.support.v4.app.FragmentManager)1 FacebookException (com.facebook.FacebookException)1 WebDialog (com.facebook.internal.WebDialog)1 LoginFragment (com.facebook.login.LoginFragment)1 DeviceShareDialogFragment (com.facebook.share.internal.DeviceShareDialogFragment)1 ShareContent (com.facebook.share.model.ShareContent)1