From b577010cd763ff77b86c4c5a06c18a9796e67688 Mon Sep 17 00:00:00 2001 From: sai Date: Thu, 11 Aug 2016 19:08:17 +0800 Subject: [PATCH] 1.0.6 --- svprogresshud/build.gradle | 2 +- .../bigkoo/svprogresshud/SVProgressHUD.java | 23 +++++++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/svprogresshud/build.gradle b/svprogresshud/build.gradle index 336b1e4..0234e61 100644 --- a/svprogresshud/build.gradle +++ b/svprogresshud/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' apply plugin: 'com.github.dcendents.android-maven' apply plugin: 'com.jfrog.bintray' -version = "1.0.4" +version = "1.0.6" android { compileSdkVersion 23 diff --git a/svprogresshud/src/main/java/com/bigkoo/svprogresshud/SVProgressHUD.java b/svprogresshud/src/main/java/com/bigkoo/svprogresshud/SVProgressHUD.java index 4f59aac..105841e 100644 --- a/svprogresshud/src/main/java/com/bigkoo/svprogresshud/SVProgressHUD.java +++ b/svprogresshud/src/main/java/com/bigkoo/svprogresshud/SVProgressHUD.java @@ -27,6 +27,7 @@ public class SVProgressHUD { private static final long DISMISSDELAYED = 1000; private SVProgressHUDMaskType mSVProgressHUDMaskType; private boolean isShowing; + private boolean isDismissing; public enum SVProgressHUDMaskType { None, // 允许遮罩下面控件点击 @@ -103,22 +104,21 @@ private void onAttached() { private void svShow() { mHandler.removeCallbacksAndMessages(null); - if (!isShowing()) { - onAttached(); - } + onAttached(); mSharedView.startAnimation(inAnim); } public void show() { - + if(isShowing())return; setMaskType(SVProgressHUDMaskType.Black); mSharedView.show(); svShow(); } public void showWithMaskType(SVProgressHUDMaskType maskType) { + if(isShowing())return; //判断maskType setMaskType(maskType); mSharedView.show(); @@ -126,18 +126,21 @@ public void showWithMaskType(SVProgressHUDMaskType maskType) { } public void showWithStatus(String string) { + if(isShowing())return; setMaskType(SVProgressHUDMaskType.Black); mSharedView.showWithStatus(string); svShow(); } public void showWithStatus(String string, SVProgressHUDMaskType maskType) { + if(isShowing())return; setMaskType(maskType); mSharedView.showWithStatus(string); svShow(); } public void showInfoWithStatus(String string) { + if(isShowing())return; setMaskType(SVProgressHUDMaskType.Black); mSharedView.showInfoWithStatus(string); svShow(); @@ -145,6 +148,7 @@ public void showInfoWithStatus(String string) { } public void showInfoWithStatus(String string, SVProgressHUDMaskType maskType) { + if(isShowing())return; setMaskType(maskType); mSharedView.showInfoWithStatus(string); svShow(); @@ -152,6 +156,7 @@ public void showInfoWithStatus(String string, SVProgressHUDMaskType maskType) { } public void showSuccessWithStatus(String string) { + if(isShowing())return; setMaskType(SVProgressHUDMaskType.Black); mSharedView.showSuccessWithStatus(string); svShow(); @@ -159,6 +164,7 @@ public void showSuccessWithStatus(String string) { } public void showSuccessWithStatus(String string, SVProgressHUDMaskType maskType) { + if(isShowing())return; setMaskType(maskType); mSharedView.showSuccessWithStatus(string); svShow(); @@ -166,6 +172,7 @@ public void showSuccessWithStatus(String string, SVProgressHUDMaskType maskType) } public void showErrorWithStatus(String string) { + if(isShowing())return; setMaskType(SVProgressHUDMaskType.Black); mSharedView.showErrorWithStatus(string); svShow(); @@ -173,6 +180,7 @@ public void showErrorWithStatus(String string) { } public void showErrorWithStatus(String string, SVProgressHUDMaskType maskType) { + if(isShowing())return; setMaskType(maskType); mSharedView.showErrorWithStatus(string); svShow(); @@ -180,6 +188,7 @@ public void showErrorWithStatus(String string, SVProgressHUDMaskType maskType) { } public void showWithProgress(String string, SVProgressHUDMaskType maskType) { + if(isShowing())return; setMaskType(maskType); mSharedView.showWithProgress(string); svShow(); @@ -233,12 +242,15 @@ private void configMaskType(int bg, boolean clickable, boolean cancelable) { * @return 如果视图已经存在该View返回true */ public boolean isShowing() { - return rootView.getParent() != null && isShowing; + return rootView.getParent() != null || isShowing; } public void dismiss() { + if(isDismissing)return; + isDismissing = true; //消失动画 outAnim.setAnimationListener(outAnimListener); + mSharedView.dismiss(); mSharedView.startAnimation(outAnim); } @@ -247,6 +259,7 @@ public void dismissImmediately() { rootView.removeView(mSharedView); decorView.removeView(rootView); isShowing = false; + isDismissing = false; if(onDismissListener != null){ onDismissListener.onDismiss(this); }