bumptech/glide

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

Open

#1 872 ouverte le 20 avr. 2017

Voir sur GitHub
 (10 commentaires) (0 réactions) (0 assignés)Java (6 176 forks)batch import
GIFenhancementhelp wanted

Métriques du dépôt

Stars
 (35 023 stars)
Métriques de merge PR
 (Merge moyen 4j 10h) (11 PRs mergées en 30 j)

Description

Glide Version: 3.8.0-SNAPSHOT

Glide load line / GlideModule (if any) / list Adapter code (if any):

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

    @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.

Guide contributeur