Skip to content

Commit 44e4777

Browse files
authored
Update ProgressStatusBar.java
1 parent 1f4bdaf commit 44e4777

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

ProgressStatusBar/src/main/java/com/basel/ProgressStatusBar/ProgressStatusBar.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ public void prepare(boolean isShowPercentage,boolean isWait) {
203203
if(!isViewAdded) {
204204
windowManager.addView(mRelativeLayout, parameters);
205205
isViewAdded = true;
206-
pListener.onStart();
206+
if(pListener!=null){
207+
pListener.onStart();
208+
}
207209
}
208210
mRelativeLayout.setVisibility(VISIBLE);
209211
if(isShowPercentage) {
@@ -225,7 +227,9 @@ public void shwoToast(String message, int duration) {
225227
if(!isViewAdded) {
226228
windowManager.addView(mRelativeLayout, parameters);
227229
isViewAdded = true;
228-
pListener.onStart();
230+
if(pListener!=null){
231+
pListener.onStart();
232+
}
229233
}
230234
mRelativeLayout.setVisibility(VISIBLE);
231235
ballsHandler = new Handler();
@@ -269,7 +273,9 @@ public void onAnimationUpdate(ValueAnimator animation) {
269273
interprogress = (int) (interpolation * (isfake ? 100 : progress));
270274
setProgress(interprogress, false, isfake);
271275
mTextView.setText("%"+interprogress);
272-
pListener.onUpdate(interprogress);
276+
if(pListener!=null){
277+
pListener.onUpdate(interprogress);
278+
}
273279
}
274280
});
275281
if (!barProgress.isStarted()) {
@@ -305,7 +311,9 @@ public void remove() {
305311
isViewAdded = false;
306312
mRelativeLayout.setVisibility(GONE);
307313
mTextView.setText("");
308-
pListener.onEnd();
314+
if(pListener!=null){
315+
pListener.onEnd();
316+
}
309317
}
310318
if(ballsHandler!=null&&ballsRunnable!=null){
311319
ballsHandler.removeCallbacks(ballsRunnable);

0 commit comments

Comments
 (0)