I have got GifImageView in xml and this is in code on init:
var gifDrawable = GifDrawable(resources, R.drawable.pig_animation) - get gifDrawable from resources
gif.setImageDrawable(gifDrawable) - set drawable to gifImageView with id "gif"
After button click:
gif.visibility = View.VISIBLE
gifDrawable.start()
val delay = gifDrawable.duration.toLong() - i get a time of gif animation to play exactly one loop and show loader during this time
AFTER click, button is not enabled, so I am calling clickListener again exactly after the gif duration time. However, gif slows down and stops in time of this fixed duration, but just in the middle of gif playing. And every time it slows more and more. How can I use recycle, or somehow free resources to remove slowing down of gif?
I have got GifImageView in xml and this is in code on init: var gifDrawable = GifDrawable(resources, R.drawable.pig_animation) - get gifDrawable from resources gif.setImageDrawable(gifDrawable) - set drawable to gifImageView with id "gif"
After button click:
gif.visibility = View.VISIBLE gifDrawable.start()
val delay = gifDrawable.duration.toLong() - i get a time of gif animation to play exactly one loop and show loader during this time
postDelayed({ gifDrawable.stop() gif.visibility = View.GONE ... }, delay)
AFTER click, button is not enabled, so I am calling clickListener again exactly after the gif duration time. However, gif slows down and stops in time of this fixed duration, but just in the middle of gif playing. And every time it slows more and more. How can I use recycle, or somehow free resources to remove slowing down of gif?