2525
2626package com .daimajia .androidanimations .library ;
2727
28+ import android .animation .Animator ;
2829import android .view .View ;
2930import android .view .animation .Interpolator ;
3031
31- import com .nineoldandroids .animation .Animator ;
3232
3333import java .util .ArrayList ;
3434import java .util .List ;
@@ -68,18 +68,25 @@ public interface AnimatorCallback {
6868
6969 private static class EmptyAnimatorListener implements Animator .AnimatorListener {
7070 @ Override
71- public void onAnimationStart (Animator animation ){}
71+ public void onAnimationStart (Animator animation ) {
72+ }
73+
7274 @ Override
73- public void onAnimationEnd (Animator animation ){}
75+ public void onAnimationEnd (Animator animation ) {
76+ }
77+
7478 @ Override
75- public void onAnimationCancel (Animator animation ){}
79+ public void onAnimationCancel (Animator animation ) {
80+ }
81+
7682 @ Override
77- public void onAnimationRepeat (Animator animation ){}
83+ public void onAnimationRepeat (Animator animation ) {
84+ }
7885 }
7986
8087 public static final class AnimationComposer {
8188
82- private List <Animator .AnimatorListener > callbacks = new ArrayList <Animator . AnimatorListener >();
89+ private List <Animator .AnimatorListener > callbacks = new ArrayList <>();
8390
8491 private BaseViewAnimator animator ;
8592 private long duration = DURATION ;
@@ -119,31 +126,39 @@ public AnimationComposer withListener(Animator.AnimatorListener listener) {
119126 public AnimationComposer onStart (final AnimatorCallback callback ) {
120127 callbacks .add (new EmptyAnimatorListener () {
121128 @ Override
122- public void onAnimationStart (Animator animation ) { callback .call (animation ); }
129+ public void onAnimationStart (Animator animation ) {
130+ callback .call (animation );
131+ }
123132 });
124133 return this ;
125134 }
126135
127136 public AnimationComposer onEnd (final AnimatorCallback callback ) {
128137 callbacks .add (new EmptyAnimatorListener () {
129138 @ Override
130- public void onAnimationEnd (Animator animation ) { callback .call (animation ); }
139+ public void onAnimationEnd (Animator animation ) {
140+ callback .call (animation );
141+ }
131142 });
132143 return this ;
133144 }
134145
135146 public AnimationComposer onCancel (final AnimatorCallback callback ) {
136147 callbacks .add (new EmptyAnimatorListener () {
137148 @ Override
138- public void onAnimationCancel (Animator animation ) { callback .call (animation ); }
149+ public void onAnimationCancel (Animator animation ) {
150+ callback .call (animation );
151+ }
139152 });
140153 return this ;
141154 }
142155
143156 public AnimationComposer onRepeat (final AnimatorCallback callback ) {
144157 callbacks .add (new EmptyAnimatorListener () {
145158 @ Override
146- public void onAnimationRepeat (Animator animation ) { callback .call (animation ); }
159+ public void onAnimationRepeat (Animator animation ) {
160+ callback .call (animation );
161+ }
147162 });
148163 return this ;
149164 }
@@ -163,23 +178,23 @@ public static final class YoYoString {
163178 private BaseViewAnimator animator ;
164179 private View target ;
165180
166- private YoYoString (BaseViewAnimator animator , View target ){
181+ private YoYoString (BaseViewAnimator animator , View target ) {
167182 this .target = target ;
168183 this .animator = animator ;
169184 }
170185
171- public boolean isStarted (){
186+ public boolean isStarted () {
172187 return animator .isStarted ();
173188 }
174189
175- public boolean isRunning (){
190+ public boolean isRunning () {
176191 return animator .isRunning ();
177192 }
178193
179- public void stop (boolean reset ){
194+ public void stop (boolean reset ) {
180195 animator .cancel ();
181196
182- if (reset )
197+ if (reset )
183198 animator .reset (target );
184199 }
185200
0 commit comments