Browse Source

0.0.49.beta6
- 对 BottomMenu 的 setOkButton、setCancelButton、setOtherButton 提供了单独的 OnBottomMenuButtonClickListener 参数接口,可直接提供 BottomMenu 参数的 onClick 回调事件;
- BottomDialog/BottomMenu 新增 set/get OkTextInfo 和 OtherTextInfo 方法;
- 修复 DialogXBaseRelativeLayout 可能存在的嵌套循环调用 requestFocus() 方法的问题;
- 修复关于 WaitDialog 设置背景颜色不生效的问题;

0.0.49.beta5 ready
- ActivityScreenShotImageView 增加静态方法 useHardwareRenderingMode,开启可使用硬件加速渲染模式;
- 修复部分系统下 ActivityScreenShotImageView 在执行回收时触发的“Software rendering doesn't support hardware bitmaps.”异常;
- 其他问题修复;

0.0.49.beta4 ready
- 修复部分系统下 BlurRelativeLayout 或 BlurRelativeLayout 在执行回收时触发的“Calling RS with no Context active.”异常;
- ActivityScreenShotImageView 截图方案更新;

0.0.49.beta4 ready
- 修复在部分设备上由 DialogXBaseRelativeLayout 引发的 StackOverflowError,此问题猜测跟特定版本系统固件存在问题有关;

0.0.49.beta3
- 修复 ActivityScreenShotImageView 可能引发的“Software rendering doesn’t support hardware bitmaps” 异常;
- 修复 BottomDialog/FullScreenDialog 的滑动事件在内部存在 ScrollController 时,若触摸位置处于 ScrollController 布局外无法滑动对话框的问题;

0.0.49.beta2
- InputInfo新增方法:`getInputFilters()`、`setInputFilters(InputFilter[] inputFilters)`、`addInputFilter(InputFilter inputFilter)` 和 `removeInputFilter(InputFilter inputFilter)`(issues:332);
- 尝试性修复 DialogFragment 模式实现下的 WaitDialog 内存泄漏问题(issues:334);
- 修复关于DialogFragmentImpl引发的空指针问题此问题(issues:335);

0.0.49.beta1
- 修复 BlurRelativeLayout 和 BlurLinearLayout 在 iOS 主题下使用 DialogFragment 模式时存在的渲染宽度和高度 <=0 导致的异常(issues:324);
- 修复 IOS 主题下可能存在的 `RSInvalidStateException: Calling RS with no Context active` 异常问题(issues:327);
- 修复可能存在的高频启关对话框过程中,因UI未完成构建被关闭引发的空指针异常(issues:331);

Kongzue 1 year ago
parent
commit
cdf68d7c71

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

@@ -84,18 +84,18 @@ public class DialogX {
     //默认底部菜单文本样式
     public static TextInfo menuTextInfo;
     
-    //默认对话框背景颜色(值为 ColorInt,为-1不生效)
-    public static int backgroundColor = -1;
+    //默认对话框背景颜色(值为 ColorInt,为 null 不生效)
+    public static Integer backgroundColor = null;
     
-    //默认 TipDialog 和 WaitDialog 背景颜色(值为 ColorInt,为-1不生效)
-    public static int tipBackgroundColor = -1;
+    //默认 TipDialog 和 WaitDialog 背景颜色(值为 ColorInt,为 null 不生效)
+    public static Integer tipBackgroundColor = null;
     
     /**
      * 重写 TipDialog 和 WaitDialog 进度动画颜色,
      * 注意此属性为覆盖性质,即设置此值将替换提示框原本的进度动画的颜色,包括亮暗色切换的颜色变化也将被替代
-     * (值为 ColorInt,为-1不生效)
+     * (值为 ColorInt,为 null 不生效)
      */
-    public static int tipProgressColor = -1;
+    public static Integer tipProgressColor = null;
     
     //默认对话框默认是否可以点击外围遮罩区域或返回键关闭,此开关不影响提示框(TipDialog)以及等待框(TipDialog)
     public static boolean cancelable = true;

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

@@ -71,7 +71,7 @@ public class BottomDialog extends BaseDialog implements DialogXBaseBottomDialog
     protected CharSequence otherText;
     protected boolean allowInterceptTouch = true;
     protected boolean bottomNonSafetyAreaBySelf = false;
-    protected int maskColor = -1;
+    protected Integer maskColor = null;
     protected BaseOnDialogClickCallback cancelButtonClickListener;
     protected BaseOnDialogClickCallback okButtonClickListener;
     protected BaseOnDialogClickCallback otherButtonClickListener;
@@ -327,7 +327,7 @@ public class BottomDialog extends BaseDialog implements DialogXBaseBottomDialog
             if (okTextInfo == null) okTextInfo = DialogX.buttonTextInfo;
             if (cancelTextInfo == null) cancelTextInfo = DialogX.buttonTextInfo;
             if (otherTextInfo == null) otherTextInfo = DialogX.buttonTextInfo;
-            if (backgroundColor == -1) backgroundColor = DialogX.backgroundColor;
+            if (backgroundColor == null) backgroundColor = DialogX.backgroundColor;
             if (cancelText == null) cancelText = DialogX.cancelButtonText;
 
             txtDialogTitle.getPaint().setFakeBoldText(true);
@@ -500,7 +500,7 @@ public class BottomDialog extends BaseDialog implements DialogXBaseBottomDialog
                 return;
             }
             boxRoot.setRootPadding(screenPaddings[0], screenPaddings[1], screenPaddings[2], screenPaddings[3]);
-            if (backgroundColor != -1) {
+            if (backgroundColor != null) {
                 tintColor(bkg, backgroundColor);
                 tintColor(btnSelectOther, backgroundColor);
                 tintColor(btnSelectNegative, backgroundColor);
@@ -573,7 +573,7 @@ public class BottomDialog extends BaseDialog implements DialogXBaseBottomDialog
                 }
             }
 
-            if (maskColor != -1) {
+            if (maskColor != null) {
                 boxRoot.setBackground(new ColorDrawable(maskColor));
             }
 

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

@@ -280,7 +280,7 @@ public class FullScreenDialog extends BaseDialog implements DialogXBaseBottomDia
                 return;
             }
             boxRoot.setRootPadding(screenPaddings[0], screenPaddings[1], screenPaddings[2], screenPaddings[3]);
-            if (backgroundColor != -1) {
+            if (backgroundColor != null) {
                 tintColor(bkg, backgroundColor);
             }
 

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

@@ -52,7 +52,7 @@ public class GuideDialog extends CustomDialog {
     protected STAGE_LIGHT_TYPE stageLightType = STAGE_LIGHT_TYPE.CIRCLE_OUTSIDE;
     protected Drawable tipImage;
     protected float stageLightFilletRadius;     //舞台灯光部分的圆角
-    protected int maskColor = -1;
+    protected Integer maskColor = null;
     protected OnDialogButtonClickListener<GuideDialog> onStageLightPathClickListener;
     protected int[] baseViewLocationCoordinateCompensation = new int[4];
     
@@ -523,7 +523,7 @@ public class GuideDialog extends CustomDialog {
     protected void onDialogShow() {
         super.onDialogShow();
         if (baseView == null) {
-            super.setMaskColor(maskColor == -1 ? getColor(R.color.black50) : maskColor);
+            super.setMaskColor(maskColor == null ? getColor(R.color.black50) : maskColor);
         }
     }
     
@@ -628,7 +628,7 @@ public class GuideDialog extends CustomDialog {
             break;
         }
         stageLightPaint.setXfermode(null);
-        canvas.drawColor(maskColor == -1 ? getColor(R.color.black50) : maskColor, PorterDuff.Mode.SRC_OUT);
+        canvas.drawColor(maskColor == null ? getColor(R.color.black50) : maskColor, PorterDuff.Mode.SRC_OUT);
         
         BitmapDrawable bkgDrawable = new BitmapDrawable(getResources(), bkg);
         getDialogImpl().boxRoot.setBackground(bkgDrawable);

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

@@ -100,7 +100,7 @@ public class MessageDialog extends BaseDialog {
     protected CharSequence otherText;
     protected String inputText;
     protected String inputHintText;
-    protected int maskColor = -1;
+    protected Integer maskColor = null;
     protected float backgroundRadius = -1;
     protected Drawable titleIcon;
 
@@ -326,7 +326,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 (backgroundColor == -1) backgroundColor = DialogX.backgroundColor;
+            if (backgroundColor == null) backgroundColor = DialogX.backgroundColor;
 
             txtDialogTitle.getPaint().setFakeBoldText(true);
             btnSelectNegative.getPaint().setFakeBoldText(true);
@@ -555,7 +555,7 @@ public class MessageDialog extends BaseDialog {
             }
 
             boxRoot.setRootPadding(screenPaddings[0], screenPaddings[1], screenPaddings[2], screenPaddings[3]);
-            if (backgroundColor != -1) {
+            if (backgroundColor != null) {
                 tintColor(bkg, backgroundColor);
                 if (style instanceof MaterialStyle) {
                     tintColor(btnSelectOther, backgroundColor);
@@ -589,7 +589,7 @@ public class MessageDialog extends BaseDialog {
                 txtInput.setVisibility(View.GONE);
             }
             boxRoot.setClickable(true);
-            if (maskColor != -1) {
+            if (maskColor != null) {
                 boxRoot.setBackgroundColor(maskColor);
             }
             if (backgroundRadius > -1) {

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

@@ -619,7 +619,7 @@ public class PopMenu extends BaseDialog {
                 boxBody.setMinimumHeight(height);
             }
 
-            if (backgroundColor != -1) {
+            if (backgroundColor != null) {
                 tintColor(boxBody, backgroundColor);
 
                 if (blurViews != null) {

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

@@ -526,7 +526,7 @@ public class PopNotification extends BaseDialog implements NoTouchInterface {
             if (titleTextInfo == null) titleTextInfo = DialogX.titleTextInfo;
             if (messageTextInfo == null) messageTextInfo = DialogX.messageTextInfo;
             if (buttonTextInfo == null) buttonTextInfo = DialogX.buttonTextInfo;
-            if (backgroundColor == -1) backgroundColor = DialogX.backgroundColor;
+            if (backgroundColor == null) backgroundColor = DialogX.backgroundColor;
 
             if (autoDismissTimer == null) {
                 showShort();
@@ -627,7 +627,7 @@ public class PopNotification extends BaseDialog implements NoTouchInterface {
                     Float popNotificationRadius = null;
                     if (getStyle().popNotificationSettings() != null && getStyle().popNotificationSettings().blurBackgroundSettings() != null &&
                             getStyle().popNotificationSettings().blurBackgroundSettings().blurBackground()) {
-                        blurFrontColor = backgroundColor == -1 ?
+                        blurFrontColor = backgroundColor == null ?
                                 getColorNullable(getIntStyleAttr(getStyle().popNotificationSettings().blurBackgroundSettings().blurForwardColorRes(isLightTheme()))) :
                                 backgroundColor;
                         popNotificationRadius = getFloatStyleAttr((float) getStyle().popNotificationSettings().blurBackgroundSettings().blurBackgroundRoundRadiusPx());
@@ -677,7 +677,7 @@ public class PopNotification extends BaseDialog implements NoTouchInterface {
                 return;
             }
             boxRoot.setRootPadding(screenPaddings[0], screenPaddings[1], screenPaddings[2], screenPaddings[3]);
-            if (backgroundColor != -1) {
+            if (backgroundColor != null) {
                 tintColor(boxBody, backgroundColor);
 
                 if (blurViews != null) {

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

@@ -498,7 +498,7 @@ public class PopTip extends BaseDialog implements NoTouchInterface {
         public void init() {
             if (messageTextInfo == null) messageTextInfo = DialogX.popTextInfo;
             if (buttonTextInfo == null) buttonTextInfo = DialogX.buttonTextInfo;
-            if (backgroundColor == -1) backgroundColor = DialogX.backgroundColor;
+            if (backgroundColor == null) backgroundColor = DialogX.backgroundColor;
 
             if (autoDismissTimer == null) {
                 showShort();
@@ -604,7 +604,7 @@ public class PopTip extends BaseDialog implements NoTouchInterface {
                 return;
             }
             boxRoot.setRootPadding(screenPaddings[0], screenPaddings[1], screenPaddings[2], screenPaddings[3]);
-            if (backgroundColor != -1) {
+            if (backgroundColor != null) {
                 tintColor(boxBody, backgroundColor);
 
                 if (blurViews != null) {

+ 12 - 7
DialogX/src/main/java/com/kongzue/dialogx/dialogs/WaitDialog.java

@@ -91,7 +91,7 @@ public class WaitDialog extends BaseDialog {
     protected float waitProgress = -1;
     protected int showType = -1;        //-1:WaitDialog 状态标示符,其余为 TipDialog 状态标示
     protected TextInfo messageTextInfo;
-    protected int maskColor = -1;
+    protected Integer maskColor = null;
     protected BOOLEAN privateCancelable;
 
     protected DialogLifecycleCallback<WaitDialog> dialogLifecycleCallback;
@@ -329,7 +329,7 @@ public class WaitDialog extends BaseDialog {
 
         public void init() {
             if (messageTextInfo == null) messageTextInfo = DialogX.tipTextInfo;
-            if (backgroundColor == -1) backgroundColor = DialogX.tipBackgroundColor;
+            if (backgroundColor == null) backgroundColor = DialogX.tipBackgroundColor;
 
             blurViews = findAllBlurView(dialogView.get());
 
@@ -425,11 +425,16 @@ public class WaitDialog extends BaseDialog {
             bkg.setMinWidth(getMinWidth());
             bkg.setMinHeight(getMinHeight());
 
-            if (backgroundColor != -1) {
+            if (backgroundColor != null) {
                 if (blurViews != null) {
                     for (View blurView : blurViews) {
-                        ((BlurViewType) blurView).setOverlayColor(getResources().getColor(backgroundColor));
+                        ((BlurViewType) blurView).setOverlayColor(backgroundColor);
                     }
+                } else {
+                    GradientDrawable gradientDrawable = (GradientDrawable) getResources().getDrawable(R.drawable.rect_dialogx_material_wait_bkg);
+                    gradientDrawable.setColor(getBackgroundColor());
+                    gradientDrawable.setCornerRadius(getRadius());
+                    bkg.setBackground(gradientDrawable);
                 }
             }
             if (style.overrideWaitTipRes() != null) {
@@ -441,7 +446,7 @@ public class WaitDialog extends BaseDialog {
                 txtInfo.setTextColor(getResources().getColor(overrideTextColorRes));
                 progressView.setColor(getResources().getColor(overrideTextColorRes));
             }
-            if (DialogX.tipProgressColor != -1) progressView.setColor(DialogX.tipProgressColor);
+            if (DialogX.tipProgressColor != null) progressView.setColor(DialogX.tipProgressColor);
 
             if (waitProgress >= 0 && waitProgress <= 1 && oldProgress != waitProgress) {
                 progressView.progress(waitProgress);
@@ -467,7 +472,7 @@ public class WaitDialog extends BaseDialog {
             showText(txtInfo, message);
             useTextInfo(txtInfo, messageTextInfo);
 
-            if (maskColor != -1) {
+            if (maskColor != null) {
                 boxRoot.setBackgroundColor(maskColor);
             }
 
@@ -1170,7 +1175,7 @@ public class WaitDialog extends BaseDialog {
     }
 
     public float getRadius() {
-        return backgroundRadius;
+        return backgroundRadius < 0 ? dip2px(15) : backgroundRadius;
     }
 
     public DialogXAnimInterface<WaitDialog> getDialogXAnimImpl() {

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

@@ -506,7 +506,7 @@ public abstract class BaseDialog implements LifecycleOwner {
     protected DialogXStyle style;
     protected DialogX.THEME theme;
     protected boolean autoShowInputKeyboard;
-    protected int backgroundColor = -1;
+    protected Integer backgroundColor = null;
     protected long enterAnimDuration = -1;
     protected long exitAnimDuration = -1;
     protected int maxWidth;

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

@@ -548,6 +548,7 @@ public class MainActivity extends BaseActivity {
             @Override
             public void onClick(View v) {
                 WaitDialog.show("Please Wait!")
+                        .setBackgroundColor(Color.GRAY)
                         .setOnBackPressedListener(new OnBackPressedListener<WaitDialog>() {
                             @Override
                             public boolean onBackPressed(WaitDialog dialog) {