penfeizhou / APNG4Android

Android animation support for APNG & Animated WebP & Gif & Animated AVIF, High performance
Apache License 2.0
570 stars 75 forks source link

fix Too fast Animation of APNG #214

Closed tudou0digua closed 2 months ago

tudou0digua commented 6 months ago

fix #176 and #183

复现和修复机型:小米11 android 13 1、Glide 加载本地 apng Drawable 2、at com.github.penfeizhou.animation.decode.FrameSeqDecoder.start(FrameSeqDecoder.java:304) at com.github.penfeizhou.animation.FrameAnimationDrawable.innerStart(FrameAnimationDrawable.java:143) at com.github.penfeizhou.animation.FrameAnimationDrawable.setVisible(FrameAnimationDrawable.java:272) at android.widget.ImageView.updateDrawable(ImageView.java:1077) at android.widget.ImageView.setImageDrawable(ImageView.java:604) 触发第一次 FrameSeqDecoder.innerStart 3、at com.github.penfeizhou.animation.decode.FrameSeqDecoder.stop(FrameSeqDecoder.java:392) at com.github.penfeizhou.animation.FrameAnimationDrawable.start(FrameAnimationDrawable.java:130) at com.bumptech.glide.request.target.ImageViewTarget.maybeUpdateAnimatable(ImageViewTarget.java:133) 触发第一次 stop 和 第二次 innerStart 4、at com.github.penfeizhou.animation.decode.FrameSeqDecoder.stop(FrameSeqDecoder.java:392) at com.github.penfeizhou.animation.FrameAnimationDrawable.innerStop(FrameAnimationDrawable.java:164) at com.github.penfeizhou.animation.FrameAnimationDrawable.setVisible(FrameAnimationDrawable.java:275) at android.widget.ImageView.onVisibilityAggregated(ImageView.java:1696) 触发第三次 innerStart (第一次 stop 有个延迟的 innerStop 会清除 state 状态,导致第三次的 innerStart 可以成功) 最终有2次 innerStart 触发, renderTask 的执行周期被加快