Browse Source

fix bugs.

kongzue 4 years ago
parent
commit
4e8f874b7b

+ 1 - 3
DialogX/src/main/java/com/kongzue/dialogx/dialogs/BottomDialog.java

@@ -332,9 +332,7 @@ public class BottomDialog extends BaseDialog {
             
             if (onBindView != null) {
                 if (onBindView.getCustomView() != null) {
-                    if (onBindView.getCustomView().isAttachedToWindow()) {
-                        boxCustom.removeView(onBindView.getCustomView());
-                    }
+                    boxCustom.removeView(onBindView.getCustomView());
                     ViewGroup.LayoutParams lp = boxCustom.getLayoutParams();
                     if (lp == null) {
                         lp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

+ 1 - 3
DialogX/src/main/java/com/kongzue/dialogx/dialogs/CustomDialog.java

@@ -188,9 +188,7 @@ public class CustomDialog extends BaseDialog {
             
             if (onBindView != null) {
                 if (onBindView.getCustomView() != null) {
-                    if (onBindView.getCustomView().isAttachedToWindow()) {
-                        boxCustom.removeView(onBindView.getCustomView());
-                    }
+                    boxCustom.removeView(onBindView.getCustomView());
                     ViewGroup.LayoutParams lp = onBindView.getCustomView().getLayoutParams();
                     if (lp == null) {
                         lp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

+ 1 - 3
DialogX/src/main/java/com/kongzue/dialogx/dialogs/FullScreenDialog.java

@@ -191,9 +191,7 @@ public class FullScreenDialog extends BaseDialog {
             
             if (onBindView != null) {
                 if (onBindView.getCustomView() != null) {
-                    if (onBindView.getCustomView().isAttachedToWindow()) {
-                        boxCustom.removeView(onBindView.getCustomView());
-                    }
+                    boxCustom.removeView(onBindView.getCustomView());
                     ViewGroup.LayoutParams lp = onBindView.getCustomView().getLayoutParams();
                     if (lp == null) {
                         lp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

+ 1 - 3
DialogX/src/main/java/com/kongzue/dialogx/dialogs/MessageDialog.java

@@ -489,9 +489,7 @@ public class MessageDialog extends BaseDialog {
             }
             
             if (onBindView != null && onBindView.getCustomView() != null) {
-                if (onBindView.getCustomView().isAttachedToWindow()) {
-                    boxCustom.removeView(onBindView.getCustomView());
-                }
+                boxCustom.removeView(onBindView.getCustomView());
                 ViewGroup.LayoutParams lp = boxCustom.getLayoutParams();
                 if (lp == null) {
                     lp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

+ 1 - 3
DialogX/src/main/java/com/kongzue/dialogx/dialogs/PopTip.java

@@ -354,9 +354,7 @@ public class PopTip extends BaseDialog {
             
             if (onBindView != null) {
                 if (onBindView.getCustomView() != null) {
-                    if (onBindView.getCustomView().isAttachedToWindow()) {
-                        boxCustom.removeView(onBindView.getCustomView());
-                    }
+                    boxCustom.removeView(onBindView.getCustomView());
                     ViewGroup.LayoutParams lp = onBindView.getCustomView().getLayoutParams();
                     if (lp == null) {
                         lp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

+ 1 - 3
DialogX/src/main/java/com/kongzue/dialogx/dialogs/WaitDialog.java

@@ -240,9 +240,7 @@ public class WaitDialog extends BaseDialog {
             showText(txtInfo, message);
             
             if (onBindView != null && onBindView.getCustomView() != null) {
-                if (onBindView.getCustomView().isAttachedToWindow()) {
-                    boxCustomView.removeView(onBindView.getCustomView());
-                }
+                boxCustomView.removeView(onBindView.getCustomView());
                 ViewGroup.LayoutParams lp = boxCustomView.getLayoutParams();
                 if (lp == null) {
                     lp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

+ 1 - 3
DialogX/src/main/java/com/kongzue/dialogx/interfaces/BaseDialog.java

@@ -70,9 +70,7 @@ public class BaseDialog {
     
     public static void dismiss(View dialogView) {
         if (rootFrameLayout == null || dialogView == null) return;
-        if (dialogView.isAttachedToWindow()) {
-            rootFrameLayout.get().removeView(dialogView);
-        }
+        rootFrameLayout.get().removeView(dialogView);
     }
     
     public static Context getContext() {

+ 1 - 1
README.md

@@ -98,7 +98,7 @@ implementation 'com.kongzue.dialogx:DialogX:0.0.1'
 </dependency>
 ```
 
-具体的使用说明,请参阅 [DialogX Wiki](https://github.com/kongzue/DialogX/wiki)
+具体的使用说明,请参阅 [DialogX Wiki](https://github.com/kongzue/DialogX/wiki/%E6%AC%A2%E8%BF%8E%E4%BD%BF%E7%94%A8-DialogX)
 
 # 开源协议