Browse Source

0.0.50.beta17
- 修复了 MessageDialog 和 BottomDialog 在不设置任何 button 时可能存在布局占位的问题;
- 修复了 MIUI 主题中的已知问题;
- 去除了 OnBindView 的异常日志打印;

Kongzue 8 months ago
parent
commit
a5d3bea4cf

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

@@ -343,7 +343,7 @@ public class BottomDialog extends BaseDialog implements DialogXBaseBottomDialog
             if (backgroundColor == null) backgroundColor = DialogX.backgroundColor;
             if (cancelText == null) cancelText = DialogX.cancelButtonText;
 
-            if (txtDialogTitle != null)txtDialogTitle.getPaint().setFakeBoldText(true);
+            if (txtDialogTitle != null) txtDialogTitle.getPaint().setFakeBoldText(true);
             if (btnSelectNegative != null) btnSelectNegative.getPaint().setFakeBoldText(true);
             if (btnSelectPositive != null) btnSelectPositive.getPaint().setFakeBoldText(true);
             if (btnSelectOther != null) btnSelectOther.getPaint().setFakeBoldText(true);
@@ -539,6 +539,8 @@ public class BottomDialog extends BaseDialog implements DialogXBaseBottomDialog
             useTextInfo(btnSelectOther, otherTextInfo);
             useTextInfo(btnSelectPositive, okTextInfo);
 
+            boxButton.setVisibility(btnSelectNegative.getVisibility() == View.VISIBLE || btnSelectOther.getVisibility() == View.VISIBLE || btnSelectPositive.getVisibility() == View.VISIBLE ? View.VISIBLE : View.GONE);
+
             if (titleIcon != null) {
                 int size = (int) txtDialogTitle.getTextSize();
                 titleIcon.setBounds(0, 0, size, size);
@@ -1398,7 +1400,7 @@ public class BottomDialog extends BaseDialog implements DialogXBaseBottomDialog
             if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                 getDialogView().setTranslationZ(orderIndex);
             } else {
-                error("DialogX: " + dialogKey() + " 执行 .setThisOrderIndex("+orderIndex+") 失败:系统不支持此方法,SDK-API 版本必须大于 21(LOLLIPOP)");
+                error("DialogX: " + dialogKey() + " 执行 .setThisOrderIndex(" + orderIndex + ") 失败:系统不支持此方法,SDK-API 版本必须大于 21(LOLLIPOP)");
             }
         }
         return this;

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

@@ -542,8 +542,7 @@ public class MessageDialog extends BaseDialog {
                         txtInput.getTextCursorDrawable().mutate().setColorFilter((new PorterDuffColorFilter(cursorColor, PorterDuff.Mode.SRC_ATOP)));
                     } else {
                         try {
-                            @SuppressLint("SoonBlockedPrivateApi")
-                            Field field = TextView.class.getDeclaredField("mCursorDrawableRes");
+                            @SuppressLint("SoonBlockedPrivateApi") Field field = TextView.class.getDeclaredField("mCursorDrawableRes");
                             field.setAccessible(true);
                             field.set(txtInput, R.drawable.rect_dialogx_defalut_edittxt_cursor);
                             txtInput.getTextCursorDrawable().mutate().setColorFilter((new PorterDuffColorFilter(cursorColor, PorterDuff.Mode.SRC_ATOP)));
@@ -663,6 +662,8 @@ public class MessageDialog extends BaseDialog {
             useTextInfo(btnSelectNegative, cancelTextInfo);
             useTextInfo(btnSelectOther, otherTextInfo);
 
+            boxButton.setVisibility(btnSelectNegative.getVisibility() == View.VISIBLE || btnSelectOther.getVisibility() == View.VISIBLE || btnSelectPositive.getVisibility() == View.VISIBLE ? View.VISIBLE : View.GONE);
+
             if (titleIcon != null) {
                 int size = (int) txtDialogTitle.getTextSize();
                 titleIcon.setBounds(0, 0, size, size);
@@ -711,25 +712,19 @@ public class MessageDialog extends BaseDialog {
                             case DialogXStyle.BUTTON_OK:
                                 boxButton.addView(btnSelectPositive);
                                 if (style.overrideVerticalButtonRes() != null) {
-                                    btnSelectPositive.setBackgroundResource(
-                                            style.overrideVerticalButtonRes().overrideVerticalOkButtonBackgroundRes(visibleButtonCount, isLightTheme())
-                                    );
+                                    btnSelectPositive.setBackgroundResource(style.overrideVerticalButtonRes().overrideVerticalOkButtonBackgroundRes(visibleButtonCount, isLightTheme()));
                                 }
                                 break;
                             case DialogXStyle.BUTTON_OTHER:
                                 boxButton.addView(btnSelectOther);
                                 if (style.overrideVerticalButtonRes() != null) {
-                                    btnSelectOther.setBackgroundResource(
-                                            style.overrideVerticalButtonRes().overrideVerticalOtherButtonBackgroundRes(visibleButtonCount, isLightTheme())
-                                    );
+                                    btnSelectOther.setBackgroundResource(style.overrideVerticalButtonRes().overrideVerticalOtherButtonBackgroundRes(visibleButtonCount, isLightTheme()));
                                 }
                                 break;
                             case DialogXStyle.BUTTON_CANCEL:
                                 boxButton.addView(btnSelectNegative);
                                 if (style.overrideVerticalButtonRes() != null) {
-                                    btnSelectNegative.setBackgroundResource(
-                                            style.overrideVerticalButtonRes().overrideVerticalCancelButtonBackgroundRes(visibleButtonCount, isLightTheme())
-                                    );
+                                    btnSelectNegative.setBackgroundResource(style.overrideVerticalButtonRes().overrideVerticalCancelButtonBackgroundRes(visibleButtonCount, isLightTheme()));
                                 }
                                 break;
                             case DialogXStyle.SPACE:
@@ -756,25 +751,19 @@ public class MessageDialog extends BaseDialog {
                             case DialogXStyle.BUTTON_OK:
                                 boxButton.addView(btnSelectPositive);
                                 if (style.overrideHorizontalButtonRes() != null) {
-                                    btnSelectPositive.setBackgroundResource(
-                                            style.overrideHorizontalButtonRes().overrideHorizontalOkButtonBackgroundRes(visibleButtonCount, isLightTheme())
-                                    );
+                                    btnSelectPositive.setBackgroundResource(style.overrideHorizontalButtonRes().overrideHorizontalOkButtonBackgroundRes(visibleButtonCount, isLightTheme()));
                                 }
                                 break;
                             case DialogXStyle.BUTTON_OTHER:
                                 boxButton.addView(btnSelectOther);
                                 if (style.overrideHorizontalButtonRes() != null) {
-                                    btnSelectOther.setBackgroundResource(
-                                            style.overrideHorizontalButtonRes().overrideHorizontalOtherButtonBackgroundRes(visibleButtonCount, isLightTheme())
-                                    );
+                                    btnSelectOther.setBackgroundResource(style.overrideHorizontalButtonRes().overrideHorizontalOtherButtonBackgroundRes(visibleButtonCount, isLightTheme()));
                                 }
                                 break;
                             case DialogXStyle.BUTTON_CANCEL:
                                 boxButton.addView(btnSelectNegative);
                                 if (style.overrideHorizontalButtonRes() != null) {
-                                    btnSelectNegative.setBackgroundResource(
-                                            style.overrideHorizontalButtonRes().overrideHorizontalCancelButtonBackgroundRes(visibleButtonCount, isLightTheme())
-                                    );
+                                    btnSelectNegative.setBackgroundResource(style.overrideHorizontalButtonRes().overrideHorizontalCancelButtonBackgroundRes(visibleButtonCount, isLightTheme()));
                                 }
                                 break;
                             case DialogXStyle.SPACE:

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

@@ -155,7 +155,6 @@ public abstract class OnBindView<D> {
             waitBind(parentView, null);
             return;
         }
-        Log.e(">>>", "bindParent: getCustomView().getParent()=" + getCustomView().getParent() + "  parentView="+parentView );
         if (getCustomView().getParent() == parentView || parentView.getTag(PARENT_FLAG) == getCustomView().toString()) {
             return;
         }

+ 1 - 1
DialogXMIUIStyle/src/main/res/drawable/rect_dialogx_miui_bkg_night.xml

@@ -3,7 +3,7 @@
     android:shape="rectangle">
     <!--left to right-->
     <solid
-        android:color="@color/dialogxMIUIEditboxBkgDark"/>
+        android:color="@color/dialogxMIUIDialogBkgDark"/>
 
     <corners
         android:topRightRadius="20dp"

+ 1 - 1
DialogXMIUIStyle/src/main/res/drawable/rect_dialogx_miui_editbox_focus_night.xml

@@ -3,7 +3,7 @@
     android:shape="rectangle">
 
     <stroke
-        android:color="#0C84FF"
+        android:color="@color/dialogxMIUIEditboxBlue"
         android:width="2dp"/>
 
     <solid

+ 1 - 0
DialogXMIUIStyle/src/main/res/layout/layout_dialogx_bottom_miui.xml

@@ -46,6 +46,7 @@
                     android:layout_weight="1"
                     android:overScrollMode="never"
                     android:scrollbarSize="7dp"
+                    android:scrollbarThumbVertical="@drawable/scrollbar_dialogx_vertical"
                     android:scrollbars="vertical">
 
                     <LinearLayout

+ 1 - 0
DialogXMIUIStyle/src/main/res/layout/layout_dialogx_bottom_miui_dark.xml

@@ -46,6 +46,7 @@
                     android:layout_weight="1"
                     android:overScrollMode="never"
                     android:scrollbarSize="7dp"
+                    android:scrollbarThumbVertical="@drawable/scrollbar_dialogx_vertical_dark"
                     android:scrollbars="vertical">
 
                     <LinearLayout

+ 1 - 0
DialogXMIUIStyle/src/main/res/layout/layout_dialogx_miui.xml

@@ -97,6 +97,7 @@
                             android:scrollbars="vertical"
                             android:text=""
                             android:textColor="@color/black90"
+                            android:textColorHint="@color/dialogxMIUIEditTextHintColor"
                             android:textSize="16dp"
                             android:theme="@style/DialogXCompatThemeLight"
                             android:visibility="gone" />

+ 1 - 0
DialogXMIUIStyle/src/main/res/layout/layout_dialogx_miui_dark.xml

@@ -96,6 +96,7 @@
                             android:scrollbars="vertical"
                             android:text=""
                             android:textColor="@color/white"
+                            android:textColorHint="@color/dialogxMIUIEditTextHintColorDark"
                             android:textSize="16dp"
                             android:theme="@style/DialogXCompatThemeLight"
                             android:visibility="gone" />

+ 3 - 0
DialogXMIUIStyle/src/main/res/values/colors.xml

@@ -32,6 +32,7 @@
 
     <color name="dialogxColorBlue">#2196F3</color>
 
+    <color name="dialogxMIUIDialogBkgDark">#222224</color>
     <color name="dialogxMIUIEditboxBkgDark">#222224</color>
     <color name="dialogxMIUIEditboxBlue">#0C84FF</color>
     <color name="dialogxMIUIEditboxBkg">#EDEDED</color>
@@ -48,6 +49,8 @@
     <color name="dialogxMIUIButtonGrayPressDark">#29292B</color>
     <color name="dialogxMIUIItemSelectionBkg">#1A0C84FF</color>
     <color name="dialogxMIUIItemSelectionBkgDark">#6282BA</color>
+    <color name="dialogxMIUIEditTextHintColor">#ACACAC</color>
+    <color name="dialogxMIUIEditTextHintColorDark">#5F5F5F</color>
 
     <color name="dialogxWaitBkgLight">#F5F6F7</color>
     <color name="dialogxWaitBkgDark">#3F3F3F</color>

+ 1 - 1
gradle.properties

@@ -19,7 +19,7 @@ android.useAndroidX=true
 # Automatically convert third-party libraries to use AndroidX
 android.enableJetifier=true
 
-BUILD_VERSION=0.0.50.beta16
+BUILD_VERSION=0.0.50.beta17
 BUILD_VERSION_INT=49
 DIALOGX_STYLE_VERSION=5
 android.nonTransitiveRClass=true