Skip to content

Commit 120c558

Browse files
committed
Merge pull request HarlonWang#27 from cclink/master
Fix bug: the animator is not started when the AVLoadingIndicatorView added to a layout the second time.
2 parents 15747c0 + cf7813a commit 120c558

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

library/src/main/java/com/wang/avi/AVLoadingIndicatorView.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,20 @@ public void setVisibility(int v) {
327327
}
328328
}
329329

330+
@Override
331+
protected void onAttachedToWindow() {
332+
super.onAttachedToWindow();
333+
if (mHasAnimation) {
334+
mIndicatorController.setAnimationStatus(BaseIndicatorController.AnimStatus.START);
335+
}
336+
}
337+
330338
@Override
331339
protected void onDetachedFromWindow() {
332340
super.onDetachedFromWindow();
333341
mIndicatorController.setAnimationStatus(BaseIndicatorController.AnimStatus.CANCEL);
334342
}
335343

336-
337344
void drawIndicator(Canvas canvas){
338345
mIndicatorController.draw(canvas,mPaint);
339346
}
@@ -345,6 +352,4 @@ void applyAnimation(){
345352
private int dp2px(int dpValue) {
346353
return (int) getContext().getResources().getDisplayMetrics().density * dpValue;
347354
}
348-
349-
350355
}

0 commit comments

Comments
 (0)