Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

Commit c850980

Browse files
committed
docs: readme 和 CHANGELOG 文档更新
1 parent b93a4fa commit c850980

File tree

3 files changed

+87
-15
lines changed

3 files changed

+87
-15
lines changed

CHANGELOG.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
# SVGAPlayer-Android CHANGELOG (2021-03-02)
22

3-
## [2.6.0](2021-08-18)
3+
## [2.6.1] (2021-08-30)
4+
5+
### Bug Fixes
6+
7+
* fix(SVGAImageView): SVGAImageView sets autoPlay to false, the sound will still be played automatically.
8+
* fix(SVGAParser): When the type of SVGACache is set to Type.FILE, the zip compressed svga cannot be displayed.
9+
* fix(SVGACanvasDrawer): When svga is drawn, the repeated setting of alpha and color causes the screen to display abnormally.
10+
11+
12+
## [2.6.0](https://github.com/svga/SVGAPlayer-Android/compare/2.5.15...2.6.0) (2021-08-18)
413

514
## Features
615

7-
* feat(SVGASoundManager): Added SVGASoundManager to control SVGA audio, you need to manually call the init method to initialize, otherwise follow the default audio loading logic.
8-
* feat(SVGAParser): SVGAParser#decodeFromAssets and SVGAParser#decodeFromURL add a parameter, which can be null. It is used to send the audio file back to the developer. The developer can control the audio playback by himself. If this parameter is set, the audio part will not be processed internally.
9-
* feat(SVGAParser): Add aliases to the log section to facilitate developers to troubleshoot problems
10-
* feat(SVGACache): Open cache cleaning method: SVGACache#clearCache().
16+
* feat(SVGASoundManager): Added SVGASoundManager to control SVGA audio, you need to manually call the init method to initialize, otherwise follow the default audio loading logic.([f29563e](https://github.com/svga/SVGAPlayer-Android/commit/f29563e))
17+
* feat(SVGASoundManager): SVGA volume control. ([010b19c](https://github.com/svga/SVGAPlayer-Android/commit/010b19c))
18+
* feat(SVGAParser): SVGAParser#decodeFromAssets and SVGAParser#decodeFromURL add a parameter, which can be null. It is used to send the audio file back to the developer. The developer can control the audio playback by himself. If this parameter is set, the audio part will not be processed internally.([8437fd7](https://github.com/svga/SVGAPlayer-Android/commit/8437fd7))
19+
* feat(SVGAParser): Add aliases to the log section to facilitate developers to troubleshoot problems([977059e](https://github.com/svga/SVGAPlayer-Android/commit/977059e))
20+
* feat(SVGACache): Open cache cleaning method: SVGACache#clearCache().([a8d926e](https://github.com/svga/SVGAPlayer-Android/commit/a8d926e))
1121

1222
### Bug Fixes
1323

14-
* refactor(ILogger): Remove redundant api.
15-
* fix(SoundPool): Added SVGASoundManager to solve the problem that the internal SoundPool does not load audio occasionally.
16-
* fix(SVGAParser): Zip Path Traversal Vulnerability.
17-
* fix(SVGAParser): link reuse problem.
24+
* refactor(ILogger): Remove redundant api.([3f4ef1a](https://github.com/svga/SVGAPlayer-Android/commit/3f4ef1a))
25+
* fix(SVGAParser): Zip Path Traversal Vulnerability.([000aa61](https://github.com/svga/SVGAPlayer-Android/commit/000aa61))
26+
* fix(SVGAParser): link reuse problem.([b01174e](https://github.com/svga/SVGAPlayer-Android/commit/b01174e))
27+
1828

1929
## [2.5.15](https://github.com/svga/SVGAPlayer-Android/compare/2.5.14...2.5.15) (2021-03-02)
2030

readme.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ How many times should animation loops. `0` means Infinity Loop.
101101

102102
#### ~~clearsAfterStop: Boolean~~
103103

104-
Defaults to `true`.When the animation is finished, whether to clear the canvas and the internal data of SVGAVideoEntity.
104+
Defaults to `false`.When the animation is finished, whether to clear the canvas and the internal data of SVGAVideoEntity.
105105
It is no longer recommended. Developers can control resource release through clearAfterDetached, or manually control resource release through SVGAVideoEntity#clear
106106

107107
#### clearsAfterDetached: Boolean
@@ -116,7 +116,7 @@ Defaults to `Forward`. Could be `Forward`, `Backward`, `Clear`.
116116

117117
`Backward` means animation will pause on first frame after finished.
118118

119-
'Clear' after the animation is played, all the canvas content is cleared, but it is only the canvas and does not involve the internal data of SVGAVideoEntity.
119+
`Clear` after the animation is played, all the canvas content is cleared, but it is only the canvas and does not involve the internal data of SVGAVideoEntity.
120120

121121
### Using code
122122

@@ -208,11 +208,42 @@ Updated the internal log output, which can be managed and controlled through SVG
208208
Set whether the log is enabled through the `setLogEnabled` method
209209
Inject a custom ILogger implementation class through the `injectSVGALoggerImp` method
210210

211+
212+
```kotlin
213+
214+
// By default, SVGA will not output any log, so you need to manually set it to true
215+
SVGALogger.setLogEnabled(true)
216+
217+
// If you want to collect the output log of SVGA, you can obtain it in the following way
218+
SVGALogger.injectSVGALoggerImp(object: ILogger {
219+
// Implement related interfaces to receive log
220+
})
221+
```
222+
211223
### SVGASoundManager
212224
Added SVGASoundManager to control SVGA audio, you need to manually call the init method to initialize, otherwise follow the default audio loading logic.
213225
In addition, through SVGASoundManager#setVolume, you can control the volume of SVGA playback. The range is [0f, 1f]. By default, the volume of all SVGA playbacks is controlled.
214226
And this method can set a second default parameter: SVGAVideoEntity, which means that only the current SVGA volume is controlled, and the volume of other SVGAs remains unchanged.
215227

228+
```kotlin
229+
// Initialize the audio manager for easy management of audio playback
230+
// If it is not initialized, the audio will be loaded in the original way by default
231+
SVGASoundManager.init()
232+
233+
// Release audio resources
234+
SVGASoundManager.release()
235+
236+
/**
237+
* Set the volume level, entity is null by default
238+
* When entity is null, it controls the volume of all audio loaded through SVGASoundManager, which includes the currently playing audio and subsequent loaded audio
239+
* When entity is not null, only the SVGA audio volume of the instance is controlled, and the others are not affected
240+
*
241+
* @param volume The value range is [0f, 1f]
242+
* @param entity That is, the instance of SVGAParser callback
243+
*/
244+
SVGASoundManager.setVolume(volume, entity)
245+
```
246+
216247
## Features
217248

218249
Here are many feature samples.

readme.zh.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ SVGAPlayer 可以从本地 `assets` 目录,或者远端服务器上加载动
8787
默认为 `0`,设置动画的循环次数,0 表示无限循环。
8888

8989
#### ~~clearsAfterStop: Boolean~~
90-
默认为 `true`,当动画播放完成后,是否清空画布,以及 SVGAVideoEntity 内部数据。
90+
默认为 `false`,当动画播放完成后,是否清空画布,以及 SVGAVideoEntity 内部数据。
9191
不再推荐使用,开发者可以通过 clearAfterDetached 控制资源释放,或者手动通过 SVGAVideoEntity#clear 控制资源释放
9292

9393
#### clearsAfterDetached: Boolean
@@ -189,15 +189,46 @@ HttpResponseCache.install(cacheDir, 1024 * 1024 * 128)
189189
```
190190

191191
### SVGALogger
192-
更新了内部 log 输出,可通过 SVGALogger 去管理和控制,默认是未启用 log 输出,开发者们也可以实现 ILogger 接口,做到外部捕获收集 log,方便排查问题
193-
通过 `setLogEnabled` 方法设置日志是否开启
194-
通过 `injectSVGALoggerImp` 方法注入自定义 ILogger 实现类
192+
更新了内部 log 输出,可通过 SVGALogger 去管理和控制,默认是未启用 log 输出,开发者们也可以实现 ILogger 接口,做到外部捕获收集 log,方便排查问题。
193+
通过 `setLogEnabled` 方法设置日志是否开启。
194+
通过 `injectSVGALoggerImp` 方法注入自定义 ILogger 实现类。
195+
196+
```kotlin
197+
198+
// 默认情况下,SVGA 内部不会输出任何 log,所以需要手动设置为 true
199+
SVGALogger.setLogEnabled(true)
200+
201+
// 如果希望收集 SVGA 内部输出的日志,则可通过下面方式获取
202+
SVGALogger.injectSVGALoggerImp(object: ILogger {
203+
// 实现相关接口进行接收 log
204+
})
205+
```
195206

196207
### SVGASoundManager
197208
新增 SVGASoundManager 控制 SVGA 音频,需要手动调用 init 方法进行初始化,否则按照默认的音频加载逻辑。
198209
另外通过 SVGASoundManager#setVolume 可控制 SVGA 播放时的音量大小,范围值在 [0f, 1f],默认控制所有 SVGA 播放时的音量,
199210
而且该方法可设置第二个可缺省参数:SVGAVideoEntity,表示仅控制当前 SVGA 的音量大小,其他 SVGA 的音量保持不变。
200211

212+
```kotlin
213+
// 初始化音频管理器,方便管理音频播放
214+
// 如果没有初始化,则默认按照原有方式加载音频
215+
SVGASoundManager.init()
216+
217+
// 释放音频资源
218+
SVGASoundManager.release()
219+
220+
/**
221+
* 设置音量大小,entity 默认为空
222+
* 当 entity 为空,则控制所有通过 SVGASoundManager 加载的音频音量大小,即包括当前正在播放的音频以及后续加载的音频
223+
* 当 entity 不为空,则仅控制该实例的 SVGA 音频音量大小,其他则不受影响
224+
*
225+
* @param volume 取值范围为 [0f, 1f]
226+
* @param entity 即 SVGAParser 回调回来的实例
227+
*/
228+
SVGASoundManager.setVolume(volume, entity)
229+
```
230+
231+
201232
## 功能示例
202233

203234
* [使用位图替换指定元素。](https://github.com/yyued/SVGAPlayer-Android/wiki/Dynamic-Image)

0 commit comments

Comments
 (0)