Animate states changed
This commit is contained in:
parent
273f731dd5
commit
93f2518159
16 changed files with 113 additions and 22 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue