Animate states changed

This commit is contained in:
Vasiliy 2019-04-27 22:27:08 +03:00
parent 273f731dd5
commit 93f2518159
No known key found for this signature in database
GPG key ID: 9F74C4D2874D7523
16 changed files with 113 additions and 22 deletions

View file

@ -25,8 +25,7 @@ public final class AnimatedProgressBar extends ProgressBar {
super(context, attrs, defStyleAttr);
}
@Override
public synchronized void setProgress(int progress) {
public synchronized void setProgressAnimated(int progress) {
cancelAnimation();
animation = new ProgressBarAnimation(this, getProgress(), progress);
startAnimation(animation);
@ -40,10 +39,6 @@ public final class AnimatedProgressBar extends ProgressBar {
clearAnimation();
}
private void setProgressInternal(int progress) {
super.setProgress(progress);
}
private static class ProgressBarAnimation extends Animation {
private final AnimatedProgressBar progressBar;
@ -63,7 +58,7 @@ public final class AnimatedProgressBar extends ProgressBar {
protected void applyTransformation(float interpolatedTime, Transformation t) {
super.applyTransformation(interpolatedTime, t);
float value = from + (to - from) * interpolatedTime;
progressBar.setProgressInternal((int) value);
progressBar.setProgress((int) value);
}
}
}