bumptech/glide
在 GitHub 查看Is there is any way to listen for the current GIF Frame while playing GIF?
Open
#2,524 创建于 2017年10月27日
GIFenhancementhelp wanted
仓库指标
- Star
- (35,023 star)
- PR 合并指标
- (平均合并 4天 10小时) (30 天内合并 11 个 PR)
描述
I am using this code in Fresco. I want to switch to Glide
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setUri(uri)
.setAutoPlayAnimations(true)
.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
((SimpleDraweeView) mGIFView).setAspectRatio((float) imageInfo.getWidth() / imageInfo.getHeight());
if (animatable != null && animatable instanceof AnimatedDrawable2) {
((AnimatedDrawable2) animatable).setAnimationListener(
new AnimationListener() {
@Override
public void onAnimationStart(AnimatedDrawable2 drawable) {
}
@Override
public void onAnimationStop(AnimatedDrawable2 drawable) {
}
@Override
public void onAnimationReset(AnimatedDrawable2 drawable) {
}
@Override
public void onAnimationRepeat(AnimatedDrawable2 drawable) {
}
@Override
public void onAnimationFrame(AnimatedDrawable2 drawable, int frameNumber) {
//Current frame
}
});
}
}
@Override
public void onFailure(String id, Throwable throwable) {
super.onFailure(id, throwable);
Log.e("failed", throwable.getLocalizedMessage());
}
}).build();