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

Call LottieTask listeners synchronously when already on the main thread #2470

Closed gpeal closed 5 months ago

gpeal commented 5 months ago

When we are already on the main thread, there is no need to post listeners to the main thread again.

As a side effect, this fixes https://github.com/airbnb/lottie-android/issues/2449. The listener was called twice because it was called synchronously in addListener because it was already done and then because of the post, it was called again.

Fixes https://github.com/airbnb/lottie-android/issues/2449

github-actions[bot] commented 5 months ago

Snapshot Tests API 23: Report Diff API 31: Report Diff