/** * Constructs a new RequestDialog. * @param fragment android.app.Fragment hosting the dialog. */ public GameRequestDialog(android.app.Fragment fragment) { this(new FragmentWrapper(fragment)); }
protected Activity getActivityContext() { if (activity != null) { return activity; } if (fragmentWrapper != null) { return fragmentWrapper.getActivity(); } return null; }
/** * Gets the fragment that contains this control. * @return The android.app.Fragment that contains this control. */ public android.app.Fragment getNativeFragment() { return (parentFragment != null) ? parentFragment.getNativeFragment() : null; }
protected void startActivityForResult(Intent intent, int requestCode) { String error = null; if (activity != null) { activity.startActivityForResult(intent, requestCode); } else if (fragmentWrapper != null) { if (fragmentWrapper.getNativeFragment() != null) { fragmentWrapper.getNativeFragment().startActivityForResult(intent, requestCode); } else if (fragmentWrapper.getSupportFragment() != null) { fragmentWrapper.getSupportFragment().startActivityForResult(intent, requestCode); } else { error = "Failed to find Activity or Fragment to startActivityForResult "; } } else { error = "Failed to find Activity or Fragment to startActivityForResult "; } if (error != null) { Logger.log(LoggingBehavior.DEVELOPER_ERRORS, Log.ERROR, this.getClass().getName(), error); } }
@Override public void startActivityForResult(Intent intent, int requestCode) { fragment.startActivityForResult(intent, requestCode); }
/** * Gets the fragment that contains this control. * @return The android.support.v4.app.Fragment that contains this control. */ public Fragment getFragment() { return (parentFragment != null) ? parentFragment.getSupportFragment() : null; }
public static void present(AppCall appCall, FragmentWrapper fragmentWrapper) { fragmentWrapper.startActivityForResult( appCall.getRequestIntent(), appCall.getRequestCode()); appCall.setPending(); }
/** * Constructs a new DeviceShareDialog. * @param fragment fragment to use to share the provided content */ public DeviceShareDialog(final android.support.v4.app.Fragment fragment) { super(new FragmentWrapper(fragment), DEFAULT_REQUEST_CODE); }
@Override public Activity getActivityContext() { return fragment.getActivity(); } }
/** * Constructs a new RequestDialog. * @param fragment android.support.v4.app.Fragment hosting the dialog. */ public GameRequestDialog(Fragment fragment) { this(new FragmentWrapper(fragment)); }
protected FacebookDialogBase(final FragmentWrapper fragmentWrapper, int requestCode) { Validate.notNull(fragmentWrapper, "fragmentWrapper"); this.fragmentWrapper = fragmentWrapper; this.activity = null; this.requestCode = requestCode; if (fragmentWrapper.getActivity() == null) { throw new IllegalArgumentException( "Cannot use a fragment that is not attached to an activity"); } }
/** * Sets the fragment that contains this control. This allows the button to be embedded inside a * Fragment, and will allow the fragment to receive the * {@link Fragment#onActivityResult(int, int, android.content.Intent) onActivityResult} * call rather than the Activity. * * @param fragment the android.app.Fragment that contains this control */ public void setFragment(final android.app.Fragment fragment) { parentFragment = new FragmentWrapper(fragment); }
/** * Constructs a MessageDialog. * @param fragment android.support.v4.app.Fragment to use to send the provided content. */ public MessageDialog(Fragment fragment) { this(new FragmentWrapper(fragment)); }
/** * Constructs a new ShareDialog. * @param fragment android.app.Fragment to use to share the provided content. */ public ShareDialog(android.app.Fragment fragment) { this(new FragmentWrapper(fragment)); }
/** * Sets the fragment that contains this control. This allows the button to be embedded inside a * Fragment, and will allow the fragment to receive the * {@link Fragment#onActivityResult(int, int, android.content.Intent) onActivityResult} * call rather than the Activity. * * @param fragment the android.support.v4.app.Fragment that contains this control */ public void setFragment(final Fragment fragment) { parentFragment = new FragmentWrapper(fragment); }
/** * Constructs a MessageDialog. * @param fragment android.app.Fragment to use to send the provided content. */ public MessageDialog(android.app.Fragment fragment) { this(new FragmentWrapper(fragment)); }
/** * Constructs a new DeviceShareDialog. * @param fragment fragment to use to share the provided content */ public DeviceShareDialog(final Fragment fragment) { super(new FragmentWrapper(fragment), DEFAULT_REQUEST_CODE); } /**
/** * Constructs a new ShareDialog. * @param fragment android.support.v4.app.Fragment to use to share the provided content. */ public ShareDialog(Fragment fragment) { this(new FragmentWrapper(fragment)); }
MessageDialog(android.app.Fragment fragment, int requestCode) { this(new FragmentWrapper(fragment), requestCode); }
MessageDialog(Fragment fragment, int requestCode) { this(new FragmentWrapper(fragment), requestCode); }