#Glide
Reads frame data from a GIF image source and decodes it into indvidual frames per animation purposes. Image data can be read from either and Inputstream source or byte[].
a. fixed All files in the gif folder.
b. Glide.java registry support BUCKET_GIF
c. RequestManager.java add asGif() method.
d. So far, we can obtain the frame of the Gif.
a. module:library create path: com.bumptech.glide=>resource=>gif=>drawableability
b. Create RootShapeElement.java support callback
c. Create DraweeView.java support draw canvas by Element;
** (The overall process is as follows: **
** set "animatable", execute "animatable.onstart()" to enter "GifDrawable.onStart()", start to obtain "Frame" of the first frame, and "GifFrameLoader" starts the loop. The callback of the second frame is "GifDrawable.onFrameReady()".**
"DrawableView" triggers "drawToCanvas" after "invalidatedrawable" is invoked, To support ScaleType, an empty PixelMap is create, and the GifDrawable is used to dra the Gif content. Finally, the DraweeView performs transformation and displays the final effect.)
** The performance consumption of GIF loading is huge, so we should create the GIF loading at the right time. Therfore, slice and mobility life cycle managements added. When the "Glide.with(Ability or AbilitySlice)" is used, we obtain the ILifeCyle and monitor its lifecycle. When the ILifeCycle enters the BACKGround state, we actively stop the GIF work and start the GIF work when the ILifeCycle enters the INACTIVE state.**
** The specific task is to use RequestManagerFragment to bind the ActivityFragmentLifeCycle. Then RequestManagerFragment obtains the life cycle of the ActivitySlice and listens to the lifecycle.**
a. load gif from network
java
DraweeView image = (DraweeView) findComponentById(ResourceTable.Id_image);
Glide.with(this)
.asGif()
.load("https://img.blog.csdnimg.cn/2019120901303086.gif);
.into(image);
b. load gif from native.
java
DraweeView image = (DraweeView) findComponentById(ResourceTable.Id_drawview);
Glide.with(this)
.asGif()
.load(ResourceTable.Media_happygirl);
.into(draweeView);
Important Note:
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。