koral-- / android-gif-drawable

Views and Drawable for displaying animated GIFs on Android
Other
9.56k stars 1.78k forks source link

Callback when gif is loaded #246

Open youfacepalm opened 8 years ago

youfacepalm commented 8 years ago

Hey guys. Thanks for the great library. It would be great if there is a way to get a callback once the gif is loaded into a GifImageView.

koral-- commented 8 years ago

What exactly do you mean by loaded? First frame is drawn?

youfacepalm commented 8 years ago

Yes. For example if I set a GifImageView to cover the entire screen with 'scaleType:centerCrop' it takes about 600ms for the first frame to appear (depending on the device). I thought having a listener of some kind may help in this scenario.

In my project I use GifImageView in splash screen. I needed to animate in my logo once the gif started playing. Currently I am hard coding the animation delay to 600ms which seems inconsistent across various devices.

RNOVOSELOV commented 8 years ago

Hey, it would be nice to get a callback when finished playing (when the last frame is drawn) thanks

koral-- commented 8 years ago

@RNOVOSELOV callback when animation finished playing is already available. See sample project: https://github.com/koral--/android-gif-drawable-sample/blob/9840f2eab0d568f39c3c92d12121d52ce3391568/sample/src/main/java/pl/droidsonroids/gif/sample/AnimationControlFragment.java

RNOVOSELOV commented 8 years ago

@koral-- Oy, thanks!!!