Browse Source

0.0.31.alpha2

kongzue 4 years ago
parent
commit
0ac08cbece
40 changed files with 505 additions and 334 deletions
  1. 1 0
      .idea/.name
  2. 1 6
      .idea/compiler.xml
  3. 7 0
      .idea/encodings.xml
  4. 1 0
      .idea/gradle.xml
  5. 10 0
      .idea/jarRepositories.xml
  6. 9 3
      .idea/misc.xml
  7. 7 55
      DialogX/build.gradle
  8. BIN
      DialogX/libs/DialogXInterface.jar
  9. 1 1
      DialogX/src/main/java/com/kongzue/dialogx/DialogX.java
  10. 25 0
      DialogX/src/main/java/com/kongzue/dialogx/dialogs/BottomDialog.java
  11. 1 0
      DialogX/src/main/java/com/kongzue/dialogx/dialogs/BottomMenu.java
  12. 19 1
      DialogX/src/main/java/com/kongzue/dialogx/dialogs/CustomDialog.java
  13. 18 1
      DialogX/src/main/java/com/kongzue/dialogx/dialogs/FullScreenDialog.java
  14. 26 1
      DialogX/src/main/java/com/kongzue/dialogx/dialogs/InputDialog.java
  15. 22 2
      DialogX/src/main/java/com/kongzue/dialogx/dialogs/MessageDialog.java
  16. 35 2
      DialogX/src/main/java/com/kongzue/dialogx/dialogs/PopTip.java
  17. 9 2
      DialogX/src/main/java/com/kongzue/dialogx/dialogs/WaitDialog.java
  18. 8 1
      DialogX/src/main/java/com/kongzue/dialogx/interfaces/BaseDialog.java
  19. 21 1
      DialogX/src/main/java/com/kongzue/dialogx/util/views/DialogXBaseRelativeLayout.java
  20. 12 12
      DialogX/src/main/res/layout/layout_dialogx_bottom_material_dark.xml
  21. 11 0
      DialogX/src/main/res/values-v29/styles.xml
  22. 6 64
      DialogXIOSStyle/build.gradle
  23. 0 9
      DialogXInterface/build.gradle
  24. BIN
      DialogXInterface/libs/android.jar
  25. 0 35
      DialogXInterface/src/main/java/com/kongzue/dialogx/interfaces/ProgressViewInterface.java
  26. 6 65
      DialogXKongzueStyle/build.gradle
  27. 6 65
      DialogXMIUIStyle/build.gradle
  28. 0 0
      DialogXStyleInterface/.gitignore
  29. 36 0
      DialogXStyleInterface/build.gradle
  30. 0 0
      DialogXStyleInterface/consumer-rules.pro
  31. 21 0
      DialogXStyleInterface/proguard-rules.pro
  32. 5 0
      DialogXStyleInterface/src/main/AndroidManifest.xml
  33. 0 0
      DialogXStyleInterface/src/main/java/com/kongzue/dialogx/interfaces/DialogXStyle.java
  34. 35 0
      DialogXStyleInterface/src/main/java/com/kongzue/dialogx/interfaces/ProgressViewInterface.java
  35. 2 1
      app/src/main/AndroidManifest.xml
  36. 26 1
      app/src/main/java/com/kongzue/dialogxdemo/MainActivity.java
  37. 14 5
      app/src/main/res/layout/activity_main.xml
  38. 1 1
      gradle.properties
  39. 102 0
      publish-mavencentral.gradle
  40. 1 0
      settings.gradle

+ 1 - 0
.idea/.name

@@ -0,0 +1 @@
+DialogXDemo

+ 1 - 6
.idea/compiler.xml

@@ -1,12 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="CompilerConfiguration">
-    <bytecodeTargetLevel target="1.7">
-      <module name="DialogXDemo.app" target="1.8" />
-      <module name="DialogXDemo.DialogX" target="1.8" />
-      <module name="DialogXDemo.DialogXIOSStyle" target="1.8" />
-      <module name="DialogXDemo.DialogXKongzueStyle" target="1.8" />
-      <module name="DialogXDemo.DialogXMIUIStyle" target="1.8" />
+    <bytecodeTargetLevel target="1.8">
       <module name="DialogXInterface" target="1.7" />
     </bytecodeTargetLevel>
   </component>

+ 7 - 0
.idea/encodings.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding">
+    <file url="file://$PROJECT_DIR$/DialogXInterface/src/main/java/com/kongzue/dialogx/interfaces/ProgressViewInterface.java" charset="GBK" />
+    <file url="file://$PROJECT_DIR$/DialogXStyleInterface/src/main/java/com/kongzue/dialogx/interfaces/ProgressViewInterface.java" charset="GBK" />
+  </component>
+</project>

+ 1 - 0
.idea/gradle.xml

@@ -16,6 +16,7 @@
             <option value="$PROJECT_DIR$/DialogXInterface" />
             <option value="$PROJECT_DIR$/DialogXKongzueStyle" />
             <option value="$PROJECT_DIR$/DialogXMIUIStyle" />
+            <option value="$PROJECT_DIR$/DialogXStyleInterface" />
             <option value="$PROJECT_DIR$/app" />
           </set>
         </option>

+ 10 - 0
.idea/jarRepositories.xml

@@ -26,5 +26,15 @@
       <option name="name" value="maven" />
       <option name="url" value="https://dl.bintray.com/myzchh/maven" />
     </remote-repository>
+    <remote-repository>
+      <option name="id" value="MavenRepo" />
+      <option name="name" value="MavenRepo" />
+      <option name="url" value="https://repo.maven.apache.org/maven2/" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="MavenLocal" />
+      <option name="name" value="MavenLocal" />
+      <option name="url" value="file:/$USER_HOME$/.m2/repository/" />
+    </remote-repository>
   </component>
 </project>

+ 9 - 3
.idea/misc.xml

@@ -89,7 +89,7 @@
     <option name="myDefaultNotNull" value="android.annotation.NonNull" />
     <option name="myNullables">
       <value>
-        <list size="12">
+        <list size="15">
           <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
           <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
           <item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
@@ -102,12 +102,15 @@
           <item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
           <item index="10" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
           <item index="11" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
+          <item index="12" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.Nullable" />
+          <item index="13" class="java.lang.String" itemvalue="io.reactivex.annotations.Nullable" />
+          <item index="14" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.Nullable" />
         </list>
       </value>
     </option>
     <option name="myNotNulls">
       <value>
-        <list size="11">
+        <list size="14">
           <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
           <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
           <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
@@ -119,11 +122,14 @@
           <item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
           <item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
           <item index="10" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
+          <item index="11" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.NonNull" />
+          <item index="12" class="java.lang.String" itemvalue="io.reactivex.annotations.NonNull" />
+          <item index="13" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.NonNull" />
         </list>
       </value>
     </option>
   </component>
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="false" project-jdk-name="1.8 (2)" project-jdk-type="JavaSDK">
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8 (2)" project-jdk-type="JavaSDK">
     <output url="file://$PROJECT_DIR$/build/classes" />
   </component>
   <component name="ProjectType">

+ 7 - 55
DialogX/build.gradle

@@ -1,12 +1,11 @@
 apply plugin: 'com.android.library'
-apply plugin: 'com.github.dcendents.android-maven'
-apply plugin: 'com.jfrog.bintray'
 
-def siteUrl = 'https://github.com/kongzue/DialogX' //项目在github主页地址
-def gitUrl = 'https://github.com/kongzue/DialogX.git'   //Git仓库的地址
-
-group = "com.kongzue.dialogx"
-version = BUILD_VERSION
+ext {
+    PUBLISH_GROUP_ID = "com.kongzue.dialogx"
+    PUBLISH_ARTIFACT_ID = 'dialogx'
+    PUBLISH_VERSION = BUILD_VERSION
+}
+apply from: "${rootProject.projectDir}/publish-mavencentral.gradle"
 
 android {
     compileSdkVersion 30
@@ -30,37 +29,6 @@ android {
         }
     }
 }
-
-install {
-    repositories.mavenInstaller {
-        // This generates POM.xml with proper parameters
-        pom {
-            project {
-                packaging 'aar'
-                name 'dialogx'
-                url siteUrl
-                licenses {
-                    license {
-                        name 'The Apache Software License, Version 2.0'
-                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
-                    }
-                }
-                developers {
-                    developer {
-                        id 'myzchh'//设置自己ID
-                        name 'myzchh'//设置自己名字
-                        email 'myzcxhh@live.cn'//设置自己邮箱
-                    }
-                }
-                scm {
-                    connection gitUrl
-                    developerConnection gitUrl
-                    url siteUrl
-                }
-            }
-        }
-    }
-}
 task sourcesJar(type: Jar) {
     from android.sourceSets.main.java.srcDirs
     classifier = 'sources'
@@ -70,23 +38,7 @@ artifacts {
     archives sourcesJar
 }
 
-Properties properties = new Properties()
-properties.load(project.rootProject.file('local.properties').newDataInputStream())
-bintray {
-    user = properties.getProperty("bintray.user")
-    key = properties.getProperty("bintray.apikey")
-    configurations = ['archives']
-    pkg {
-        repo = "maven"
-        name = "dialogX" //项目在JCenter的名字
-        websiteUrl = siteUrl
-        vcsUrl = gitUrl
-        licenses = ["Apache-2.0"]
-        publish = true
-    }
-}
 dependencies {
     implementation fileTree(dir: "libs", include: ["*.jar"])
-    implementation 'androidx.appcompat:appcompat:1.2.0+'
-    api files('libs\\DialogXInterface.jar')
+    implementation 'androidx.appcompat:appcompat:1.2.0'
 }

BIN
DialogX/libs/DialogXInterface.jar


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

@@ -99,7 +99,7 @@ public class DialogX {
     public static DialogLifecycleCallback<BaseDialog> dialogLifeCycleListener;
     
     public enum THEME {
-        LIGHT, DARK
+        LIGHT, DARK, AUTO
     }
     
     public static void init(Context context) {

+ 25 - 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.content.res.Configuration;
 import android.graphics.Color;
 import android.view.View;
 import android.view.ViewGroup;
@@ -274,6 +275,7 @@ public class BottomDialog extends BaseDialog {
             if (btnSelectPositive != null) btnSelectPositive.getPaint().setFakeBoldText(true);
             if (btnSelectOther != null) btnSelectOther.getPaint().setFakeBoldText(true);
             
+            boxRoot.setParentDialog(me);
             boxRoot.setOnLifecycleCallBack(new DialogXBaseRelativeLayout.OnLifecycleCallBack() {
                 @Override
                 public void onShow() {
@@ -843,4 +845,27 @@ public class BottomDialog extends BaseDialog {
         this.exitAnimDuration = exitAnimDuration;
         return this;
     }
+    
+    @Override
+    public void onUIModeChange(Configuration newConfig) {
+        if (dialogView != null) {
+            dismiss(dialogView);
+        }
+        if (getDialogImpl().boxCustom != null) {
+            getDialogImpl().boxCustom.removeAllViews();
+        }
+        if (getDialogImpl().boxList != null) {
+            getDialogImpl().boxList.removeAllViews();
+        }
+        int layoutId = isLightTheme() ? R.layout.layout_dialogx_bottom_material : R.layout.layout_dialogx_bottom_material_dark;
+        if (style.overrideBottomDialogRes() != null) {
+            layoutId = style.overrideBottomDialogRes().overrideDialogLayout(isLightTheme());
+        }
+    
+        enterAnimDuration = 0;
+        dialogView = createView(layoutId);
+        dialogImpl = new DialogImpl(dialogView);
+        dialogView.setTag(getClass().getSimpleName() + "(" + Integer.toHexString(hashCode()) + ")");
+        show(dialogView);
+    }
 }

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

@@ -1,5 +1,6 @@
 package com.kongzue.dialogx.dialogs;
 
+import android.content.res.Configuration;
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;

+ 19 - 1
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.content.res.Configuration;
 import android.graphics.Color;
 import android.view.View;
 import android.view.ViewGroup;
@@ -93,7 +94,7 @@ public class CustomDialog extends BaseDialog {
         show(activity, dialogView);
     }
     
-    public class DialogImpl implements DialogConvertViewInterface {
+    public class DialogImpl implements DialogConvertViewInterface  {
         
         public DialogXBaseRelativeLayout boxRoot;
         public RelativeLayout boxCustom;
@@ -108,6 +109,7 @@ public class CustomDialog extends BaseDialog {
         
         @Override
         public void init() {
+            boxRoot.setParentDialog(me);
             boxRoot.setOnLifecycleCallBack(new DialogXBaseRelativeLayout.OnLifecycleCallBack() {
                 @Override
                 public void onShow() {
@@ -397,4 +399,20 @@ public class CustomDialog extends BaseDialog {
         this.exitAnimDuration = exitAnimDuration;
         return this;
     }
+    
+    @Override
+    public void onUIModeChange(Configuration newConfig) {
+        if (dialogView != null) {
+            dismiss(dialogView);
+        }
+        if (getDialogImpl().boxCustom!=null){
+            getDialogImpl().boxCustom.removeAllViews();
+        }
+    
+        enterAnimDuration = 0;
+        dialogView = createView(R.layout.layout_dialogx_custom);
+        dialogImpl = new DialogImpl(dialogView);
+        dialogView.setTag(getClass().getSimpleName() + "(" + Integer.toHexString(hashCode()) + ")");
+        show(dialogView);
+    }
 }

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

@@ -3,6 +3,7 @@ package com.kongzue.dialogx.dialogs;
 import android.animation.Animator;
 import android.animation.ObjectAnimator;
 import android.app.Activity;
+import android.content.res.Configuration;
 import android.graphics.Rect;
 import android.view.View;
 import android.view.ViewGroup;
@@ -90,7 +91,7 @@ public class FullScreenDialog extends BaseDialog {
     
     protected DialogImpl dialogImpl;
     
-    public class DialogImpl implements DialogConvertViewInterface {
+    public class DialogImpl implements DialogConvertViewInterface  {
         
         private FullScreenDialogTouchEventInterceptor fullScreenDialogTouchEventInterceptor;
         
@@ -114,6 +115,7 @@ public class FullScreenDialog extends BaseDialog {
         
         @Override
         public void init() {
+            boxRoot.setParentDialog(me);
             boxRoot.setOnLifecycleCallBack(new DialogXBaseRelativeLayout.OnLifecycleCallBack() {
                 @Override
                 public void onShow() {
@@ -367,4 +369,19 @@ public class FullScreenDialog extends BaseDialog {
         this.exitAnimDuration = exitAnimDuration;
         return this;
     }
+    
+    @Override
+    public void onUIModeChange(Configuration newConfig) {
+        if (dialogView != null) {
+            dismiss(dialogView);
+        }
+        if (getDialogImpl().boxCustom!=null){
+            getDialogImpl().boxCustom.removeAllViews();
+        }
+        enterAnimDuration = 0;
+        dialogView = createView(isLightTheme() ? R.layout.layout_dialogx_fullscreen : R.layout.layout_dialogx_fullscreen_dark);
+        dialogImpl = new DialogImpl(dialogView);
+        dialogView.setTag(getClass().getSimpleName() + "(" + Integer.toHexString(hashCode()) + ")");
+        show(dialogView);
+    }
 }

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

@@ -1,11 +1,13 @@
 package com.kongzue.dialogx.dialogs;
 
+import android.content.res.Configuration;
 import android.view.View;
 
 import androidx.annotation.ColorInt;
 import androidx.annotation.ColorRes;
 
 import com.kongzue.dialogx.DialogX;
+import com.kongzue.dialogx.R;
 import com.kongzue.dialogx.interfaces.OnBackPressedListener;
 import com.kongzue.dialogx.interfaces.OnBindView;
 import com.kongzue.dialogx.interfaces.OnInputDialogButtonClickListener;
@@ -155,7 +157,7 @@ public class InputDialog extends MessageDialog {
         return inputDialog;
     }
     
-    public static InputDialog show(int titleResId, int messageResId, int okTextResId, int cancelTextResId, int otherTextResId, int inputTextResId)  {
+    public static InputDialog show(int titleResId, int messageResId, int okTextResId, int cancelTextResId, int otherTextResId, int inputTextResId) {
         InputDialog inputDialog = new InputDialog(titleResId, messageResId, okTextResId, cancelTextResId, otherTextResId, inputTextResId);
         inputDialog.show();
         return inputDialog;
@@ -326,6 +328,9 @@ public class InputDialog extends MessageDialog {
     }
     
     public String getInputText() {
+        if (getDialogImpl() != null && getDialogImpl().txtInput != null) {
+            return getDialogImpl().txtInput.getText().toString();
+        }
         return inputText;
     }
     
@@ -517,4 +522,24 @@ public class InputDialog extends MessageDialog {
         this.exitAnimDuration = exitAnimDuration;
         return this;
     }
+    
+    @Override
+    public void onUIModeChange(Configuration newConfig) {
+        if (dialogView != null) {
+            dismiss(dialogView);
+        }
+        if (getDialogImpl().boxCustom!=null){
+            getDialogImpl().boxCustom.removeAllViews();
+        }
+        int layoutId = style.layout(isLightTheme());
+        layoutId = layoutId == 0 ? (isLightTheme() ? R.layout.layout_dialogx_material : R.layout.layout_dialogx_material_dark) : layoutId;
+        
+        String inputText = getInputText();
+        enterAnimDuration = 0;
+        dialogView = createView(layoutId);
+        dialogImpl = new DialogImpl(dialogView);
+        dialogView.setTag(getClass().getSimpleName() + "(" + Integer.toHexString(hashCode()) + ")");
+        show(dialogView);
+        setInputText(inputText);
+    }
 }

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

@@ -3,6 +3,7 @@ package com.kongzue.dialogx.dialogs;
 import android.animation.Animator;
 import android.app.Activity;
 import android.content.Context;
+import android.content.res.Configuration;
 import android.text.InputFilter;
 import android.text.InputType;
 import android.view.View;
@@ -60,7 +61,7 @@ public class MessageDialog extends BaseDialog {
         super();
     }
     
-    private View dialogView;
+    protected View dialogView;
     
     protected CharSequence title;
     protected CharSequence message;
@@ -268,6 +269,7 @@ public class MessageDialog extends BaseDialog {
             btnSelectPositive.getPaint().setFakeBoldText(true);
             btnSelectOther.getPaint().setFakeBoldText(true);
             
+            boxRoot.setParentDialog(me);
             boxRoot.setOnLifecycleCallBack(new DialogXBaseRelativeLayout.OnLifecycleCallBack() {
                 @Override
                 public void onShow() {
@@ -320,7 +322,7 @@ public class MessageDialog extends BaseDialog {
                                 }
                             }
                         }, 300);
-                    }else{
+                    } else {
                         if (inputInfo != null && inputInfo.isSelectAllText()) {
                             txtInput.clearFocus();
                             txtInput.requestFocus();
@@ -984,4 +986,22 @@ public class MessageDialog extends BaseDialog {
         this.exitAnimDuration = exitAnimDuration;
         return this;
     }
+    
+    @Override
+    public void onUIModeChange(Configuration newConfig) {
+        if (dialogView != null) {
+            dismiss(dialogView);
+        }
+        if (getDialogImpl().boxCustom!=null){
+            getDialogImpl().boxCustom.removeAllViews();
+        }
+        int layoutId = style.layout(isLightTheme());
+        layoutId = layoutId == 0 ? (isLightTheme() ? R.layout.layout_dialogx_material : R.layout.layout_dialogx_material_dark) : layoutId;
+        
+        enterAnimDuration = 0;
+        dialogView = createView(layoutId);
+        dialogImpl = new DialogImpl(dialogView);
+        dialogView.setTag(getClass().getSimpleName() + "(" + Integer.toHexString(hashCode()) + ")");
+        show(dialogView);
+    }
 }

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

@@ -2,6 +2,7 @@ package com.kongzue.dialogx.dialogs;
 
 import android.animation.Animator;
 import android.app.Activity;
+import android.content.res.Configuration;
 import android.graphics.Rect;
 import android.view.View;
 import android.view.ViewGroup;
@@ -325,7 +326,7 @@ public class PopTip extends BaseDialog {
         return this;
     }
     
-    public class DialogImpl implements DialogConvertViewInterface {
+    public class DialogImpl implements DialogConvertViewInterface  {
         
         public DialogXBaseRelativeLayout boxRoot;
         public LinearLayout boxBody;
@@ -359,7 +360,8 @@ public class PopTip extends BaseDialog {
             if (autoDismissTimer == null) {
                 showShort();
             }
-            
+    
+            boxRoot.setParentDialog(me);
             boxRoot.setOnLifecycleCallBack(new DialogXBaseRelativeLayout.OnLifecycleCallBack() {
                 @Override
                 public void onShow() {
@@ -731,4 +733,35 @@ public class PopTip extends BaseDialog {
         this.exitAnimDuration = exitAnimDuration;
         return this;
     }
+    
+    @Override
+    public void onUIModeChange(Configuration newConfig) {
+        if (dialogView != null) {
+            dismiss(dialogView);
+        }
+        if (getDialogImpl().boxCustom!=null){
+            getDialogImpl().boxCustom.removeAllViews();
+        }
+        if (DialogX.onlyOnePopTip) {
+            if (oldInstance != null && oldInstance.get() != null) {
+                oldInstance.get().dismiss();
+            }
+        }
+        oldInstance = new WeakReference<>(this);
+        int layoutResId = isLightTheme() ? R.layout.layout_dialogx_poptip_material : R.layout.layout_dialogx_poptip_material_dark;
+        if (style.popTipSettings() != null) {
+            if (style.popTipSettings().layout(isLightTheme()) != 0) {
+                layoutResId = style.popTipSettings().layout(isLightTheme());
+            }
+            align = style.popTipSettings().align();
+            if (align == null) align = DialogXStyle.PopTipSettings.ALIGN.BOTTOM;
+            enterAnimResId = style.popTipSettings().enterAnimResId(isLightTheme()) != 0 ? style.popTipSettings().enterAnimResId(isLightTheme()) : R.anim.anim_dialogx_default_enter;
+            exitAnimResId = style.popTipSettings().exitAnimResId(isLightTheme()) != 0 ? style.popTipSettings().exitAnimResId(isLightTheme()) : R.anim.anim_dialogx_default_exit;
+        }
+        enterAnimDuration = 0;
+        dialogView = createView(layoutResId);
+        dialogImpl = new DialogImpl(dialogView);
+        dialogView.setTag(getClass().getSimpleName() + "(" + Integer.toHexString(hashCode()) + ")");
+        show(dialogView);
+    }
 }

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

@@ -2,6 +2,7 @@ package com.kongzue.dialogx.dialogs;
 
 import android.animation.Animator;
 import android.app.Activity;
+import android.content.res.Configuration;
 import android.graphics.Color;
 import android.view.View;
 import android.view.ViewGroup;
@@ -181,7 +182,7 @@ public class WaitDialog extends BaseDialog {
     
     protected DialogImpl dialogImpl;
     
-    public class DialogImpl implements DialogConvertViewInterface {
+    public class DialogImpl implements DialogConvertViewInterface  {
         public DialogXBaseRelativeLayout boxRoot;
         public MaxRelativeLayout bkg;
         public BlurView blurView;
@@ -213,7 +214,8 @@ public class WaitDialog extends BaseDialog {
             
             blurView.setRadiusPx(dip2px(15));
             boxRoot.setClickable(true);
-            
+    
+            boxRoot.setParentDialog(me.get());
             boxRoot.setOnLifecycleCallBack(new DialogXBaseRelativeLayout.OnLifecycleCallBack() {
                 @Override
                 public void onShow() {
@@ -575,4 +577,9 @@ public class WaitDialog extends BaseDialog {
         this.exitAnimDuration = exitAnimDuration;
         return this;
     }
+    
+    @Override
+    public void onUIModeChange(Configuration newConfig) {
+        refreshUI();
+    }
 }

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

@@ -3,6 +3,7 @@ package com.kongzue.dialogx.interfaces;
 import android.app.Activity;
 import android.content.Context;
 import android.content.res.ColorStateList;
+import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.graphics.Color;
 import android.graphics.Typeface;
@@ -16,6 +17,7 @@ import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import androidx.annotation.ColorRes;
+import androidx.appcompat.app.AppCompatDelegate;
 
 import com.kongzue.dialogx.DialogX;
 import com.kongzue.dialogx.impl.ActivityLifecycleImpl;
@@ -32,7 +34,7 @@ import static com.kongzue.dialogx.DialogX.DEBUGMODE;
  * @mail: myzcxhh@live.cn
  * @createTime: 2020/9/22 14:10
  */
-public class BaseDialog {
+public abstract class BaseDialog {
     
     private static WeakReference<FrameLayout> rootFrameLayout;
     private static WeakReference<Activity> contextWeakReference;
@@ -59,6 +61,8 @@ public class BaseDialog {
         if (DEBUGMODE) Log.e(">>>", o.toString());
     }
     
+    public abstract void onUIModeChange(Configuration newConfig);
+    
     protected static void show(final View view) {
         if (rootFrameLayout == null || view == null || rootFrameLayout.get() == null) return;
         log(view.getTag() + ".show");
@@ -207,6 +211,9 @@ public class BaseDialog {
     }
     
     public boolean isLightTheme() {
+        if (theme == DialogX.THEME.AUTO) {
+            return (getContext().getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO;
+        }
         return theme == DialogX.THEME.LIGHT;
     }
     

+ 21 - 1
DialogX/src/main/java/com/kongzue/dialogx/util/views/DialogXBaseRelativeLayout.java

@@ -2,6 +2,7 @@ package com.kongzue.dialogx.util.views;
 
 import android.app.Activity;
 import android.content.Context;
+import android.content.res.Configuration;
 import android.graphics.Rect;
 import android.os.Build;
 import android.util.AttributeSet;
@@ -35,6 +36,7 @@ import static com.kongzue.dialogx.DialogX.log;
 public class DialogXBaseRelativeLayout extends RelativeLayout {
     
     private OnSafeInsetsChangeListener onSafeInsetsChangeListener;
+    private BaseDialog parentDialog;
     private boolean autoUnsafePlacePadding = true;
     
     private OnLifecycleCallBack onLifecycleCallBack;
@@ -63,7 +65,11 @@ public class DialogXBaseRelativeLayout extends RelativeLayout {
     private boolean isInited = false;
     
     private void init() {
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+            setForceDarkAllowed(false);
+        }
         if (!isInited) {
+            setFocusable(true);
             setFocusableInTouchMode(true);
             requestFocus();
         }
@@ -177,7 +183,6 @@ public class DialogXBaseRelativeLayout extends RelativeLayout {
     protected Rect unsafePlace = new Rect();
     
     private void paddingView(int left, int top, int right, int bottom) {
-        log("paddingView: left:" + left + " top:" + top + " right:" + right + " bottom:" + bottom);
         unsafePlace = new Rect(left, top, right, bottom);
         if (onSafeInsetsChangeListener != null) onSafeInsetsChangeListener.onChange(unsafePlace);
         MaxRelativeLayout bkgView = findViewById(R.id.bkg);
@@ -214,4 +219,19 @@ public class DialogXBaseRelativeLayout extends RelativeLayout {
         this.autoUnsafePlacePadding = autoUnsafePlacePadding;
         return this;
     }
+    
+    public BaseDialog getParentDialog() {
+        return parentDialog;
+    }
+    
+    public DialogXBaseRelativeLayout setParentDialog(BaseDialog parentDialog) {
+        this.parentDialog = parentDialog;
+        return this;
+    }
+    
+    @Override
+    protected void onConfigurationChanged(Configuration newConfig) {
+        super.onConfigurationChanged(newConfig);
+        getParentDialog().onUIModeChange(newConfig);
+    }
 }

+ 12 - 12
DialogX/src/main/res/layout/layout_dialogx_bottom_material_dark.xml

@@ -17,6 +17,7 @@
             android:layout_height="wrap_content"
             android:layout_alignParentBottom="true"
             android:background="@drawable/rect_dialogx_material_bottom_bkg_night"
+            android:clickable="true"
             android:focusableInTouchMode="true">
 
             <ImageView
@@ -31,9 +32,8 @@
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:paddingTop="15dp"
-                android:clickable="true"
-                android:orientation="vertical">
+                android:orientation="vertical"
+                android:paddingTop="15dp">
 
                 <TextView
                     android:id="@+id/txt_dialog_title"
@@ -47,7 +47,7 @@
                     android:textColor="@color/white"
                     android:textSize="21dp" />
 
-                <ScrollView
+                <com.kongzue.dialogx.util.views.BottomDialogScrollView
                     android:id="@+id/scrollView"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
@@ -67,8 +67,8 @@
                             android:layout_width="match_parent"
                             android:layout_height="wrap_content"
                             android:layout_marginHorizontal="20dp"
-                            android:paddingBottom="5dp"
                             android:layout_marginBottom="5dp"
+                            android:paddingBottom="5dp"
                             android:text="This is content text."
                             android:textColor="@color/white60"
                             android:textSize="16dp" />
@@ -76,16 +76,16 @@
                         <RelativeLayout
                             android:id="@+id/box_custom"
                             android:layout_width="match_parent"
-                            android:layout_height="wrap_content"/>
+                            android:layout_height="wrap_content" />
 
                         <RelativeLayout
                             android:id="@+id/box_list"
                             android:layout_width="match_parent"
-                            android:layout_height="wrap_content"/>
+                            android:layout_height="wrap_content" />
 
                     </LinearLayout>
 
-                </ScrollView>
+                </com.kongzue.dialogx.util.views.BottomDialogScrollView>
 
                 <LinearLayout
                     android:id="@+id/box_button"
@@ -99,10 +99,10 @@
                     <TextView
                         android:layout_width="wrap_content"
                         android:layout_height="36dp"
+                        android:layout_marginVertical="10dp"
                         android:background="@drawable/button_dialogx_material_night"
                         android:clickable="true"
                         android:gravity="center"
-                        android:layout_marginVertical="10dp"
                         android:paddingHorizontal="15dp"
                         android:text="Other"
                         android:textColor="@color/colorAccent"
@@ -118,12 +118,12 @@
                     <TextView
                         android:layout_width="wrap_content"
                         android:layout_height="36dp"
+                        android:layout_marginVertical="10dp"
                         android:background="@drawable/button_dialogx_material_night"
                         android:clickable="true"
                         android:gravity="center"
-                        android:tag="cancel"
-                        android:layout_marginVertical="10dp"
                         android:paddingHorizontal="15dp"
+                        android:tag="cancel"
                         android:text="Cancel"
                         android:textColor="@color/colorAccent"
                         android:textSize="15dp" />
@@ -132,10 +132,10 @@
                         android:id="@+id/btn_selectPositive"
                         android:layout_width="wrap_content"
                         android:layout_height="36dp"
+                        android:layout_marginVertical="10dp"
                         android:background="@drawable/button_dialogx_material_night"
                         android:clickable="true"
                         android:gravity="center"
-                        android:layout_marginVertical="10dp"
                         android:paddingHorizontal="15dp"
                         android:text="OK"
                         android:textColor="@color/colorAccent"

+ 11 - 0
DialogX/src/main/res/values-v29/styles.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
+        <!-- Customize your theme here. -->
+        <item name="colorPrimary">@color/colorAccent</item>
+        <item name="colorPrimaryDark">@color/colorAccent</item>
+        <item name="colorAccent">@color/colorAccent</item>
+        <item name="android:forceDarkAllowed">true</item>
+    </style>
+</resources>

+ 6 - 64
DialogXIOSStyle/build.gradle

@@ -1,13 +1,11 @@
 apply plugin: 'com.android.library'
-apply plugin: 'com.github.dcendents.android-maven'
-apply plugin: 'com.jfrog.bintray'
-
-def siteUrl = 'https://github.com/kongzue/DialogX' //项目在github主页地址
-def gitUrl = 'https://github.com/kongzue/DialogX.git'   //Git仓库的地址
-
-group = "com.kongzue.dialogx.style.ios"
-version = BUILD_VERSION
 
+ext {
+    PUBLISH_GROUP_ID = "com.kongzue.dialogx"
+    PUBLISH_ARTIFACT_ID = 'DialogXIOSStyle'
+    PUBLISH_VERSION = BUILD_VERSION
+}
+apply from: "${rootProject.projectDir}/publish-mavencentral.gradle"
 android {
     compileSdkVersion 30
 
@@ -26,62 +24,6 @@ android {
     }
 }
 
-install {
-    repositories.mavenInstaller {
-        // This generates POM.xml with proper parameters
-        pom {
-            project {
-                packaging 'aar'
-                name 'dialogXiOSStyle'
-                url siteUrl
-                licenses {
-                    license {
-                        name 'The Apache Software License, Version 2.0'
-                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
-                    }
-                }
-                developers {
-                    developer {
-                        id 'myzchh'//设置自己ID
-                        name 'myzchh'//设置自己名字
-                        email 'myzcxhh@live.cn'//设置自己邮箱
-                    }
-                }
-                scm {
-                    connection gitUrl
-                    developerConnection gitUrl
-                    url siteUrl
-                }
-            }
-        }
-    }
-}
-task sourcesJar(type: Jar) {
-    from android.sourceSets.main.java.srcDirs
-    classifier = 'sources'
-}
-
-artifacts {
-    archives sourcesJar
-}
-
-Properties properties = new Properties()
-properties.load(project.rootProject.file('local.properties').newDataInputStream())
-bintray {
-    user = properties.getProperty("bintray.user")
-    key = properties.getProperty("bintray.apikey")
-    configurations = ['archives']
-    pkg {
-        repo = "maven"
-        name = "dialogXiOSStyle" //项目在JCenter的名字
-        websiteUrl = siteUrl
-        vcsUrl = gitUrl
-        licenses = ["Apache-2.0"]
-        publish = true
-    }
-}
 dependencies {
     implementation fileTree(dir: "libs", include: ["*.jar"])
-    implementation project(path: ':DialogX')
-    implementation project(path: ':DialogXInterface')
 }

+ 0 - 9
DialogXInterface/build.gradle

@@ -1,9 +0,0 @@
-apply plugin: 'java-library'
-
-dependencies {
-    implementation fileTree(dir: 'libs', include: ['*.jar'])
-    implementation files('libs\\android.jar')
-}
-
-sourceCompatibility = "1.7"
-targetCompatibility = "1.7"

BIN
DialogXInterface/libs/android.jar


+ 0 - 35
DialogXInterface/src/main/java/com/kongzue/dialogx/interfaces/ProgressViewInterface.java

@@ -1,35 +0,0 @@
-package com.kongzue.dialogx.interfaces;
-
-/**
- * @author: Kongzue
- * @github: https://github.com/kongzue/
- * @homepage: http://kongzue.com/
- * @mail: myzcxhh@live.cn
- * @createTime: 2020/11/3 20:39
- */
-public interface ProgressViewInterface {
-    
-    //停止加载动画
-    void noLoading();
-    
-    //切换至完成状态
-    void success();
-    
-    //切换至警告状态
-    void warning();
-    
-    //切换至错误状态
-    void error();
-    
-    //切换至进度(取值 0f-1f)
-    void progress(float progress);
-    
-    //切换至加载状态
-    void loading();
-    
-    //不同状态切换时,衔接动画完成后执行
-    ProgressViewInterface whenShowTick(Runnable runnable);
-    
-    //设置颜色
-    ProgressViewInterface setColor(int color);
-}

+ 6 - 65
DialogXKongzueStyle/build.gradle

@@ -1,13 +1,10 @@
 apply plugin: 'com.android.library'
-apply plugin: 'com.github.dcendents.android-maven'
-apply plugin: 'com.jfrog.bintray'
-
-def siteUrl = 'https://github.com/kongzue/DialogX' //项目在github主页地址
-def gitUrl = 'https://github.com/kongzue/DialogX.git'   //Git仓库的地址
-
-group = "com.kongzue.dialogx.style.kongzue"
-version = BUILD_VERSION
-
+ext {
+    PUBLISH_GROUP_ID = "com.kongzue.dialogx"
+    PUBLISH_ARTIFACT_ID = 'DialogXKongzueStyle'
+    PUBLISH_VERSION = BUILD_VERSION
+}
+apply from: "${rootProject.projectDir}/publish-mavencentral.gradle"
 android {
     compileSdkVersion 30
 
@@ -26,62 +23,6 @@ android {
     }
 }
 
-install {
-    repositories.mavenInstaller {
-        // This generates POM.xml with proper parameters
-        pom {
-            project {
-                packaging 'aar'
-                name 'dialogXKongzueStyle'
-                url siteUrl
-                licenses {
-                    license {
-                        name 'The Apache Software License, Version 2.0'
-                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
-                    }
-                }
-                developers {
-                    developer {
-                        id 'myzchh'//设置自己ID
-                        name 'myzchh'//设置自己名字
-                        email 'myzcxhh@live.cn'//设置自己邮箱
-                    }
-                }
-                scm {
-                    connection gitUrl
-                    developerConnection gitUrl
-                    url siteUrl
-                }
-            }
-        }
-    }
-}
-task sourcesJar(type: Jar) {
-    from android.sourceSets.main.java.srcDirs
-    classifier = 'sources'
-}
-
-artifacts {
-    archives sourcesJar
-}
-
-Properties properties = new Properties()
-properties.load(project.rootProject.file('local.properties').newDataInputStream())
-bintray {
-    user = properties.getProperty("bintray.user")
-    key = properties.getProperty("bintray.apikey")
-    configurations = ['archives']
-    pkg {
-        repo = "maven"
-        name = "dialogXKongzueStyle" //项目在JCenter的名字
-        websiteUrl = siteUrl
-        vcsUrl = gitUrl
-        licenses = ["Apache-2.0"]
-        publish = true
-    }
-}
 dependencies {
     implementation fileTree(dir: "libs", include: ["*.jar"])
-    implementation project(path: ':DialogX')
-    implementation project(path: ':DialogXInterface')
 }

+ 6 - 65
DialogXMIUIStyle/build.gradle

@@ -1,13 +1,10 @@
 apply plugin: 'com.android.library'
-apply plugin: 'com.github.dcendents.android-maven'
-apply plugin: 'com.jfrog.bintray'
-
-def siteUrl = 'https://github.com/kongzue/DialogX' //项目在github主页地址
-def gitUrl = 'https://github.com/kongzue/DialogX.git'   //Git仓库的地址
-
-group = "com.kongzue.dialogx.style.miui"
-version = BUILD_VERSION
-
+ext {
+    PUBLISH_GROUP_ID = "com.kongzue.dialogx"
+    PUBLISH_ARTIFACT_ID = 'DialogXMIUIStyle'
+    PUBLISH_VERSION = BUILD_VERSION
+}
+apply from: "${rootProject.projectDir}/publish-mavencentral.gradle"
 android {
     compileSdkVersion 30
 
@@ -27,62 +24,6 @@ android {
     }
 }
 
-install {
-    repositories.mavenInstaller {
-        // This generates POM.xml with proper parameters
-        pom {
-            project {
-                packaging 'aar'
-                name 'dialogXMIUIStyle'
-                url siteUrl
-                licenses {
-                    license {
-                        name 'The Apache Software License, Version 2.0'
-                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
-                    }
-                }
-                developers {
-                    developer {
-                        id 'myzchh'//设置自己ID
-                        name 'myzchh'//设置自己名字
-                        email 'myzcxhh@live.cn'//设置自己邮箱
-                    }
-                }
-                scm {
-                    connection gitUrl
-                    developerConnection gitUrl
-                    url siteUrl
-                }
-            }
-        }
-    }
-}
-task sourcesJar(type: Jar) {
-    from android.sourceSets.main.java.srcDirs
-    classifier = 'sources'
-}
-
-artifacts {
-    archives sourcesJar
-}
-
-Properties properties = new Properties()
-properties.load(project.rootProject.file('local.properties').newDataInputStream())
-bintray {
-    user = properties.getProperty("bintray.user")
-    key = properties.getProperty("bintray.apikey")
-    configurations = ['archives']
-    pkg {
-        repo = "maven"
-        name = "dialogXMIUIStyle" //项目在JCenter的名字
-        websiteUrl = siteUrl
-        vcsUrl = gitUrl
-        licenses = ["Apache-2.0"]
-        publish = true
-    }
-}
 dependencies {
     implementation fileTree(dir: "libs", include: ["*.jar"])
-    implementation project(path: ':DialogX')
-    implementation project(path: ':DialogXInterface')
 }

+ 0 - 0
DialogXInterface/.gitignore → DialogXStyleInterface/.gitignore


+ 36 - 0
DialogXStyleInterface/build.gradle

@@ -0,0 +1,36 @@
+apply plugin: 'com.android.library'
+
+ext {
+    PUBLISH_GROUP_ID = "com.kongzue.dialogx"
+    PUBLISH_ARTIFACT_ID = 'DialogXStyleInterface'
+    PUBLISH_VERSION = "1.0.0"
+}
+apply from: "${rootProject.projectDir}/publish-mavencentral.gradle"
+
+android {
+    compileSdkVersion 30
+    buildToolsVersion "30.0.3"
+
+    defaultConfig {
+        minSdkVersion 21
+        targetSdkVersion 30
+        versionCode 1
+        versionName "1.0.0"
+        consumerProguardFiles "consumer-rules.pro"
+    }
+
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+        }
+    }
+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_1_8
+        targetCompatibility JavaVersion.VERSION_1_8
+    }
+}
+
+dependencies {
+    implementation 'androidx.appcompat:appcompat:1.2.0'
+}

+ 0 - 0
DialogXStyleInterface/consumer-rules.pro


+ 21 - 0
DialogXStyleInterface/proguard-rules.pro

@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile

+ 5 - 0
DialogXStyleInterface/src/main/AndroidManifest.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.kongzue.dialogx.interfaces">
+
+</manifest>

+ 0 - 0
DialogXInterface/src/main/java/com/kongzue/dialogx/interfaces/DialogXStyle.java → DialogXStyleInterface/src/main/java/com/kongzue/dialogx/interfaces/DialogXStyle.java


+ 35 - 0
DialogXStyleInterface/src/main/java/com/kongzue/dialogx/interfaces/ProgressViewInterface.java

@@ -0,0 +1,35 @@
+package com.kongzue.dialogx.interfaces;
+
+/**
+ * author: Kongzue
+ * github: https://github.com/kongzue/
+ * homepage: http://kongzue.com/
+ * mail: myzcxhh@live.cn
+ * createTime: 2020/11/3 20:39
+ */
+public interface ProgressViewInterface {
+    
+    //停止加载动画
+    void noLoading();
+    
+    //切换至完成状态
+    void success();
+    
+    //切换至警告状态
+    void warning();
+    
+    //切换至错误状态
+    void error();
+    
+    //切换至进度(取值 0f-1f)
+    void progress(float progress);
+    
+    //切换至加载状态
+    void loading();
+    
+    //不同状态切换时,衔接动画完成后执行
+    ProgressViewInterface whenShowTick(Runnable runnable);
+    
+    //设置颜色
+    ProgressViewInterface setColor(int color);
+}

+ 2 - 1
app/src/main/AndroidManifest.xml

@@ -13,7 +13,8 @@
         android:supportsRtl="true"
         android:theme="@style/AppTheme">
         <activity android:name=".MainActivity"
-            android:configChanges="orientation|keyboardHidden|screenSize">
+            android:configChanges="orientation|keyboardHidden|screenSize|uiMode"
+            >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 

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

@@ -3,6 +3,7 @@ package com.kongzue.dialogxdemo;
 import android.content.ActivityNotFoundException;
 import android.content.Context;
 import android.content.Intent;
+import android.content.res.Configuration;
 import android.graphics.Color;
 import android.net.Uri;
 import android.os.Handler;
@@ -19,6 +20,8 @@ import android.widget.RadioGroup;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
+import androidx.annotation.NonNull;
+
 import com.kongzue.baseframework.BaseActivity;
 import com.kongzue.baseframework.interfaces.DarkNavigationBarTheme;
 import com.kongzue.baseframework.interfaces.DarkStatusBarTheme;
@@ -72,6 +75,7 @@ public class MainActivity extends BaseActivity {
     private RadioButton rdoKongzue;
     private RadioButton rdoMiui;
     private RadioGroup grpTheme;
+    private RadioButton rdoAuto;
     private RadioButton rdoLight;
     private RadioButton rdoDark;
     private TextView btnMessageDialog;
@@ -111,6 +115,7 @@ public class MainActivity extends BaseActivity {
         rdoKongzue = findViewById(R.id.rdo_kongzue);
         rdoMiui = findViewById(R.id.rdo_miui);
         grpTheme = findViewById(R.id.grp_theme);
+        rdoAuto = findViewById(R.id.rdo_auto);
         rdoLight = findViewById(R.id.rdo_light);
         rdoDark = findViewById(R.id.rdo_dark);
         btnMessageDialog = findViewById(R.id.btn_messageDialog);
@@ -139,7 +144,9 @@ public class MainActivity extends BaseActivity {
     
     @Override
     public void initDatas(JumpParameter parameter) {
+        refreshUIMode();
         DialogX.globalStyle = MaterialStyle.style();
+        DialogX.globalTheme = DialogX.THEME.AUTO;
         
         boolean showBreak = parameter.getBoolean("showBreak");
         if (showBreak) {
@@ -197,6 +204,9 @@ public class MainActivity extends BaseActivity {
             @Override
             public void onCheckedChanged(RadioGroup group, int checkedId) {
                 switch (checkedId) {
+                    case R.id.rdo_auto:
+                        DialogX.globalTheme = DialogX.THEME.AUTO;
+                        break;
                     case R.id.rdo_light:
                         DialogX.globalTheme = DialogX.THEME.LIGHT;
                         break;
@@ -259,7 +269,6 @@ public class MainActivity extends BaseActivity {
             public void onClick(View view) {
                 new InputDialog("标题", "正文内容", "确定", "取消", "正在输入的文字")
                         .setInputText("Hello World")
-                        .setInputInfo(new InputInfo().setSelectAllText(true))
                         .setCancelable(false)
                         .setOkButton(new OnInputDialogButtonClickListener<InputDialog>() {
                             @Override
@@ -748,4 +757,20 @@ public class MainActivity extends BaseActivity {
         imm.showSoftInput(editText, InputMethodManager.RESULT_UNCHANGED_SHOWN);
     }
     
+    @Override
+    public void onConfigurationChanged(@NonNull Configuration newConfig) {
+        super.onConfigurationChanged(newConfig);
+        refreshUIMode();
+    }
+    
+    /**
+     * 刷新亮暗色模式界面变化
+     */
+    private void refreshUIMode() {
+        if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO) {
+            setDarkStatusBarTheme(true);
+        } else {
+            setDarkStatusBarTheme(false);
+        }
+    }
 }

+ 14 - 5
app/src/main/res/layout/activity_main.xml

@@ -128,9 +128,9 @@
                     <RadioButton
                         android:id="@+id/rdo_material"
                         android:layout_width="wrap_content"
+                        android:layout_weight="1"
                         android:layout_height="wrap_content"
                         android:checked="true"
-                        android:padding="10dp"
                         android:text="Material"
                         android:textColor="#7b000000"
                         android:textSize="12dp" />
@@ -139,7 +139,7 @@
                         android:id="@+id/rdo_ios"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
-                        android:padding="10dp"
+                        android:layout_weight="1"
                         android:text="iOS"
                         android:textColor="#7b000000"
                         android:textSize="12dp" />
@@ -148,7 +148,7 @@
                         android:id="@+id/rdo_kongzue"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
-                        android:padding="10dp"
+                        android:layout_weight="1"
                         android:text="Kongzue"
                         android:textColor="#7b000000"
                         android:textSize="12dp" />
@@ -157,7 +157,7 @@
                         android:id="@+id/rdo_miui"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
-                        android:padding="10dp"
+                        android:layout_weight="1"
                         android:text="MIUI"
                         android:textColor="#7b000000"
                         android:textSize="12dp" />
@@ -181,11 +181,20 @@
                     android:orientation="horizontal">
 
                     <RadioButton
-                        android:id="@+id/rdo_light"
+                        android:id="@+id/rdo_auto"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:checked="true"
                         android:padding="10dp"
+                        android:text="自动"
+                        android:textColor="#7b000000"
+                        android:textSize="12dp" />
+
+                    <RadioButton
+                        android:id="@+id/rdo_light"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:padding="10dp"
                         android:text="亮色"
                         android:textColor="#7b000000"
                         android:textSize="12dp" />

+ 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.30
+BUILD_VERSION=0.0.31.alpha2
 BUILD_VERSION_INT=30

+ 102 - 0
publish-mavencentral.gradle

@@ -0,0 +1,102 @@
+apply plugin: 'maven-publish'
+apply plugin: 'signing'
+
+task androidSourcesJar(type: Jar) {
+    classifier = 'sources'
+    from android.sourceSets.main.java.source
+}
+
+ext["signing.keyId"] = ''
+ext["signing.password"] = ''
+ext["signing.secretKeyRingFile"] = ''
+ext["ossrhUsername"] = ''
+ext["ossrhPassword"] = ''
+
+File secretPropsFile = project.rootProject.file('local.properties')
+if (secretPropsFile.exists()) {
+    println "Found secret props file, loading props"
+    Properties p = new Properties()
+    p.load(new FileInputStream(secretPropsFile))
+    p.each { name, value ->
+        ext[name] = value
+    }
+} else {
+    println "No props file, loading env vars"
+}
+publishing {
+    publications {
+        release(MavenPublication) {
+            // The coordinates of the library, being set from variables that
+            // we'll set up in a moment
+            groupId PUBLISH_GROUP_ID
+            artifactId PUBLISH_ARTIFACT_ID
+            version PUBLISH_VERSION
+
+            // Two artifacts, the `aar` and the sources
+            artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
+            artifact androidSourcesJar
+
+            // Self-explanatory metadata for the most part
+            pom {
+                name = PUBLISH_ARTIFACT_ID
+                description = 'Kongzue DialogX Open Source Project'
+                // If your project has a dedicated site, use its URL here
+                url = 'https://github.com/kongzue/DialogX'
+                licenses {
+                    license {
+                        name = 'The Apache License, Version 2.0'
+                        url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+                    }
+                }
+                developers {
+                    developer {
+                        id = 'kongzue'
+                        name = 'kongzue'
+                        email = 'myzcxhh@live.cn'
+                    }
+                }
+                // Version control info, if you're using GitHub, follow the format as seen here
+                scm {
+                    connection = 'scm:git:github.com/kongzue/DialogX.git'
+                    developerConnection = 'scm:git:ssh://github.com/kongzue/DialogX.git'
+                    url = 'https://github.com/kongzue/DialogX/tree/master'
+                }
+                // A slightly hacky fix so that your POM will include any transitive dependencies
+                // that your library builds upon
+                withXml {
+                    def dependenciesNode = asNode().appendNode('dependencies')
+
+                    project.configurations.implementation.allDependencies.each {
+                        def dependencyNode = dependenciesNode.appendNode('dependency')
+                        dependencyNode.appendNode('groupId', it.group)
+                        dependencyNode.appendNode('artifactId', it.name)
+                        dependencyNode.appendNode('version', it.version)
+                    }
+                }
+            }
+        }
+    }
+    repositories {
+        // The repository to publish to, Sonatype/MavenCentral
+        maven {
+            // This is an arbitrary name, you may also use "mavencentral" or
+            // any other name that's descriptive for you
+            name = "DialogX"
+
+            def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
+            def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
+            // You only need this if you want to publish snapshots, otherwise just set the URL
+            // to the release repo directly
+            url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
+
+            // The username and password we've fetched earlier
+            credentials {
+                username ossrhUsername
+                password ossrhPassword
+            }
+        }
+    }
+}
+signing {
+    sign publishing.publications
+}

+ 1 - 0
settings.gradle

@@ -1,3 +1,4 @@
+include ':DialogXStyleInterface'
 include ':DialogXInterface'
 include ':DialogXMIUIStyle'
 include ':DialogXKongzueStyle'