Browse Source

update 0.0.25 ver.

kongzue 4 years ago
parent
commit
74d09b9489

+ 3 - 3
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.24"
+version = BUILD_VERSION
 
 android {
     compileSdkVersion 30
@@ -14,8 +14,8 @@ android {
     defaultConfig {
         minSdkVersion 21
         targetSdkVersion 30
-        versionCode 24
-        versionName "0.0.24"
+        versionCode BUILD_VERSION_INT as int
+        versionName BUILD_VERSION
 
         consumerProguardFiles "consumer-rules.pro"
 

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

@@ -84,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;

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

@@ -3,6 +3,7 @@ package com.kongzue.dialogx.dialogs;
 import android.animation.Animator;
 import android.animation.ObjectAnimator;
 import android.app.Activity;
+import android.graphics.Color;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewTreeObserver;
@@ -19,6 +20,7 @@ import android.widget.TextView;
 
 import androidx.annotation.ColorInt;
 import androidx.annotation.ColorRes;
+import androidx.core.content.ContextCompat;
 
 import com.kongzue.dialogx.DialogX;
 import com.kongzue.dialogx.R;
@@ -57,6 +59,7 @@ public class BottomDialog extends BaseDialog {
     protected CharSequence okText;
     protected CharSequence otherText;
     protected boolean allowInterceptTouch = true;
+    protected int maskColor = -1;
     protected OnDialogButtonClickListener<BottomDialog> cancelButtonClickListener;
     protected OnDialogButtonClickListener<BottomDialog> okButtonClickListener;
     protected OnDialogButtonClickListener<BottomDialog> otherButtonClickListener;
@@ -437,6 +440,8 @@ public class BottomDialog extends BaseDialog {
             } else {
                 boxRoot.setOnClickListener(null);
             }
+    
+            if (maskColor != -1) boxRoot.setBackgroundColor(maskColor);
             
             if (onBindView != null) {
                 if (onBindView.getCustomView() != null) {
@@ -787,4 +792,10 @@ public class BottomDialog extends BaseDialog {
         this.otherButtonClickListener = OtherButtonClickListener;
         return this;
     }
+    
+    public BottomDialog setMaskColor(@ColorInt int maskColor) {
+        this.maskColor = maskColor;
+        refreshUI();
+        return this;
+    }
 }

+ 6 - 0
DialogX/src/main/java/com/kongzue/dialogx/dialogs/BottomMenu.java

@@ -875,4 +875,10 @@ public class BottomMenu extends BottomDialog {
         this.otherButtonClickListener = OtherButtonClickListener;
         return this;
     }
+    
+    public BottomDialog setMaskColor(@ColorInt int maskColor) {
+        this.maskColor = maskColor;
+        refreshUI();
+        return this;
+    }
 }

+ 12 - 0
DialogX/src/main/java/com/kongzue/dialogx/dialogs/CustomDialog.java

@@ -2,6 +2,7 @@ package com.kongzue.dialogx.dialogs;
 
 import android.animation.Animator;
 import android.app.Activity;
+import android.graphics.Color;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.animation.AccelerateInterpolator;
@@ -10,6 +11,8 @@ import android.view.animation.AnimationUtils;
 import android.view.animation.DecelerateInterpolator;
 import android.widget.RelativeLayout;
 
+import androidx.annotation.ColorInt;
+
 import com.kongzue.dialogx.DialogX;
 import com.kongzue.dialogx.R;
 import com.kongzue.dialogx.impl.AnimatorListenerEndCallBack;
@@ -39,6 +42,7 @@ public class CustomDialog extends BaseDialog {
     protected ALIGN align = ALIGN.CENTER;
     protected boolean autoUnsafePlacePadding = true;
     private View dialogView;
+    protected int maskColor = Color.TRANSPARENT;
     
     public enum ALIGN {
         CENTER,
@@ -194,6 +198,8 @@ public class CustomDialog extends BaseDialog {
                 boxRoot.setOnClickListener(null);
             }
             
+            boxRoot.setBackgroundColor(maskColor);
+            
             if (onBindView != null) {
                 if (onBindView.getCustomView() != null) {
                     boxCustom.removeView(onBindView.getCustomView());
@@ -346,4 +352,10 @@ public class CustomDialog extends BaseDialog {
         refreshUI();
         return this;
     }
+    
+    public CustomDialog setMaskColor(@ColorInt int maskColor) {
+        this.maskColor = maskColor;
+        refreshUI();
+        return this;
+    }
 }

+ 6 - 0
DialogX/src/main/java/com/kongzue/dialogx/dialogs/InputDialog.java

@@ -486,4 +486,10 @@ public class InputDialog extends MessageDialog {
         refreshUI();
         return this;
     }
+    
+    public InputDialog setMaskColor(@ColorInt int maskColor) {
+        this.maskColor = maskColor;
+        refreshUI();
+        return this;
+    }
 }

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

@@ -67,6 +67,7 @@ public class MessageDialog extends BaseDialog {
     protected CharSequence otherText;
     protected String inputText;
     protected String inputHintText;
+    protected int maskColor = -1;
     
     protected TextInfo titleTextInfo;
     protected TextInfo messageTextInfo;
@@ -417,6 +418,7 @@ public class MessageDialog extends BaseDialog {
                 txtInput.setVisibility(View.GONE);
             }
             boxRoot.setClickable(true);
+            if (maskColor != -1) boxRoot.setBackgroundColor(maskColor);
             
             showText(txtDialogTitle, title);
             showText(txtDialogTip, message);
@@ -932,4 +934,10 @@ public class MessageDialog extends BaseDialog {
         refreshUI();
         return this;
     }
+    
+    public MessageDialog setMaskColor(@ColorInt int maskColor) {
+        this.maskColor = maskColor;
+        refreshUI();
+        return this;
+    }
 }

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

@@ -56,6 +56,7 @@ public class WaitDialog extends BaseDialog {
     protected float waitProgress = -1;
     protected int showType = -1;        //-1:Waitdialog 状态标示符,其余为 TipDialog 状态标示
     protected TextInfo messageTextInfo;
+    protected int maskColor = -1;
     
     private DialogLifecycleCallback<WaitDialog> dialogLifecycleCallback;
     
@@ -301,6 +302,8 @@ public class WaitDialog extends BaseDialog {
             showText(txtInfo, message);
             useTextInfo(txtInfo, messageTextInfo);
             
+            if (maskColor != -1) boxRoot.setBackgroundColor(maskColor);
+            
             if (onBindView != null && onBindView.getCustomView() != null) {
                 boxCustomView.removeView(onBindView.getCustomView());
                 ViewGroup.LayoutParams lp = boxCustomView.getLayoutParams();
@@ -511,4 +514,10 @@ public class WaitDialog extends BaseDialog {
         refreshUI();
         return this;
     }
+    
+    public WaitDialog setMaskColor(@ColorInt int maskColor) {
+        this.maskColor = maskColor;
+        refreshUI();
+        return this;
+    }
 }

+ 3 - 3
DialogXIOSStyle/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.style.ios"
-version = "0.0.24"
+version = BUILD_VERSION
 
 android {
     compileSdkVersion 30
@@ -14,8 +14,8 @@ android {
     defaultConfig {
         minSdkVersion 21
         targetSdkVersion 30
-        versionCode 24
-        versionName "0.0.24"
+        versionCode BUILD_VERSION_INT as int
+        versionName BUILD_VERSION
     }
 
     buildTypes {

+ 3 - 3
DialogXKongzueStyle/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.style.kongzue"
-version = "0.0.24"
+version = BUILD_VERSION
 
 android {
     compileSdkVersion 30
@@ -14,8 +14,8 @@ android {
     defaultConfig {
         minSdkVersion 21
         targetSdkVersion 30
-        versionCode 24
-        versionName "0.0.24"
+        versionCode BUILD_VERSION_INT as int
+        versionName BUILD_VERSION
     }
 
     buildTypes {

+ 3 - 3
DialogXMIUIStyle/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.style.miui"
-version = "0.0.24"
+version = BUILD_VERSION
 
 android {
     compileSdkVersion 30
@@ -14,8 +14,8 @@ android {
     defaultConfig {
         minSdkVersion 21
         targetSdkVersion 30
-        versionCode 24
-        versionName "0.0.24"
+        versionCode BUILD_VERSION_INT as int
+        versionName BUILD_VERSION
 
     }
 

+ 9 - 3
README.md

@@ -87,7 +87,9 @@ DialogX 采用了主题分离结构,主框架仅包含 Material 设计风格
 
 主题设计开发者也可以通过使用 DialogX 提供的主题定制接口来实现自定义主题,或者对现有主题进行样式调整和修改。
 
-你还可以更深入的 [了解 DialogX 主题](https://github.com/kongzue/DialogX/wiki/%E4%BD%BF%E7%94%A8%E5%85%B6%E4%BB%96-DialogX%E4%B8%BB%E9%A2%98)
+你还可以更深入的 [了解如何使用 DialogX 主题](https://github.com/kongzue/DialogX/wiki/%E4%BD%BF%E7%94%A8%E5%85%B6%E4%BB%96-DialogX%E4%B8%BB%E9%A2%98)
+
+你还可以更深入的 [了解如何开发 DialogX 主题](https://github.com/kongzue/DialogX/wiki/%E8%87%AA%E5%AE%9A%E4%B9%89-DialogX-%E4%B8%BB%E9%A2%98)
 
 # Demo
 
@@ -104,7 +106,7 @@ DialogX 采用了主题分离结构,主框架仅包含 Material 设计风格
 想要在您的项目引入 DialogX,您需要在 app 的 build.gradle 文件中找到 `dependencies{}` 代码块,并在其中加入以下语句:
 
 ```
-implementation 'com.kongzue.dialogx:DialogX:0.0.24'
+implementation 'com.kongzue.dialogx:DialogX:0.0.25'
 ```
 
 若有需要,也可以手动配置 Maven:
@@ -113,7 +115,7 @@ implementation 'com.kongzue.dialogx:DialogX:0.0.24'
 <dependency>
   <groupId>com.kongzue.dialogx</groupId>
   <artifactId>DialogX</artifactId>
-  <version>0.0.24</version>
+  <version>0.0.25</version>
   <type>pom</type>
 </dependency>
 ```
@@ -124,6 +126,10 @@ implementation 'com.kongzue.dialogx:DialogX:0.0.24'
 
 <div align=center><img src="https://github.com/kongzue/DialogX/raw/master/readme/feedback_qq_qrcode.png" alt="反馈 DialogX" width="250" height="250" /></div>
 
+### 如何从 DialogV3 迁移至 DialogX
+
+请参考文章 [从 DialogV3 迁移至 DialogX](https://github.com/kongzue/DialogX/wiki/%E4%BB%8E-DialogV3-%E8%BF%81%E7%A7%BB%E8%87%B3-DialogX)
+
 # 开源协议
 
 DialogX 遵循 Apache License 2.0 开源协议。

+ 2 - 2
app/build.gradle

@@ -7,8 +7,8 @@ android {
         applicationId "com.kongzue.dialogxdemo"
         minSdkVersion 21
         targetSdkVersion 30
-        versionCode 24
-        versionName "0.0.24"
+        versionCode BUILD_VERSION_INT as int
+        versionName BUILD_VERSION
 
         renderscriptTargetApi 21
         renderscriptSupportModeEnabled true    // Enable RS support

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

@@ -208,9 +208,11 @@ public class MainActivity extends BaseActivity {
         grpStyle.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
             @Override
             public void onCheckedChanged(RadioGroup group, int checkedId) {
+                DialogX.cancelButtonText = "取消";
                 switch (checkedId) {
                     case R.id.rdo_material:
                         DialogX.globalStyle = MaterialStyle.style();
+                        DialogX.cancelButtonText = "";
                         break;
                     case R.id.rdo_kongzue:
                         DialogX.globalStyle = KongzueStyle.style();
@@ -610,7 +612,8 @@ public class MainActivity extends BaseActivity {
                             }
                         });
                     }
-                }).setFullScreen(true);
+                }).setFullScreen(true)
+                        .setMaskColor(getResources().getColor(R.color.black30));
             }
         });
         

+ 4 - 1
gradle.properties

@@ -16,4 +16,7 @@ org.gradle.jvmargs=-Xmx2048m
 # https://developer.android.com/topic/libraries/support-library/androidx-rn
 android.useAndroidX=true
 # Automatically convert third-party libraries to use AndroidX
-android.enableJetifier=true
+android.enableJetifier=true
+
+BUILD_VERSION=0.0.25
+BUILD_VERSION_INT=25