Skip to content

Commit a98b301

Browse files
vigneshvgkanelbulle
authored andcommitted
GifDrawable: Call stop before notifying end to listeners
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.
1 parent a7351b0 commit a98b301

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/src/main/java/com/bumptech/glide/load/resource/gif/GifDrawable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ public void onFrameReady() {
345345
}
346346

347347
if (maxLoopCount != LOOP_FOREVER && loopCount >= maxLoopCount) {
348-
notifyAnimationEndToListeners();
349348
stop();
349+
notifyAnimationEndToListeners();
350350
}
351351
}
352352

0 commit comments

Comments
 (0)