fresco icon indicating copy to clipboard operation
fresco copied to clipboard

Add onAnimationFinishListener for animation

Open eresid opened this issue 11 years ago • 17 comments

Do something if animation done

eresid avatar Apr 22 '15 08:04 eresid

We don't yet support this.

tyronen avatar Apr 23 '15 11:04 tyronen

+1

qinchong1988 avatar Jan 06 '16 12:01 qinchong1988

+1

cpiz avatar Mar 29 '16 15:03 cpiz

+1

xibaca avatar May 25 '16 19:05 xibaca

Pull-requests are welcome. Just saying :)

plamenko avatar May 26 '16 16:05 plamenko

+1

dragos-triteanu avatar Jun 28 '16 18:06 dragos-triteanu

+1

renyanxu2000 avatar Aug 01 '16 06:08 renyanxu2000

Has this been picked up?I was considering submitting a PR here,hence the question.

notsatyarth avatar Sep 12 '16 12:09 notsatyarth

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.

oprisnik avatar Sep 12 '16 19:09 oprisnik

+1

RamiJ3mli avatar Nov 27 '16 12:11 RamiJ3mli

is it ok now?

k-lam avatar Jan 17 '17 07:01 k-lam

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 .

dragos-triteanu avatar Jan 17 '17 07:01 dragos-triteanu

+1

jjding1986 avatar Feb 27 '17 09:02 jjding1986

+1

weisssean avatar Feb 27 '17 15:02 weisssean

+1

stanmots avatar Feb 28 '17 17:02 stanmots

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(); `

k-lam avatar Mar 31 '17 09:03 k-lam

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()

oprisnik avatar Jul 17 '17 14:07 oprisnik