Java Code Examples for android.support.v4.app.DialogFragment#getDialog()

The following examples show how to use android.support.v4.app.DialogFragment#getDialog() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnimHelper.java    From mvvm-template with GNU General Public License v3.0 6 votes vote down vote up
@UiThread public static void dismissDialog(@NonNull DialogFragment dialogFragment, int duration, AnimatorListenerAdapter listenerAdapter) {
    Dialog dialog = dialogFragment.getDialog();
    if (dialog != null) {
        if (dialog.getWindow() != null) {
            View view = dialog.getWindow().getDecorView();
            if (view != null) {
                int centerX = view.getWidth() / 2;
                int centerY = view.getHeight() / 2;
                float radius = (float) Math.sqrt(view.getWidth() * view.getWidth() / 4 + view.getHeight() * view.getHeight() / 4);
                view.post(() -> {
                    if (ViewCompat.isAttachedToWindow(view)) {
                        Animator animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, radius, 0);
                        animator.setDuration(duration);
                        animator.addListener(listenerAdapter);
                        animator.start();
                    } else {
                        listenerAdapter.onAnimationEnd(null);
                    }
                });
            }
        }
    } else {
        listenerAdapter.onAnimationEnd(null);
    }
}
 
Example 2
Source File: ImmersionBar.java    From ImmersionBar with Apache License 2.0 5 votes vote down vote up
/**
 * 在dialogFragment里使用
 * Instantiates a new Immersion bar.
 *
 * @param dialogFragment the dialog fragment
 */
ImmersionBar(DialogFragment dialogFragment) {
    mIsDialog = true;
    mIsDialogFragment = true;
    mActivity = dialogFragment.getActivity();
    mSupportFragment = dialogFragment;
    mDialog = dialogFragment.getDialog();
    checkInitWithActivity();
    initCommonParameter(mDialog.getWindow());
}
 
Example 3
Source File: ImmersionBar.java    From MNImageBrowser with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 在dialogFragment里使用
 * Instantiates a new Immersion bar.
 *
 * @param dialogFragment the dialog fragment
 */
ImmersionBar(DialogFragment dialogFragment) {
    mIsDialog = true;
    mActivity = dialogFragment.getActivity();
    mSupportFragment = dialogFragment;
    mDialog = dialogFragment.getDialog();
    checkInitWithActivity();
    initCommonParameter(mDialog.getWindow());
}
 
Example 4
Source File: FragmentCompatSupportLib.java    From weex with Apache License 2.0 4 votes vote down vote up
@Override
public Dialog getDialog(DialogFragment dialogFragment) {
  return dialogFragment.getDialog();
}
 
Example 5
Source File: FragmentCompatSupportLib.java    From stetho with MIT License 4 votes vote down vote up
@Override
public Dialog getDialog(DialogFragment dialogFragment) {
  return dialogFragment.getDialog();
}