kongzue 4 gadi atpakaļ
vecāks
revīzija
bd35b54e0d

+ 2 - 2
DialogX/build.gradle

@@ -6,7 +6,7 @@ def siteUrl = 'https://github.com/kongzue/DialogX' //项目在github主页地址
 def gitUrl = 'https://github.com/kongzue/DialogX.git'   //Git仓库的地址
 
 group = "com.kongzue.dialogx"
-version = "0.0.10"
+version = "0.0.11"
 
 android {
     compileSdkVersion 30
@@ -15,7 +15,7 @@ android {
         minSdkVersion 21
         targetSdkVersion 30
         versionCode 10
-        versionName "0.0.10"
+        versionName "0.0.11"
 
         consumerProguardFiles "consumer-rules.pro"
 

+ 15 - 2
DialogX/src/main/java/com/kongzue/dialogx/DialogX.java

@@ -28,6 +28,9 @@ public class DialogX {
     //全局对话框明暗风格
     public static DialogX.THEME globalTheme = DialogX.THEME.LIGHT;
     
+    //TipDialog 和 WaitDialog 明暗风格,不设置则默认根据 globalTheme 定义
+    public static DialogX.THEME tipTheme;
+    
     //对话框最大宽度(像素)
     public static int dialogMaxWidth;
     
@@ -61,9 +64,19 @@ public class DialogX {
     //默认底部菜单文本样式
     public static TextInfo menuTextInfo;
     
-    //默认对话框背景颜色(-1不生效)
+    //默认对话框背景颜色(值为 ColorInt,为-1不生效)
     public static int backgroundColor = -1;
     
+    //默认 TipDialog 和 WaitDialog 背景颜色(值为 ColorInt,为-1不生效)
+    public static int tipBackgroundColor = -1;
+    
+    /**
+     * 重写 TipDialog 和 WaitDialog 进度动画颜色,
+     * 注意此属性为覆盖性质,即设置此值将替换提示框原本的进度动画的颜色,包括亮暗色切换的颜色变化也将被替代
+     * (值为 ColorInt,为-1不生效)
+     */
+    public static int tipProgressColor = -1;
+    
     //默认对话框默认是否可以点击外围遮罩区域或返回键关闭,此开关不影响提示框(TipDialog)以及等待框(TipDialog)
     public static boolean cancelable = true;
     
@@ -71,7 +84,7 @@ public class DialogX {
     public static boolean cancelableTipDialog = false;
     
     //默认取消按钮文本文字,影响 BottomDialog
-    public static String cancelButtonText;
+    public static String cancelButtonText = "取消";
     
     //默认 PopTip 文本样式
     public static TextInfo popTextInfo;

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

@@ -49,7 +49,7 @@ public class BottomDialog extends BaseDialog {
     protected OnBindView<BottomDialog> onBindView;
     protected CharSequence title;
     protected CharSequence message;
-    protected CharSequence cancelText = "取消";
+    protected CharSequence cancelText;
     protected boolean allowInterceptTouch = true;
     protected OnDialogButtonClickListener<BottomDialog> cancelButtonClickListener;
     
@@ -227,7 +227,8 @@ public class BottomDialog extends BaseDialog {
             if (titleTextInfo == null) titleTextInfo = DialogX.titleTextInfo;
             if (messageTextInfo == null) messageTextInfo = DialogX.messageTextInfo;
             if (cancelTextInfo == null) cancelTextInfo = DialogX.buttonTextInfo;
-            if (DialogX.backgroundColor != -1) setBackgroundColor(DialogX.backgroundColor);
+            if (backgroundColor == -1) backgroundColor = DialogX.backgroundColor;
+            if (cancelText == null) cancelText = DialogX.cancelButtonText;
             
             boxRoot.setOnLifecycleCallBack(new DialogXBaseRelativeLayout.OnLifecycleCallBack() {
                 @Override

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

@@ -223,7 +223,7 @@ public class MessageDialog extends BaseDialog {
             if (cancelTextInfo == null) cancelTextInfo = DialogX.buttonTextInfo;
             if (otherTextInfo == null) otherTextInfo = DialogX.buttonTextInfo;
             if (inputInfo == null) inputInfo = DialogX.inputInfo;
-            if (DialogX.backgroundColor != -1) setBackgroundColor(DialogX.backgroundColor);
+            if (backgroundColor == -1) backgroundColor = DialogX.backgroundColor;
             
             txtDialogTitle.getPaint().setFakeBoldText(true);
             btnSelectNegative.getPaint().setFakeBoldText(true);

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

@@ -320,7 +320,7 @@ public class PopTip extends BaseDialog {
         public void init() {
             if (messageTextInfo == null) messageTextInfo = DialogX.popTextInfo;
             if (buttonTextInfo == null) buttonTextInfo = DialogX.buttonTextInfo;
-            if (DialogX.backgroundColor != -1) setBackgroundColor(DialogX.backgroundColor);
+            if (backgroundColor == -1) backgroundColor = DialogX.backgroundColor;
             
             boxRoot.setFocusable(false);
             boxRoot.setFocusableInTouchMode(false);

+ 11 - 0
DialogX/src/main/java/com/kongzue/dialogx/dialogs/WaitDialog.java

@@ -194,6 +194,7 @@ public class WaitDialog extends BaseDialog {
         
         public void init() {
             if (messageTextInfo == null) messageTextInfo = DialogX.tipTextInfo;
+            if (backgroundColor == -1) backgroundColor = DialogX.tipBackgroundColor;
             
             blurView.setRadiusPx(dip2px(15));
             boxRoot.setClickable(true);
@@ -281,6 +282,7 @@ public class WaitDialog extends BaseDialog {
                     txtInfo.setTextColor(Color.BLACK);
                 }
             }
+            if (DialogX.tipProgressColor != -1) progressView.setColor(DialogX.tipProgressColor);
             
             if (waitProgress >= 0 && waitProgress <= 1 && oldProgress != waitProgress) {
                 progressView.progress(waitProgress);
@@ -362,6 +364,15 @@ public class WaitDialog extends BaseDialog {
         }
     }
     
+    @Override
+    public boolean isLightTheme() {
+        if (DialogX.tipTheme == null) {
+            return super.isLightTheme();
+        } else {
+            return DialogX.tipTheme == DialogX.THEME.LIGHT;
+        }
+    }
+    
     public void refreshUI() {
         if (dialogImpl == null) return;
         getRootFrameLayout().post(new Runnable() {

+ 2 - 2
README.md

@@ -106,7 +106,7 @@ DialogX 采用了主体分离结构,主框架仅包含 Material 设计风格
 想要在您的项目引入 DialogX,您需要在 app 的 build.gradle 文件中找到 `dependencies{}` 代码块,并在其中加入以下语句:
 
 ```
-implementation 'com.kongzue.dialogx:DialogX:0.0.10'
+implementation 'com.kongzue.dialogx:DialogX:0.0.11'
 ```
 
 若有需要,也可以手动配置 Maven:
@@ -115,7 +115,7 @@ implementation 'com.kongzue.dialogx:DialogX:0.0.10'
 <dependency>
   <groupId>com.kongzue.dialogx</groupId>
   <artifactId>DialogX</artifactId>
-  <version>0.0.10</version>
+  <version>0.0.11</version>
   <type>pom</type>
 </dependency>
 ```

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

@@ -161,7 +161,8 @@ public class MainActivity extends BaseActivity {
                             finish();
                             return false;
                         }
-                    });
+                    })
+                    .setCancelable(false);
         }
     }