public static void show(Activity activity, View dialogView, boolean touchEnable) {
        try {
            if (activity.getWindow().getDecorView().isAttachedToWindow()) {
                showNow(activity, dialogView, touchEnable);
            } else {
                activity.getWindow().getDecorView().post(new Runnable() {
                    @Override
                    public void run() {
                        showNow(activity, dialogView, touchEnable);
                    }
                });
            }
        } catch (Exception e) {
            if (activity != null && !activity.isDestroyed()) {
                showNow(activity, dialogView, touchEnable);
            }
        }
    }
@author: Kongzue
@github: https://github.com/kongzue/
@homepage: http://kongzue.com/
@mail: myzcxhh@live.cn
@createTime: 2021/4/29 16:02
DialogX/src/main/java/com/kongzue/dialogx/util/WindowUtil.java