bumptech / glide

An image loading and caching library for Android focused on smooth scrolling
https://bumptech.github.io/glide/
Other
34.67k stars 6.12k forks source link

GifDrawable: Call stop before notifying end to listeners #5451

Closed vigneshvg closed 1 month ago

vigneshvg commented 1 month ago

In the current code, GifDrawable calls the onAnimationEnd callback first and then invokes stop() to end the animation.

This behavior prevents the following use-case: An app wants to schedule another loop of the GifDrawable when the current loop ends (i.e.) calls start() from within the onAnimationEnd() callback. This doesn't work because stop() is called right after the onAnimationEnd() callback is complete.

Reversing the order of these two calls to enable this use-case.