From 1264aafb20b1e8bff3dff505a58247ba21ae898d Mon Sep 17 00:00:00 2001 From: "Mr.He" <1083010205@qq.com> Date: Sun, 26 Mar 2017 16:46:55 +0800 Subject: [PATCH] . --- .../com/loadinglibrary/LoadingDialog.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/loadinglibrary/src/main/java/loading/heyongrui/com/loadinglibrary/LoadingDialog.java b/loadinglibrary/src/main/java/loading/heyongrui/com/loadinglibrary/LoadingDialog.java index 1c53baf..31661bd 100644 --- a/loadinglibrary/src/main/java/loading/heyongrui/com/loadinglibrary/LoadingDialog.java +++ b/loadinglibrary/src/main/java/loading/heyongrui/com/loadinglibrary/LoadingDialog.java @@ -68,15 +68,15 @@ public LoadingDialog(Context mcontext, boolean cancelable, float alpha, int type this.alpha = alpha; this.type = type; this.color = color; - init(this.type, this.color); + init(); } - public void init(int type, @ColorInt int color) { + public void init() { builder = new AlertDialog.Builder(mcontext); View loading_dialog_ll = LayoutInflater.from(mcontext).inflate(R.layout.laoding_dialog, null); SpinKitView skv = (SpinKitView) loading_dialog_ll.findViewById(R.id.spin_kit); - skv.setColor(color); - switch (type) { + skv.setColor(this.color); + switch (this.type) { case 0: ChasingDots chasingDots = new ChasingDots(); skv.setIndeterminateDrawable(chasingDots); @@ -133,7 +133,7 @@ public void init(int type, @ColorInt int color) { Window window = alertDialog.getWindow(); //loading框透明度 WindowManager.LayoutParams lp = window.getAttributes(); - lp.alpha = alpha; + lp.alpha = this.alpha; window.setAttributes(lp); } @@ -167,17 +167,21 @@ public boolean isShowing() { public void setColor(@ColorInt int color) { this.color = color; + init(); } public void setType(int type) { this.type = type; + init(); } public void setCancelable(boolean cancelable) { this.cancelable = cancelable; + init(); } public void setAlpha(float alpha) { this.alpha = alpha; + init(); } }