-
Notifications
You must be signed in to change notification settings - Fork 6.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need Callbacks for when a GifDrawable with an animation finishes it's last loop #1872
Comments
How about overriding |
Anyway, if you're up to it a PR would be welcome as well that adds this functionality. |
I'm not sure stop() is necessarily the right way though. It would trigger even if the animation was manually stopped. I'm looking to trigger the next one only when it runs till completion. |
So, i've managed to do this, however, what i've seen is that even with the .dontAnimate() flag set, i'm seeing the image being cleared out visually first, and then it animations. This is an issue for me because i'm first loading the initial frame of my images:
Then i'm animating the first one, and when it stops, the next, and so forth:
I'm curious if there's a way for me to disable the clearing of the ImageView prior to starting the animation. |
Each time you call into() into a View or Target, the previous load is cancelled and the View/Target is cleared. Your simplest option is probably to use the thumbnail() API to load the first frame. You could also use a view switcher containing two ImageViews and load the first frame into one view and the GIF into the other. |
I solved this by setting the existing drawable in the ImageView as the placeholder, and the flicker is now gone. Thanks. I'll look into a PR for this, but i have to get it approved before i can contribute code (sigh) |
This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions. |
Glide 4.7 : public GifDrawable(Context context, GifDecoder gifDecoder, Transformation frameTransformation, int targetFrameWidth, int targetFrameHeight, Bitmap firstFrame) { GifDrawable: |
@mattinger @TWiStErRob Can you explain how you did this? I too need a callback for when the gif finishes and I'm trying to extend GifDrawable so I can override the stop() method. However I can't seem to be able to create an instance of my class, that extends GifDrawable, out of the GifDrawable glide returns with the onResourceReady method. Can you explain how you accomplished that? |
|
Glide Version: 3.8.0-SNAPSHOT
Glide load line /
GlideModule
(if any) / list Adapter code (if any):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
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.
The text was updated successfully, but these errors were encountered: