Closed punxch closed 5 years ago
请重新引入implementation 'com.yuyashuai.frameanimation:frameanimation:2.1.0
请重新引入
implementation 'com.yuyashuai.frameanimation:frameanimation:2.1.0
@yuyashuai 谢谢,这个问题解决啦。不过我注意到还有一个类似的问题,似乎也是和lock有关。
在第一次启动的时候,onProgress不能正常回调完,走到一半就停住了。
2019-07-11 11:14:57.202 30677-30746/com.example.demo E/VoiceFragment: onProgress:[2/26]
2019-07-11 11:14:57.244 30677-30746/com.example.demo E/VoiceFragment: onProgress:[3/26]
2019-07-11 11:14:57.287 30677-30746/com.example.demo E/VoiceFragment: onProgress:[4/26]
2019-07-11 11:14:57.331 30677-30746/com.example.demo E/VoiceFragment: onProgress:[5/26]
2019-07-11 11:14:57.373 30677-30746/com.example.demo E/VoiceFragment: onProgress:[6/26]
2019-07-11 11:14:57.416 30677-30746/com.example.demo E/VoiceFragment: onProgress:[7/26]
2019-07-11 11:14:57.458 30677-30746/com.example.demo E/VoiceFragment: onProgress:[8/26]
2019-07-11 11:14:57.501 30677-30746/com.example.demo E/VoiceFragment: onProgress:[9/26]
2019-07-11 11:14:57.545 30677-30746/com.example.demo E/VoiceFragment: onProgress:[10/26]
2019-07-11 11:14:57.587 30677-30746/com.example.demo E/VoiceFragment: onProgress:[11/26]
2019-07-11 11:14:57.630 30677-30746/com.example.demo E/VoiceFragment: onProgress:[12/26]
2019-07-11 11:14:57.672 30677-30746/com.example.demo E/VoiceFragment: onProgress:[13/26]
2019-07-11 11:14:57.715 30677-30746/com.example.demo E/VoiceFragment: onProgress:[14/26]
2019-07-11 11:14:57.758 30677-30746/com.example.demo E/VoiceFragment: onProgress:[15/26]
2019-07-11 11:14:57.801 30677-30746/com.example.demo E/VoiceFragment: onProgress:[16/26]
2019-07-11 11:14:59.427 23941-23949/? E/ReloadingLock: Finalizing LOCKED Token[shortcuts 2019-07-11 11:14:51.633]
第二次启动Fragment又能正常工作了。
2019-07-11 11:19:59.311 30677-30875/com.example.demo E/VoiceFragment: onProgress:[1/26]
2019-07-11 11:19:59.353 30677-30875/com.example.demo E/VoiceFragment: onProgress:[2/26]
2019-07-11 11:19:59.396 30677-30875/com.example.demo E/VoiceFragment: onProgress:[3/26]
2019-07-11 11:19:59.439 30677-30875/com.example.demo E/VoiceFragment: onProgress:[4/26]
2019-07-11 11:19:59.481 30677-30875/com.example.demo E/VoiceFragment: onProgress:[5/26]
2019-07-11 11:19:59.524 30677-30875/com.example.demo E/VoiceFragment: onProgress:[6/26]
2019-07-11 11:19:59.567 30677-30875/com.example.demo E/VoiceFragment: onProgress:[7/26]
2019-07-11 11:19:59.610 30677-30875/com.example.demo E/VoiceFragment: onProgress:[8/26]
2019-07-11 11:19:59.652 30677-30875/com.example.demo E/VoiceFragment: onProgress:[9/26]
2019-07-11 11:19:59.695 30677-30875/com.example.demo E/VoiceFragment: onProgress:[10/26]
2019-07-11 11:19:59.737 30677-30875/com.example.demo E/VoiceFragment: onProgress:[11/26]
2019-07-11 11:19:59.780 30677-30875/com.example.demo E/VoiceFragment: onProgress:[12/26]
2019-07-11 11:19:59.823 30677-30875/com.example.demo E/VoiceFragment: onProgress:[13/26]
2019-07-11 11:19:59.866 30677-30875/com.example.demo E/VoiceFragment: onProgress:[14/26]
2019-07-11 11:19:59.908 30677-30875/com.example.demo E/VoiceFragment: onProgress:[15/26]
2019-07-11 11:19:59.952 30677-30875/com.example.demo E/VoiceFragment: onProgress:[16/26]
2019-07-11 11:19:59.994 30677-30875/com.example.demo E/VoiceFragment: onProgress:[17/26]
2019-07-11 11:20:00.038 30677-30875/com.example.demo E/VoiceFragment: onProgress:[18/26]
2019-07-11 11:20:00.080 30677-30875/com.example.demo E/VoiceFragment: onProgress:[19/26]
2019-07-11 11:20:00.122 30677-30875/com.example.demo E/VoiceFragment: onProgress:[20/26]
2019-07-11 11:20:00.165 30677-30875/com.example.demo E/VoiceFragment: onProgress:[21/26]
2019-07-11 11:20:00.207 30677-30875/com.example.demo E/VoiceFragment: onProgress:[22/26]
2019-07-11 11:20:00.249 30677-30875/com.example.demo E/VoiceFragment: onProgress:[23/26]
2019-07-11 11:20:00.291 30677-30875/com.example.demo E/VoiceFragment: onProgress:[24/26]
2019-07-11 11:20:00.335 30677-30875/com.example.demo E/VoiceFragment: onProgress:[25/26]
另外我注意到序号是从1开始,到totalFrames-1
结束,看起像是少了一次回调。
修改了另一个 bug,然后没有复现出来上面的问题,更新试下。
implementation 'com.yuyashuai.frameanimation:frameanimation:2.1.1
@yuyashuai
问题还是存在,建了一个简单工程,用于复现上面的问题。你可以试试
https://github.com/punxch/TestFrameAnimation
在onViewCreated
中直接调用的话,可能会存在 TextureView not available的情况,可以在onSurfaceTextureAvailable
的回调中调用。后面会把这个集成进去。
wave_view.surfaceTextureListener=object :TextureView.SurfaceTextureListener {
override fun onSurfaceTextureSizeChanged(p0: SurfaceTexture?, p1: Int, p2: Int) {
}
override fun onSurfaceTextureUpdated(p0: SurfaceTexture?) {
}
override fun onSurfaceTextureDestroyed(p0: SurfaceTexture?): Boolean {
return true
}
override fun onSurfaceTextureAvailable(p0: SurfaceTexture?, p1: Int, p2: Int) {
wave_view.playAnimationFromAssets("voice_entering_wait")
}
}
另外你好像要在最后一帧的时候播放另一个动画,但是如果在最后一帧的瞬间调用播放会无效(嗯..后面有时间也会改下),可以在播放的时候把两个动画合为一个动画。
val paths=mutableListOf<String>()
.apply {
addAll(Util.getPathList(context!!,"voice_entering_wait"))
addAll(Util.getPathList(context!!,"voice_wait"))
}.map {
FrameAnimation.PathData(it,FrameAnimation.PATH_ASSETS)
}
wave_view.playAnimation(paths.toMutableList(),0)
受教了,非常感谢!
机型:Google Pixel一代 系统:8.1.0 前置条件:设置播放模式
FrameAnimation.RepeatMode.ONCE
表现:动画提前结束,出现surface报错。 出错日志: