fix progressbar' animation stopable

This commit is contained in:
houzh 2023-09-21 18:55:58 +08:00
parent 3596096e41
commit 30e98175b0
2 changed files with 8 additions and 3 deletions

View File

@ -418,9 +418,11 @@ void ProgressBar::setIndeterminate(bool indeterminate){
// swap between indeterminate and regular backgrounds
swapCurrentDrawable(mIndeterminateDrawable);
startAnimation();
} else {
} else if(mProgressDrawable){
swapCurrentDrawable(mProgressDrawable);
stopAnimation();
}else{
stopAnimation();
}
}
}
@ -593,8 +595,8 @@ void ProgressBar::startAnimation() {
}
void ProgressBar::stopAnimation() {
if (dynamic_cast<Animatable*>(mIndeterminateDrawable)) {
((Animatable*) mIndeterminateDrawable)->stop();
if (dynamic_cast<AnimatedRotateDrawable*>(mIndeterminateDrawable)) {
((AnimatedRotateDrawable*) mIndeterminateDrawable)->stop();
mShouldStartAnimationDrawable = false;
}
postInvalidate();

View File

@ -376,6 +376,9 @@ TextView::TextView(Context*ctx,const AttributeSet& attrs)
Drawable* end = attrs.getDrawable("drawableEnd");
setCompoundDrawablesWithIntrinsicBounds(left,top,right,bottom);
if(mDrawables){
mDrawables->mTintList =attrs.getColorStateList("drawableTint");
}
setRelativeDrawablesIfNeeded(start, end);
setCompoundDrawablePadding(attrs.getDimensionPixelSize("drawablePadding",0));