Skip to content

Commit

Permalink
1.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
saiwu-bigkoo committed Aug 11, 2016
1 parent 4d85cb9 commit b577010
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion svprogresshud/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, // 允许遮罩下面控件点击
Expand Down Expand Up @@ -103,83 +104,91 @@ 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();
svShow();
}

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();
scheduleDismiss();
}

public void showInfoWithStatus(String string, SVProgressHUDMaskType maskType) {
if(isShowing())return;
setMaskType(maskType);
mSharedView.showInfoWithStatus(string);
svShow();
scheduleDismiss();
}

public void showSuccessWithStatus(String string) {
if(isShowing())return;
setMaskType(SVProgressHUDMaskType.Black);
mSharedView.showSuccessWithStatus(string);
svShow();
scheduleDismiss();
}

public void showSuccessWithStatus(String string, SVProgressHUDMaskType maskType) {
if(isShowing())return;
setMaskType(maskType);
mSharedView.showSuccessWithStatus(string);
svShow();
scheduleDismiss();
}

public void showErrorWithStatus(String string) {
if(isShowing())return;
setMaskType(SVProgressHUDMaskType.Black);
mSharedView.showErrorWithStatus(string);
svShow();
scheduleDismiss();
}

public void showErrorWithStatus(String string, SVProgressHUDMaskType maskType) {
if(isShowing())return;
setMaskType(maskType);
mSharedView.showErrorWithStatus(string);
svShow();
scheduleDismiss();
}

public void showWithProgress(String string, SVProgressHUDMaskType maskType) {
if(isShowing())return;
setMaskType(maskType);
mSharedView.showWithProgress(string);
svShow();
Expand Down Expand Up @@ -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);
}

Expand All @@ -247,6 +259,7 @@ public void dismissImmediately() {
rootView.removeView(mSharedView);
decorView.removeView(rootView);
isShowing = false;
isDismissing = false;
if(onDismissListener != null){
onDismissListener.onDismiss(this);
}
Expand Down

0 comments on commit b577010

Please sign in to comment.