diff --git a/CHANGELOG-ZH.md b/CHANGELOG-ZH.md index ebb951a9..80b07f99 100644 --- a/CHANGELOG-ZH.md +++ b/CHANGELOG-ZH.md @@ -2,6 +2,30 @@ > [ Change log in english](https://github.com/lingochamp/FileDownloader/blob/master/CHANGELOG.md) +## Version 1.5.7 + +_2017-06-25_ + +#### 新接口 + +- 支持在`filedownloader.properties`中配置`broadcast.completed`: 决定是否需要在任务下载完成后发送一个完成的广播。 Closes #605 +- 支持接收201的http返回状态码。 Closes #545 +- 为`FileDownloadSerialQueue`支持暂停与继续功能. Closes #547 +- 在FileDownloader内部处理了各类重定向的情况(300、301、302、303、307、308)。 Closes #611 +- 弃用了`FileDownloader#init`取而代之的是`FileDownloader#setup`,现在如果你不需要定制组件,就只需要在使用FileDownloader之前的任意使用调用这个方法就行。 Closes #500 + +> - 如果你使用`broadcast.completed`并且接收任务完成的广播,你需要在AndroidManifest中申明`filedownloader.permission.RECEIVE_STATE`权限以及注册Action为`filedownloader.intent.action.completed`的广播并且使用`FileDownloadBroadcastHandler`来处理接收到的`Intent`。 +> - 现在, 不再使用`FileDownloader#init`, 取而代之的,如果你需要注册你的定制组件,你需要在`Application#onCreate`中调用`FileDownloader.setupOnApplicationOnCreate(application):InitCustomMaker`, 否则你只需要在使用FileDownloader之前的任意时候调用`FileDownloader.setup(Context)`即可。 + +#### 修复 + +- 修复: 修复来`FileDownloadQueueSet`无法处理使wifi-required失效的操作。 感谢 @qtstc +- 修复(output-stream): 修复当提供的output-stream不支持seek时,FileDownloader无法使用的问题。 Closes #622 + +#### 性能与提高 + +- 提高实用性: 覆盖使用不同的Url来复用下载进度的情况(结合`idGenerator`一起使用)。 Closes #617 + ## Version 1.5.6 _2017-06-18_ diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cad30de..348d5bea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,30 @@ > [中文迭代日志](https://github.com/lingochamp/FileDownloader/blob/master/CHANGELOG-ZH.md) +## Version 1.5.7 + +_2017-06-25_ + +#### New Interfaces + +- Support the configuration `broadcast.completed` in `filedownloader.properties`: determine whether need post a broadcast when task is completed. Closes #605 +- Support accepting 201 http status. Closes #545 +- Support pause and resume for the `FileDownloadSerialQueue`. Closes #547 +- Handle the case of redirect(300、301、302、303、307、308) on FileDownloader self. Closes #611 +- Deprecated the `FileDownloader#init` and add the replacer `FileDownloader#setup` to let user invoke anytime before using `Filedownloader`. Closes #500 + +> - If you want to using `broadcast.completed` and receive completed broadcast, you also need to declare `filedownloader.permission.RECEIVE_STATE` permission on the manifest, and register receiver with `filedownloader.intent.action.completed` action name and please using `FileDownloadBroadcastHandler` class to parse the received `Intent`. +> - Now, rather than using `FileDownloader#init`, if you want to register your own customize components for FileDownloader please invoking `FileDownloader.setupOnApplicationOnCreate(application):InitCustomMaker` on the `Application#onCreate`, otherwise you just need invoke `FileDownloader.setup(Context)` anytime before using `FileDownloader`. + +#### Fix + +- Fix: fix `FileDownloadQueueSet` can't handle the case of disable wifi-required. Thanks @qtstc +- Fix(output-stream): fix broken support for output-stream when it don't support seek. Closes #622 + +#### Enhancement + +- Improve Practicability: Cover the case of reusing the downloaded processing with the different url( using with `idGenerator` ). Closes #617 + ## Version 1.5.6 _2017-06-18_ diff --git a/README-zh.md b/README-zh.md index cb6decee..c1ce7f45 100644 --- a/README-zh.md +++ b/README-zh.md @@ -60,28 +60,16 @@ Android 文件下载引擎,稳定、高效、灵活、简单易用 在项目中引用: ```groovy -compile 'com.liulishuo.filedownloader:library:1.5.6' +compile 'com.liulishuo.filedownloader:library:1.5.7' ``` > 如果是eclipse引入jar包参考: [这里](https://github.com/lingochamp/FileDownloader/issues/212#issuecomment-232240415) -#### 全局初始化在`Application.onCreate`中 +#### 全局初始化 -```java -public XXApplication extends Application{ - - ... - @Override - public void onCreate() { - /** - * 仅仅是缓存Application的Context,不耗时 - */ - FileDownloader.init(getApplicationContext); - } +如果你需要注册你的定制组件,你需要在`Application#onCreate`中调用`FileDownloader.setupOnApplicationOnCreate(application):InitCustomMaker`, 否则你只需要在使用FileDownloader之前的任意时候调用`FileDownloader.setup(Context)`即可。 - ... -} -``` +这些初始化方法都十分的简单,不会启动下载服务,一般都是在10ms内完成。 #### 启动单任务下载 @@ -233,8 +221,8 @@ if (parallel) { | 方法名 | 备注 | --- | --- -| init(Context) | 缓存Context,不会启动下载进程 -| init(Context, InitCustomMaker) | 缓存Context,不会启动下载进程;在下载进程启动的时候,会传入定制化组件 +| setup(Context) | 如果不需要注册定制组件,就使用该方法在使用下载引擎前调用,该方法只会缓存Context +| setupOnApplicationOnCreate(application):InitCustomMaker | 如果需要注册定制组件,就在Application#onCreate中调用该方法来注册定制组件以及初始化下载引擎,该方法不会启动下载服务 | create(url:String) | 创建一个下载任务 | start(listener:FileDownloadListener, isSerial:boolean) | 启动是相同监听器的任务,串行/并行启动 | pause(listener:FileDownloadListener) | 暂停启动相同监听器的任务 @@ -418,7 +406,9 @@ blockComplete -> completed | download.min-progress-time | 最小缓冲时间,用于判定是否是时候将缓冲区中进度同步到数据库,以及是否是时候要确保下缓存区的数据都已经写文件。值越小,更新会越频繁,下载速度会越慢,但是应对进程被无法预料的情况杀死时会更加安全 | 2000 | download.max-network-thread-count | 用于同时下载的最大网络线程数, 区间[1, 12] | 3 | file.non-pre-allocation | 是否不需要在开始下载的时候,预申请整个文件的大小(`content-length`) | false +| broadcast.completed | 是否需要在任务下载完成后发送一个完成的广播 | false +> 如果你使用`broadcast.completed`并且接收任务完成的广播,你需要在AndroidManifest中申明`filedownloader.permission.RECEIVE_STATE`权限以及注册Action为`filedownloader.intent.action.completed`的广播并且使用`FileDownloadBroadcastHandler`来处理接收到的`Intent`。 III. 异常处理 diff --git a/README.md b/README.md index 1f21cd8d..cba34738 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ FileDownloader is installed by adding the following dependency to your `build.gr ```groovy dependencies { - compile 'com.liulishuo.filedownloader:library:1.5.6' + compile 'com.liulishuo.filedownloader:library:1.5.7' } ``` diff --git a/gradle.properties b/gradle.properties index de328a8f..3baa601e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ -VERSION_NAME=1.5.6 -VERSION_CODE=47 +VERSION_NAME=1.5.7 +VERSION_CODE=48 BUILD_TOOLS_VERSION=25.0.0 COMPILE_SDK_VERSION=25