Skip to content

Commit

Permalink
添加自定义loading图片数组展现形式
Browse files Browse the repository at this point in the history
  • Loading branch information
limxing committed Jul 18, 2017
1 parent 771ffb4 commit 79258e6
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ public void dismiss() {
} else {
outAnim.setStartOffset(0);
}
if (promptView.getCurrentType() == PromptView.CUSTOMER_LOADING){
promptView.stopCustomerLoading();
}

promptView.dismiss();
promptView.startAnimation(outAnim);
outAnim.setAnimationListener(new Animation.AnimationListener() {
Expand Down Expand Up @@ -446,4 +450,27 @@ public void onAdClick() {
adListener.onAdClick();
}
}
/**
* 加载自定义的loading
* @param logo_loading 图片数组
* @param msg 展现消息
*/
public void showCustomLoading(int logo_loading, String msg) {

inAnim = inDefaultAnim;
outAnim = outDefaultAnim;
if (promptView.getCurrentType() != PromptView.PROMPT_LOADING) {
Builder builder = Builder.getDefaultBuilder();
builder.icon(logo_loading);
builder.text(msg);
promptView.setBuilder(builder);
closeInput();
checkLoadView(true);
promptView.showCustomLoading();
dissmissAni(true);
} else {
promptView.setText(msg);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ShapeDrawable;
Expand Down Expand Up @@ -43,6 +44,7 @@ class PromptView extends ImageView {
private static final String TAG = "LOADVIEW";
public static final int PROMPT_CUSTOM = 108;
public static final int PROMPT_AD = 109;
public static final int CUSTOMER_LOADING = 110;
private PromptDialog promptDialog;
private Builder builder;
private int width;
Expand Down Expand Up @@ -752,4 +754,29 @@ public void showAd() {
this.currentType = PROMPT_AD;
endAnimator();
}

/**
* 展示自定义的loading
*/
public void showCustomLoading() {
if (currentType == PROMPT_ALERT_WARN) {
isSheet = buttons.length > 2;
} else {
isSheet = false;
}
setImageDrawable(getResources().getDrawable(builder.icon));
width = getDrawable().getMinimumWidth() / 2;
height = getDrawable().getMinimumHeight() / 2;
AnimationDrawable animationDrawable = (AnimationDrawable) getDrawable();
animationDrawable.start();
currentType = CUSTOMER_LOADING;
}

/**
* 停止自定义的loading
*/
public void stopCustomerLoading() {
AnimationDrawable animationDrawable = (AnimationDrawable) getDrawable();
animationDrawable.stop();
}
}

0 comments on commit 79258e6

Please sign in to comment.