+
+
\ No newline at end of file
diff --git a/.idea/dictionaries/AriaL.xml b/.idea/dictionaries/AriaL.xml
new file mode 100644
index 00000000..5ba04945
--- /dev/null
+++ b/.idea/dictionaries/AriaL.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index ded83e3e..e12fe0b2 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -5,7 +5,7 @@
-
+
diff --git a/downloadutil/build.gradle b/downloadutil/build.gradle
index 69b014c7..68eb9ad5 100644
--- a/downloadutil/build.gradle
+++ b/downloadutil/build.gradle
@@ -27,7 +27,7 @@ dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}
-apply from: 'jcenter.gradle'
+//apply from: 'jcenter.gradle'
// build a jar with source files
//task sourcesJar(type: Jar) {
diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/DownloadManager.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/DownloadManager.java
index 07f3acd4..2a550423 100644
--- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/DownloadManager.java
+++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/DownloadManager.java
@@ -157,13 +157,4 @@ public class DownloadManager {
}
mCommands.clear();
}
-
- /**
- * 设置下载器
- *
- * @param queue {@link ITaskQueue}
- */
- public void setDownloadQueue(ITaskQueue queue) {
- mTaskQueue = queue;
- }
}
\ No newline at end of file
diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/DownloadTaskQueue.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/DownloadTaskQueue.java
index 04e66c8b..9fab5801 100644
--- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/DownloadTaskQueue.java
+++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/DownloadTaskQueue.java
@@ -111,6 +111,10 @@ public class DownloadTaskQueue implements ITaskQueue {
}
}
+ @Override public int size() {
+ return mExecutePool.size();
+ }
+
@Override public void setDownloadNum(int downloadNum) {
mExecutePool.setDownloadNum(downloadNum);
}
diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/ITaskQueue.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/ITaskQueue.java
index 0b832433..327085b7 100644
--- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/ITaskQueue.java
+++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/ITaskQueue.java
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-
package com.arialyy.downloadutil.core.queue;
import com.arialyy.downloadutil.core.DownloadEntity;
@@ -27,6 +26,11 @@ import com.arialyy.downloadutil.core.task.Task;
*/
public interface ITaskQueue extends IDownloader {
+ /**
+ * 任务池队列大小
+ */
+ public int size();
+
/**
* 设置下载任务数
*
diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/scheduler/DownloadSchedulers.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/scheduler/DownloadSchedulers.java
index 9737b495..889c3911 100644
--- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/scheduler/DownloadSchedulers.java
+++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/scheduler/DownloadSchedulers.java
@@ -20,6 +20,7 @@ package com.arialyy.downloadutil.core.scheduler;
import android.os.Message;
import android.util.Log;
import com.arialyy.downloadutil.core.DownloadEntity;
+import com.arialyy.downloadutil.core.queue.ITaskQueue;
import com.arialyy.downloadutil.core.task.Task;
import com.arialyy.downloadutil.core.queue.pool.ExecutePool;
import com.arialyy.downloadutil.core.queue.DownloadTaskQueue;
@@ -65,10 +66,10 @@ public class DownloadSchedulers implements IDownloadSchedulers {
/**
* 下载器任务监听
*/
- OnTargetListener mTargetListener;
- DownloadTaskQueue mQueue;
+ OnTargetListener mTargetListener;
+ ITaskQueue mQueue;
- public DownloadSchedulers(DownloadTaskQueue downloadTaskQueue) {
+ public DownloadSchedulers(ITaskQueue downloadTaskQueue) {
mQueue = downloadTaskQueue;
}
@@ -90,7 +91,7 @@ public class DownloadSchedulers implements IDownloadSchedulers {
switch (msg.what) {
case STOP:
case CANCEL:
- if (mQueue.getExecutePool().size() != ExecutePool.mSize) {
+ if (mQueue.size() != ExecutePool.mSize) {
startNextTask(entity);
}
break;