Last active
December 25, 2015 02:09
-
-
Save orip/6901005 to your computer and use it in GitHub Desktop.
Helper to simulate withEndAction in NineOldAndroids http://nineoldandroids.com/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example; | |
import com.nineoldandroids.animation.Animator; | |
/* | |
* animate(view).alpha(0).setListener(AnimationUtils.withEndAction(new Runnable() { | |
* public void run() { | |
* view.setVisibility(View.GONE); | |
* view.setAlpha(1); // restore alpha | |
* } | |
* })); | |
*/ | |
public class AnimationUtils { | |
public static Animator.AnimatorListener withEndAction(final Runnable runnable) { | |
return new Animator.AnimatorListener() { | |
public void onAnimationStart(Animator animation) { | |
} | |
public void onAnimationEnd(Animator animation) { | |
runnable.run(); | |
} | |
public void onAnimationCancel(Animator animation) { | |
} | |
public void onAnimationRepeat(Animator animation) { | |
} | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment