Is there any way that we can pause gif? and then resume it again.
Glide Version: 3.7.1
Integration libraries: No
Device/Android Version: Galaxy s6
Yes.
Kindly can you let me know what it is exactly? @TWiStErRob
jk, in seriousness: you can get the drawable from ImageView and use a cast to Animatable or GifDrawable directly to control it.
Thank you. Will try it.
@FahidMirza did you find the solution
@TWiStErRob can you explain with bit of code?
Drawable drawable = imageView.getDrawable();
if (drawable instanceof Animatable) {
((Animatable) drawable).stop();
}
@sjudd Your code works well for stop(). Is there any chance to pause()
stop is equivalent to pause (at least in v4). If you want to restart the loop when resuming you need to use startFromFirstFrame() instead of start().
@sjudd While using stop, it goes to first frame. I need to pause at the current frame.
@sjudd imageView.getDrawable() always is null :/
@Hitexroid it will be null until the asynchronous load finishes.
Right but i forgot AsGif
Drawable drawable = imageView.getDrawable(); if (drawable instanceof Animatable) { ((Animatable) drawable).stop(); }
This is absolutely best answer for that problem. It works for me thanks.
start will make animation to start from first frame.. is there anyway to resume from last drawn frame?
@yogeshkalwar sounds like that should be the behaviour: https://github.com/bumptech/glide/issues/1916#issuecomment-361016890
Most helpful comment