Open rajvardhanyadav opened 7 years ago
following.
Any solution for this issue?
Ok found my problem I was using ObjectAnimator.OfInt(....) but setProgress() method in DonutProgress class has float argument so it was not being called. Changed ObjectAnimator.OfInt(....) to ObjectAnimator.OfFloat(....) and it worked. But float values were looking weird so I extended CustomDonutProgress from DonutProgress and defined setProgress(int arg)
public void setProgress(int progress) {
super.setProgress(progress);
Log.d("CustDonut", "setProgress: " + progress);
}
Thanks guys! It worked for me too!
I have into a Fragment, so this can help others (same as you guys helped me :)
`
// Donut Progress Animation :) getActivity().runOnUiThread(new Runnable() {
public void run() {
ObjectAnimator anim = ObjectAnimator.ofFloat(mDonutProgress, "progress", 0, progress);
anim.setInterpolator(new DecelerateInterpolator());
anim.setDuration(2000);
anim.start();
anim.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
if (progress >= 100) {
//do something :)
}
}
});
}
});
`
How to apply animation for donut progress bar? Old ObjectAnimator logic is not working with 1.2.1 version.