bumptech / bumptech/glide

Need Callbacks for when a GifDrawable with an animation finishes it's last loop

Open
#1,872 10 comments 0 reactions 0 assignees View on GitHub
enhancement GIF help wanted
Dominant language
Java
Stars
35k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
8

Description

**Glide Version**: 3.8.0-SNAPSHOT

**Glide load line / `GlideModule` (if any) / list Adapter code (if any)**:
```java
glide.load(b).into(new GlideDrawableImageViewTarget(imageView, GlideDrawable.LOOP_INTRINSIC));
```

I have a series of 3 animated gifs that have to animate themselves in sequence. There seems to be no current way with glide to know when a particular animation is done so that i can start the next one.

GifDrawable seems to be the place where this might have to be

```java
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public void onFrameReady(int frameIndex) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && getCallback() == null) {
stop();
reset();
return;
}

invalidateSelf();

if (frameIndex == decoder.getFrameCount() - 1) {
loopCount++;
}

if (maxLoopCount != LOOP_FOREVER && loopCount >= maxLoopCount) {
stop();
}
}
```

i could override that method, however, i'd have no access to the decoder to see if there's any more frames available after the current one.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.