kongzue 3 lat temu
rodzic
commit
494d8ca2e4

+ 0 - 4
DialogX/src/main/java/com/kongzue/dialogx/DialogX.java

@@ -125,10 +125,6 @@ public class DialogX {
         BaseDialog.init(context);
     }
     
-    public static void log(Object o) {
-        if (DEBUGMODE) Log.i(">>>", o.toString());
-    }
-    
     public static void error(Object o) {
         if (DEBUGMODE) Log.e(">>>", o.toString());
     }

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

@@ -440,7 +440,6 @@ public class BottomDialog extends BaseDialog {
         private ViewTreeObserver.OnGlobalLayoutListener onContentViewLayoutChangeListener = new ViewTreeObserver.OnGlobalLayoutListener() {
             @Override
             public void onGlobalLayout() {
-                log("A");
                 if (boxContent != null) {
                     if (style.overrideBottomDialogRes() != null &&style.overrideBottomDialogRes().touchSlide()) {
                         //若内容布已经超出屏幕可用范围,且预设的对话框最大高度已知

+ 38 - 13
DialogX/src/main/java/com/kongzue/dialogx/dialogs/WaitDialog.java

@@ -249,15 +249,15 @@ public class WaitDialog extends BaseDialog {
     
     public WaitDialog show() {
         super.beforeShow();
+        int layoutResId = R.layout.layout_dialogx_wait;
+        if (style.overrideWaitTipRes() != null && style.overrideWaitTipRes().overrideWaitLayout(isLightTheme()) != 0) {
+            layoutResId = style.overrideWaitTipRes().overrideWaitLayout(isLightTheme());
+        }
+        dialogImpl = new DialogImpl(layoutResId);
         runOnMain(new Runnable() {
             @Override
             public void run() {
-                int layoutResId = R.layout.layout_dialogx_wait;
-                if (style.overrideWaitTipRes() != null && style.overrideWaitTipRes().overrideWaitLayout(isLightTheme()) != 0) {
-                    layoutResId = style.overrideWaitTipRes().overrideWaitLayout(isLightTheme());
-                }
-                dialogView = createView(layoutResId);
-                dialogImpl = new DialogImpl(dialogView);
+                dialogImpl.lazyCreate();
                 dialogView.setTag(me.get());
                 show(dialogView);
             }
@@ -267,15 +267,15 @@ public class WaitDialog extends BaseDialog {
     
     public WaitDialog show(final Activity activity) {
         super.beforeShow();
+        int layoutResId = R.layout.layout_dialogx_wait;
+        if (style.overrideWaitTipRes() != null && style.overrideWaitTipRes().overrideWaitLayout(isLightTheme()) != 0) {
+            layoutResId = style.overrideWaitTipRes().overrideWaitLayout(isLightTheme());
+        }
+        dialogImpl = new DialogImpl(layoutResId);
         runOnMain(new Runnable() {
             @Override
             public void run() {
-                int layoutResId = R.layout.layout_dialogx_wait;
-                if (style.overrideWaitTipRes() != null && style.overrideWaitTipRes().overrideWaitLayout(isLightTheme()) != 0) {
-                    layoutResId = style.overrideWaitTipRes().overrideWaitLayout(isLightTheme());
-                }
-                dialogView = createView(layoutResId);
-                dialogImpl = new DialogImpl(dialogView);
+                dialogImpl.lazyCreate();
                 dialogView.setTag(me.get());
                 show(activity, dialogView);
             }
@@ -294,6 +294,31 @@ public class WaitDialog extends BaseDialog {
         public RelativeLayout boxCustomView;
         public TextView txtInfo;
         
+        private int layoutResId;
+        
+        public DialogImpl(int layoutResId) {
+            this.layoutResId = layoutResId;
+        }
+        
+        public void lazyCreate(){
+            dialogView = createView(layoutResId);
+            boxRoot = dialogView.findViewById(R.id.box_root);
+            bkg = dialogView.findViewById(R.id.bkg);
+            blurView = dialogView.findViewById(R.id.blurView);
+            boxProgress = dialogView.findViewById(R.id.box_progress);
+            View progressViewCache = (View) style.overrideWaitTipRes().overrideWaitView(getContext(), isLightTheme());
+            if (progressViewCache == null) {
+                progressViewCache = new ProgressView(getContext());
+            }
+            progressView = (ProgressViewInterface) progressViewCache;
+            boxProgress.addView(progressViewCache, new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
+            boxCustomView = dialogView.findViewById(R.id.box_customView);
+            txtInfo = dialogView.findViewById(R.id.txt_info);
+            init();
+            dialogImpl = this;
+            refreshView();
+        }
+        
         public DialogImpl(View convertView) {
             boxRoot = convertView.findViewById(R.id.box_root);
             bkg = convertView.findViewById(R.id.bkg);
@@ -474,7 +499,7 @@ public class WaitDialog extends BaseDialog {
                         public void run() {
                             dismiss(dialogView);
                         }
-                    },exitAnimDurationTemp);
+                    }, exitAnimDurationTemp);
                 }
             });
         }

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

@@ -147,11 +147,11 @@ public abstract class BaseDialog {
         removeDialogToRunningList(baseDialog);
         if (baseDialog.dialogView != null) baseDialog.dialogView.clear();
         if (DialogX.implIMPLMode == DialogX.IMPL_MODE.VIEW) {
-            if (rootFrameLayout == null) return;
             runOnMain(new Runnable() {
                 @Override
                 public void run() {
                     if (dialogView.getParent() == null || !(dialogView.getParent() instanceof ViewGroup)) {
+                        if (rootFrameLayout == null) return;
                         rootFrameLayout.get().removeView(dialogView);
                     } else {
                         ((ViewGroup) dialogView.getParent()).removeView(dialogView);

+ 0 - 3
DialogX/src/main/java/com/kongzue/dialogx/util/NormalMenuArrayAdapter.java

@@ -19,11 +19,8 @@ import com.kongzue.dialogx.DialogX;
 import com.kongzue.dialogx.R;
 import com.kongzue.dialogx.dialogs.BottomMenu;
 
-import java.util.ArrayList;
 import java.util.List;
 
-import static com.kongzue.dialogx.DialogX.log;
-
 /**
  * @author: Kongzue
  * @github: https://github.com/kongzue/

+ 0 - 2
DialogX/src/main/java/com/kongzue/dialogx/util/views/DialogXBaseRelativeLayout.java

@@ -25,8 +25,6 @@ import com.kongzue.dialogx.interfaces.BaseDialog;
 import com.kongzue.dialogx.interfaces.OnBackPressedListener;
 import com.kongzue.dialogx.interfaces.OnSafeInsetsChangeListener;
 
-import static com.kongzue.dialogx.DialogX.log;
-
 /**
  * @author: Kongzue
  * @github: https://github.com/kongzue/

+ 2 - 3
app/src/main/java/com/kongzue/dialogxdemo/MainActivity.java

@@ -270,7 +270,6 @@ public class MainActivity extends BaseActivity {
                         return false;
                     }
                 });
-//                showSecondDialog1();
             }
         });
         
@@ -477,7 +476,7 @@ public class MainActivity extends BaseActivity {
                                 @Override
                                 public boolean onClick(BottomMenu dialog, CharSequence text, int index) {
                                     PopTip.show(text);
-                                    dialog.setMenuList(new String[]{"test","test2","test3"});
+                                    dialog.setMenuList(new String[]{"test", "test2", "test3"});
                                     return false;
                                 }
                             });
@@ -729,7 +728,7 @@ public class MainActivity extends BaseActivity {
             }
         });
     }
-    
+
 //    private void showSecondDialog1() {
 //        SpannableString spannableString = new SpannableString("这里是一段文本,点击链接");
 //        spannableString.setSpan(new ClickableSpan(){

+ 1 - 1
gradle.properties

@@ -18,5 +18,5 @@ android.useAndroidX=true
 # Automatically convert third-party libraries to use AndroidX
 android.enableJetifier=true
 
-BUILD_VERSION=0.0.39.beta3
+BUILD_VERSION=0.0.39.beta4
 BUILD_VERSION_INT=38