airbnb / lottie-android

Render After Effects animations natively on Android and iOS, Web, and React Native
http://airbnb.io/lottie/
Apache License 2.0
34.92k stars 5.4k forks source link

`LottieOnCompositionLoadedListener` is not called when the animation is loaded again #2505

Open linkaipeng opened 2 months ago

linkaipeng commented 2 months ago

Lottie is supported and developed on nights and weekends. Issues from Lottie sponsors will be prioritized.

If you don't use this template, your issue will be closed. Delete this text once completed.

Checklist

  1. Fork this repository into your account. ✅
  2. Reproduce your issue in the issue-repro module. Issues without a repro in the issue-repro module may be auto-closed. ✅

Link to fork with a repro in the issue-repro module

https://github.com/linkaipeng/lottie-android/tree/master/issue-repro

Describe the bug

Steps To Reproduce Steps to reproduce the behavior:

  1. Call binding.animationView.playAnimation() within the addLottieOnCompositionLoadedListener onCompositionLoaded.
  2. Click loadButton, call setAnimation(R.raw.heart), it's work.
  3. Click cancelButton, call cancelAnimation()
  4. Click loadButton again, it's not work. Reproduce. However, the issue did not exist in the version 6.0.0.

I've reviewed the source code and analyzed the differences with version 6.0.0. I would like to know why these changes were made?