diff --git a/CHANGELOG-ZH.md b/CHANGELOG-ZH.md index d0bc5afc..2036eaa8 100644 --- a/CHANGELOG-ZH.md +++ b/CHANGELOG-ZH.md @@ -2,6 +2,20 @@ > [ Change log in english](https://github.com/lingochamp/FileDownloader/blob/master/CHANGELOG.md) +## Version 1.0.1 + +_2016-09-05_ + +#### 新接口 + +> 如果你之前有使用现在已经被申明弃用的方法`BaseDownloadTask#ready()`, 只需要简单的将它迁移为:`BaseDownloadTask#asInQueueTask():InQueueTask`并且调用`InQueueTask#enqueue()`。 + +- 添加`BaseDownloadTask#asInQueueTask():InQueueTask`并申明弃用`BaseDownloadTask#ready()`: 申明当前任务是队列任务,并且可以通过`InQueueTask#enqueue()`将当前任务放入全局队列以便于启动队列任务的时候,能被队列收编执行。`InQueueTask#enqueue()`中的操作与`BaseDownloadTask#ready()`相同, 我们通过这个方式封装`ready()`是为了让你更加清晰的了解: 只有当前任务是队列任务,才需要调用该方法;如果当前任务不是队列任务,而却调用了这个方法,你将会收到一个异常(具体异常的原因可以移步到`DownloadTask#start`报的异常信息进行了解). + +#### 修复 + +- 修复: 当有使用相同`listener`对象的多个孤立任务与队列任务在不同的线程中同时被启动时(后),有可能会遇到IllegalStateException异常的问题. Closes #282 . + ## Version 1.0.0 _2016-08-21_ diff --git a/CHANGELOG.md b/CHANGELOG.md index 04aa7ea0..2269e1ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,20 @@ > [中文迭代日志](https://github.com/lingochamp/FileDownloader/blob/master/CHANGELOG-ZH.md) +## Version 1.0.1 + +_2016-09-05_ + +#### New Interfaces + +> If you used `BaseDownloadTask#ready()` which is a deprecated method now, just migrate it to `BaseDownloadTask#asInQueueTask():InQueueTask` and `InQueueTask#enqueue()`. + +- Add `BaseDownloadTask#asInQueueTask():InQueueTask` and Deprecated `BaseDownloadTask#ready()`: Declare the task is a queue task, what will be assembled by a queue which makes up of the same `listener` task and there is a method `InQueueTask#enqueue()` to enqueue this task to the global queue to ready for being assembled by the queue. The operation of method `InQueueTask#enqueue()` is the same to the Deprecated method `BaseDownloadTask#ready()`, we wrap the `ready()` method in this way just want you to know clearly: Only if the task belongs to a queue, you need to invoke this method otherwise if this task is an isolated task but you invoke this method, it's wrong and you will receive an exception(More detail reason please move to the exception thrown in `DownloadTask#start`). + +#### Fix + +- Fix: Maybe occur an IllegalStateException when there are several isolated tasks and queues with the same `listener` object, and they are started in the different thread simultaneously. Closes #282 . + ## Version 1.0.0 _2016-08-21_ diff --git a/README-zh.md b/README-zh.md index a5a2e0c0..d5f3faee 100644 --- a/README-zh.md +++ b/README-zh.md @@ -63,7 +63,7 @@ Android 文件下载引擎,稳定、高效、简单易用 在项目中引用: ``` -compile 'com.liulishuo.filedownloader:library:1.0.0' +compile 'com.liulishuo.filedownloader:library:1.0.1' ``` > 如果是eclipse引入jar包参考: [这里](https://github.com/lingochamp/FileDownloader/issues/212#issuecomment-232240415) @@ -179,7 +179,8 @@ final FileDownloadListener queueTarget = new FileDownloadListener() { // FileDownloader.getImpl().create(url) // .setCallbackProgressTimes(0) // 由于是队列任务, 这里是我们假设了现在不需要每个任务都回调`FileDownloadListener#progress`, 我们只关系每个任务是否完成, 所以这里这样设置可以很有效的减少ipc. // .setListener(queueTarget) -// .ready(); +// .asInQueueTask() +// .enqueue(); //} //if(serial){ @@ -285,8 +286,8 @@ if (parallel) { | addHeader(line:String) | 添加自定义的请求头参数,需要注意的是内部为了断点续传,在判断断点续传有效时会自动添加上(`If-Match`与`Range`参数),请勿重复添加导致400或其他错误 | setMinIntervalUpdateSpeed(minIntervalUpdateSpeedMs:int) | 设置下载中刷新下载速度的最小间隔 | removeAllHeaders(name:String) | 删除由自定义添加上去请求参数为`{name}`的所有键对 -| ready(void) | 用于队列下载的单任务的结束符(见上面:启动多任务下载的案例) -| start(void) | 启动下载任务 +| asInQueueTask(void):InQueueTask | 申明该任务将会是队列任务中的一个任务,并且转化为`InQueueTask`,之后可以调用`InQueueTask#enqueue`将该任务入队以便于接下来启动队列任务时,可以将该任务收编到队列中 +| start(void) | 启动孤立的下载任务 | pause(void) | 暂停下载任务(也可以理解为停止下载,但是在start的时候默认会断点续传) | getId(void):int | 获取唯一Id(内部通过url与path生成) | getUrl(void):String | 获取下载连接 diff --git a/README.md b/README.md index 3aa63e4c..1376d39d 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.0.0' + compile 'com.liulishuo.filedownloader:library:1.0.1' } ``` diff --git a/gradle.properties b/gradle.properties index 514bd306..cff8d880 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ -VERSION_NAME=1.0.0 -VERSION_CODE=27 +VERSION_NAME=1.0.1 +VERSION_CODE=28 BUILD_TOOLS_VERSION=24.0.2 COMPILE_SDK_VERSION=24 diff --git a/library/src/main/java/com/liulishuo/filedownloader/BaseDownloadTask.java b/library/src/main/java/com/liulishuo/filedownloader/BaseDownloadTask.java index 4facf64a..eb5d000c 100644 --- a/library/src/main/java/com/liulishuo/filedownloader/BaseDownloadTask.java +++ b/library/src/main/java/com/liulishuo/filedownloader/BaseDownloadTask.java @@ -529,7 +529,7 @@ interface InQueueTask { * Enqueue the task to the global queue, what is the only way for the task to ready to be * assembled by a queue. *

- * Note: Only if the task will belong to a queue, you need invoke this + * Note: Only if this task belongs to a queue, you need to invoke this * method. * * @return the download task identify.