@Override
        public void init() {
            if (baseViewLoc == null && baseView() != null) {
                baseViewLoc = new int[4];
                baseView().getLocationInWindow(baseViewLoc);
                baseViewLoc[2] = baseView().getWidth();
                baseViewLoc[3] = baseView().getHeight();
            }

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                getDialogView().setTranslationZ(getThisOrderIndex());
            }

            boxRoot.setParentDialog(me);
            boxRoot.setOnLifecycleCallBack(new DialogXBaseRelativeLayout.OnLifecycleCallBack() {
                @Override
                public void onShow() {
                    isShow = true;
                    preShow = false;

                    setLifecycleState(Lifecycle.State.CREATED);

                    getDialogLifecycleCallback().onShow(me);
                    CustomDialog.this.onShow(me);
                    onDialogShow();

                    boxCustom.setVisibility(View.GONE);
                }

                @Override
                public void onDismiss() {
                    isShow = false;
                    getDialogLifecycleCallback().onDismiss(me);
                    CustomDialog.this.onDismiss(me);
                    setLifecycleState(Lifecycle.State.DESTROYED);
                    dialogImpl = null;
                    dialogLifecycleCallback = null;
                    System.gc();
                }
            });

            boxRoot.setOnBackPressedListener(new DialogXBaseRelativeLayout.PrivateBackPressedListener() {
                @Override
                public boolean onBackPressed() {
                    if (onBackPressedListener != null) {
                        if (onBackPressedListener.onBackPressed(me)) {
                            dismiss();
                        }
                    } else {
                        if (isCancelable()) {
                            dismiss();
                        }
                    }
                    return true;
                }
            });

            boxRoot.post(new Runnable() {
                @Override
                public void run() {
                    if (getDialogXAnimImpl() != null) {
                        getDialogXAnimImpl().doShowAnim(CustomDialog.this, boxCustom);
                    }
                    if (getDialogImpl() != null && getDialogImpl().boxCustom != null) {
                        getDialogImpl().boxCustom.setVisibility(View.VISIBLE);
                    }

                    setLifecycleState(Lifecycle.State.RESUMED);
                }
            });

            onDialogInit();
        }
@author: Kongzue
@github: https://github.com/kongzue/
@homepage: http://kongzue.com/
@mail: myzcxhh@live.cn
@createTime: 2020/10/20 11:59
DialogX/src/main/java/com/kongzue/dialogx/dialogs/CustomDialog.java