Search in sources :

Example 6 with ShareContent

use of com.facebook.share.model.ShareContent 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

ShareContent (com.facebook.share.model.ShareContent)6 ReactMethod (com.facebook.react.bridge.ReactMethod)4 ShareApi (com.facebook.share.ShareApi)2 MessageDialog (com.facebook.share.widget.MessageDialog)2 Intent (android.content.Intent)1 Fragment (android.support.v4.app.Fragment)1 FragmentManager (android.support.v4.app.FragmentManager)1 FacebookDialogFragment (com.facebook.internal.FacebookDialogFragment)1 LoginFragment (com.facebook.login.LoginFragment)1 DeviceShareDialogFragment (com.facebook.share.internal.DeviceShareDialogFragment)1