Add onAnimationFinishListener for animation
Do something if animation done
We don't yet support this.
+1
+1
+1
Pull-requests are welcome. Just saying :)
+1
+1
Has this been picked up?I was considering submitting a PR here,hence the question.
We're internally working on an improved version that supports this - but it's going to take some time until it is ready. So if you need it sooner feel free to submit a PR.
+1
is it ok now?
Kewl....thank you guys :D
On Tue, Jan 17, 2017 at 9:11 AM, k-lam [email protected] wrote:
is it ok now?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/facebook/fresco/issues/181#issuecomment-273038583, or mute the thread https://github.com/notifications/unsubscribe-auth/ALE6PLr5kG35Fpg37u_FJKGb9eBi3tILks5rTGmKgaJpZM4EF1_I .
+1
+1
+1
ValueAnimator animator;
new ControllerListener
@Override
public void onSubmit(String id, Object callerContext) {
}
@Override
public void onFinalImageSet(String id, @Nullable ImageInfo imageInfo, @Nullable Animatable animatable) {
animator = ((AnimatedDrawable)animatable).createValueAnimator();
}
@Override
public void onIntermediateImageSet(String id, @Nullable ImageInfo imageInfo) {
}
@Override
public void onIntermediateImageFailed(String id, Throwable throwable) {
}
@Override
public void onFailure(String id, Throwable throwable) {
}
@Override
public void onRelease(String id) {
}
}
animator is android.animation.ValueAnimator; so... `animator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
Log.i(TAG, "onAnimationEnd: ");
// callback you want : onAnimationFinishListener
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
Log.i(TAG, "onAnimationRepeat: ");
}
});
animator.setRepeatCount(0); animator.start(); `
We've released Fresco v1.4.0, which includes a new implementation for animated GIFs and animated WebPs.
You can now set an animation listener to get notified about these events.
You can use a ControllerListener to attach the AnimationListener:
Fresco.newDraweeControllerBuilder()
.setImageRequest(imageRequest)
.setAutoPlayAnimations(true)
.setControllerListener(
new BaseControllerListener() {
@Override
public void onFinalImageSet(
String id,
@Nullable Object imageInfo,
@Nullable Animatable animatable) {
if (animatable != null) {
AnimatedDrawable2 animatedDrawable = (AnimatedDrawable2) animatable;
animatedDrawable.setAnimationListener(yourAnimationListener);
}
}
})
.build()