bumptech/glide

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

Open

#1872 aperta il 20 apr 2017

Vedi su GitHub
 (10 commenti) (0 reazioni) (0 assegnatari)Java (6176 fork)batch import
GIFenhancementhelp wanted

Metriche repository

Star
 (35.023 star)
Metriche merge PR
 (Merge medio 4g 10h) (11 PR mergiate in 30 g)

Descrizione

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.

Guida contributor