Skip to content

Commit 223b3f2

Browse files
committed
fix #28
1 parent 8b41ec8 commit 223b3f2

File tree

1 file changed

+12
-6
lines changed
  • library/src/main/java/com/daimajia/androidanimations/library

1 file changed

+12
-6
lines changed

library/src/main/java/com/daimajia/androidanimations/library/YoYo.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ public class YoYo {
3838
private static final long DURATION = BaseViewAnimator.DURATION;
3939
private static final long NO_DELAY = 0;
4040

41-
private Techniques techniques;
41+
private BaseViewAnimator animator;
4242
private long duration;
4343
private long delay;
4444
private Interpolator interpolator;
4545
private List<Animator.AnimatorListener> callbacks;
4646
private View target;
4747

4848
private YoYo(AnimationComposer animationComposer) {
49-
techniques = animationComposer.techniques;
49+
animator = animationComposer.animator;
5050
duration = animationComposer.duration;
5151
delay = animationComposer.delay;
5252
interpolator = animationComposer.interpolator;
@@ -58,18 +58,26 @@ public static AnimationComposer with(Techniques techniques) {
5858
return new AnimationComposer(techniques);
5959
}
6060

61+
public static AnimationComposer with(BaseViewAnimator animator) {
62+
return new AnimationComposer(animator);
63+
}
64+
6165
public static final class AnimationComposer {
6266

6367
private List<Animator.AnimatorListener> callbacks = new ArrayList<Animator.AnimatorListener>();
6468

65-
private Techniques techniques;
69+
private BaseViewAnimator animator;
6670
private long duration = DURATION;
6771
private long delay = NO_DELAY;
6872
private Interpolator interpolator;
6973
private View target;
7074

7175
private AnimationComposer(Techniques techniques) {
72-
this.techniques = techniques;
76+
this.animator = techniques.getAnimator();
77+
}
78+
79+
private AnimationComposer(BaseViewAnimator animator) {
80+
this.animator = animator;
7381
}
7482

7583
public AnimationComposer duration(long duration) {
@@ -131,8 +139,6 @@ public void stop(boolean reset){
131139
}
132140

133141
private BaseViewAnimator play() {
134-
final BaseViewAnimator animator = techniques.getAnimator();
135-
136142
animator.setDuration(duration)
137143
.setInterpolator(interpolator)
138144
.setStartDelay(delay);

0 commit comments

Comments
 (0)