@@ -38,15 +38,15 @@ public class YoYo { |
38 | 38 | private static final long DURATION = BaseViewAnimator.DURATION; |
39 | 39 | private static final long NO_DELAY = 0; |
40 | 40 |
|
41 | | - private Techniques techniques; |
| 41 | + private BaseViewAnimator animator; |
42 | 42 | private long duration; |
43 | 43 | private long delay; |
44 | 44 | private Interpolator interpolator; |
45 | 45 | private List<Animator.AnimatorListener> callbacks; |
46 | 46 | private View target; |
47 | 47 |
|
48 | 48 | private YoYo(AnimationComposer animationComposer) { |
49 | | - techniques = animationComposer.techniques; |
| 49 | + animator = animationComposer.animator; |
50 | 50 | duration = animationComposer.duration; |
51 | 51 | delay = animationComposer.delay; |
52 | 52 | interpolator = animationComposer.interpolator; |
@@ -58,18 +58,26 @@ public static AnimationComposer with(Techniques techniques) { |
58 | 58 | return new AnimationComposer(techniques); |
59 | 59 | } |
60 | 60 |
|
| 61 | + public static AnimationComposer with(BaseViewAnimator animator) { |
| 62 | + return new AnimationComposer(animator); |
| 63 | + } |
| 64 | + |
61 | 65 | public static final class AnimationComposer { |
62 | 66 |
|
63 | 67 | private List<Animator.AnimatorListener> callbacks = new ArrayList<Animator.AnimatorListener>(); |
64 | 68 |
|
65 | | - private Techniques techniques; |
| 69 | + private BaseViewAnimator animator; |
66 | 70 | private long duration = DURATION; |
67 | 71 | private long delay = NO_DELAY; |
68 | 72 | private Interpolator interpolator; |
69 | 73 | private View target; |
70 | 74 |
|
71 | 75 | private AnimationComposer(Techniques techniques) { |
72 | | - this.techniques = techniques; |
| 76 | + this.animator = techniques.getAnimator(); |
| 77 | + } |
| 78 | + |
| 79 | + private AnimationComposer(BaseViewAnimator animator) { |
| 80 | + this.animator = animator; |
73 | 81 | } |
74 | 82 |
|
75 | 83 | public AnimationComposer duration(long duration) { |
@@ -131,8 +139,6 @@ public void stop(boolean reset){ |
131 | 139 | } |
132 | 140 |
|
133 | 141 | private BaseViewAnimator play() { |
134 | | - final BaseViewAnimator animator = techniques.getAnimator(); |
135 | | - |
136 | 142 | animator.setDuration(duration) |
137 | 143 | .setInterpolator(interpolator) |
138 | 144 | .setStartDelay(delay); |
|