Browse Source

update README.md

kongzue 4 years ago
parent
commit
e18bd1a5ed

+ 5 - 0
.idea/jarRepositories.xml

@@ -36,5 +36,10 @@
       <option name="name" value="MavenLocal" />
       <option name="url" value="file:/$USER_HOME$/.m2/repository/" />
     </remote-repository>
+    <remote-repository>
+      <option name="id" value="maven2" />
+      <option name="name" value="maven2" />
+      <option name="url" value="https://jitpack.io" />
+    </remote-repository>
   </component>
 </project>

+ 24 - 23
DialogX/src/main/java/com/kongzue/dialogx/dialogs/CustomDialog.java

@@ -96,7 +96,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;
@@ -116,10 +116,8 @@ public class CustomDialog extends BaseDialog {
                 @Override
                 public void onShow() {
                     isShow = true;
-                    boxRoot.setAlpha(0f);
-                    
                     getDialogLifecycleCallback().onShow(me);
-                    
+                    boxCustom.setVisibility(View.GONE);
                     if (onBindView != null) onBindView.onBind(me, onBindView.getCustomView());
                 }
                 
@@ -176,12 +174,6 @@ public class CustomDialog extends BaseDialog {
             boxRoot.post(new Runnable() {
                 @Override
                 public void run() {
-                    boxRoot.animate()
-                            .setDuration(enterAnimDuration == -1 ? 300 : enterAnimDuration)
-                            .alpha(1f)
-                            .setInterpolator(new DecelerateInterpolator())
-                            .setListener(null);
-                    
                     if (enterAnimResId == R.anim.anim_dialogx_default_enter && exitAnimResId == R.anim.anim_dialogx_default_exit) {
                         switch (align) {
                             case TOP:
@@ -209,6 +201,10 @@ public class CustomDialog extends BaseDialog {
                     } else {
                         enterAnim = AnimationUtils.loadAnimation(getContext(), enterAnimResId);
                     }
+                    if (enterAnimDuration != -1) {
+                        enterAnim.setDuration(enterAnimDuration);
+                    }
+                    boxCustom.setVisibility(View.VISIBLE);
                     boxCustom.startAnimation(enterAnim);
                 }
             });
@@ -251,17 +247,22 @@ public class CustomDialog extends BaseDialog {
                 exitAnim.setDuration(exitAnimDuration);
             }
             boxCustom.startAnimation(exitAnim);
-            
-            boxRoot.animate()
-                    .alpha(0f)
-                    .setInterpolator(new AccelerateInterpolator())
-                    .setDuration(exitAnim.getDuration())
-                    .setListener(new AnimatorListenerEndCallBack() {
-                        @Override
-                        public void onAnimationEnd(Animator animation) {
-                            dismiss(dialogView);
-                        }
-                    });
+            exitAnim.setAnimationListener(new Animation.AnimationListener() {
+                @Override
+                public void onAnimationStart(Animation animation) {
+                
+                }
+                
+                @Override
+                public void onAnimationEnd(Animation animation) {
+                    dismiss(dialogView);
+                }
+                
+                @Override
+                public void onAnimationRepeat(Animation animation) {
+                
+                }
+            });
         }
     }
     
@@ -425,10 +426,10 @@ public class CustomDialog extends BaseDialog {
         if (dialogView != null) {
             dismiss(dialogView);
         }
-        if (getDialogImpl().boxCustom!=null){
+        if (getDialogImpl().boxCustom != null) {
             getDialogImpl().boxCustom.removeAllViews();
         }
-    
+        
         enterAnimDuration = 0;
         dialogView = createView(R.layout.layout_dialogx_custom);
         dialogImpl = new DialogImpl(dialogView);

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

@@ -203,7 +203,7 @@ public class BlurView extends View {
                     downsampleFactor = downsampleFactor * radius / 25;
                     radius = 25;
                 }
-                mBlurScript.setRadius(radius);
+                if(mBlurScript!=null)mBlurScript.setRadius(radius);
             }
         }
         

+ 44 - 2
README.md

@@ -97,17 +97,59 @@ DialogX 采用了主题分离结构,主框架仅包含 Material 设计风格
 
 <div align=center><img src="https://github.com/kongzue/DialogX/raw/master/readme/download_demo_qrcode.png" alt="下载 DialogX Demo" width="250" height="250" /></div>
 
-# 开始使用DialogX
+# 开始使用 DialogX
 
 因为依赖的关系,DialogX 目前仅支持 AndroidX 作为基础进行开发,若您正在使用最新版本的 Android Studio,那么默认创建的项目就是使用 AndroidX 作为底层框架的,老版本 Android Support 兼容库将在后续更新。
 
+以下四种引入方式请任选其一。
+
+## Gradle 引入 jCenter 源
+
 想要在您的项目引入 DialogX,您需要在 app 的 build.gradle 文件中找到 `dependencies{}` 代码块,并在其中加入以下语句:
 
 ```
 implementation 'com.kongzue.dialogx:DialogX:0.0.33'
 ```
 
-若有需要,也可以手动配置 Maven:
+## Gradle 引入  jitPack 源
+
+在 project 的 build.gradle 文件中找到 `allprojects{}` 代码块添加以下代码:
+
+```
+allprojects {
+    repositories {
+        google()
+        jcenter()
+        maven { url 'https://jitpack.io' }      //增加 jitPack Maven 仓库
+    }
+}
+```
+
+在 app 的 build.gradle 文件中找到 `dependencies{}` 代码块,并在其中加入以下语句:
+
+```
+implementation 'com.github.kongzue.dialogx:DialogX:0.0.32'
+```
+
+## 直接引入 AAR 包文件
+
+请前往 [Release](https://github.com/kongzue/DialogX/releases) 页面根据需要版本的下载 AAR 包文件。
+
+1) 将 AAR 放入 libs 目录。
+
+2) 在 Module 的 build.gradle 里加入以下代码:
+```
+build.gradle
+repositories{
+    flatDir {
+        dirs 'libs'
+    }
+}
+
+implementation(name: 'AAR文件名', ext: 'aar')
+```
+
+## 手动配置 Maven:
 
 ```xml
 <dependency>

+ 3 - 0
build.gradle

@@ -21,6 +21,9 @@ allprojects {
         maven{
             url 'https://dl.bintray.com/myzchh/maven'
         }
+        maven{
+            url 'https://jitpack.io'
+        }
     }
 }
 

+ 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.33
+BUILD_VERSION=0.0.33.beta2
 BUILD_VERSION_INT=33