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 d4e7af76..117857a4 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/DownloadManager.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/DownloadManager.java @@ -4,7 +4,8 @@ import android.app.Application; import android.content.Context; import android.util.Log; import com.arialyy.downloadutil.core.command.IDownloadCmd; -import com.arialyy.downloadutil.core.inf.ITaskQueue; +import com.arialyy.downloadutil.core.queue.ITaskQueue; +import com.arialyy.downloadutil.core.queue.DownloadTaskQueue; import com.arialyy.downloadutil.orm.DbEntity; import com.arialyy.downloadutil.orm.DbUtil; import java.util.ArrayList; diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/TaskEnum.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/TaskEnum.java deleted file mode 100644 index 4e5c9790..00000000 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/TaskEnum.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.arialyy.downloadutil.core; - -/** - * Created by lyy on 2016/8/18. - * 创建任务类型 - */ -public enum TaskEnum { - ORDINARY, NO_USR_CALLBACK -} diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/AddCmd.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/AddCmd.java index 00e77fec..ec83044a 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/AddCmd.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/AddCmd.java @@ -2,7 +2,7 @@ package com.arialyy.downloadutil.core.command; import android.util.Log; import com.arialyy.downloadutil.core.DownloadEntity; -import com.arialyy.downloadutil.core.Task; +import com.arialyy.downloadutil.core.task.Task; /** * Created by lyy on 2016/8/22. diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/CancelCmd.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/CancelCmd.java index 48368a59..3b7244e9 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/CancelCmd.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/CancelCmd.java @@ -1,8 +1,7 @@ package com.arialyy.downloadutil.core.command; -import android.content.Context; import com.arialyy.downloadutil.core.DownloadEntity; -import com.arialyy.downloadutil.core.Task; +import com.arialyy.downloadutil.core.task.Task; /** * Created by lyy on 2016/9/20. diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/IDownloadCmd.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/IDownloadCmd.java index 9f734585..26aa9d8e 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/IDownloadCmd.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/IDownloadCmd.java @@ -2,7 +2,7 @@ package com.arialyy.downloadutil.core.command; import com.arialyy.downloadutil.core.DownloadEntity; import com.arialyy.downloadutil.core.DownloadManager; -import com.arialyy.downloadutil.core.inf.ITaskQueue; +import com.arialyy.downloadutil.core.queue.ITaskQueue; import com.arialyy.downloadutil.help.CheckHelp; import com.arialyy.downloadutil.util.Util; diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/StartCmd.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/StartCmd.java index 80032e53..6e4d5acf 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/StartCmd.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/StartCmd.java @@ -1,8 +1,7 @@ package com.arialyy.downloadutil.core.command; -import android.content.Context; import com.arialyy.downloadutil.core.DownloadEntity; -import com.arialyy.downloadutil.core.Task; +import com.arialyy.downloadutil.core.task.Task; /** * Created by lyy on 2016/8/22. diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/StopCmd.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/StopCmd.java index f8fc1093..d8dc9e74 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/StopCmd.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/command/StopCmd.java @@ -2,7 +2,7 @@ package com.arialyy.downloadutil.core.command; import android.util.Log; import com.arialyy.downloadutil.core.DownloadEntity; -import com.arialyy.downloadutil.core.Task; +import com.arialyy.downloadutil.core.task.Task; /** * Created by lyy on 2016/9/20. diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/DownloadTaskQueue.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/DownloadTaskQueue.java similarity index 85% rename from downloadutil/src/main/java/com/arialyy/downloadutil/core/DownloadTaskQueue.java rename to downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/DownloadTaskQueue.java index c7024dbb..3840b38f 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/DownloadTaskQueue.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/DownloadTaskQueue.java @@ -1,17 +1,20 @@ -package com.arialyy.downloadutil.core; +package com.arialyy.downloadutil.core.queue; import android.content.Context; import android.util.Log; -import com.arialyy.downloadutil.core.inf.IDownloadSchedulers; -import com.arialyy.downloadutil.core.inf.ITaskQueue; -import com.arialyy.downloadutil.core.pool.CachePool; -import com.arialyy.downloadutil.core.pool.ExecutePool; +import com.arialyy.downloadutil.core.DownloadEntity; +import com.arialyy.downloadutil.core.scheduler.DownloadSchedulers; +import com.arialyy.downloadutil.core.task.Task; +import com.arialyy.downloadutil.core.task.TaskFactory; +import com.arialyy.downloadutil.core.scheduler.IDownloadSchedulers; +import com.arialyy.downloadutil.core.queue.pool.CachePool; +import com.arialyy.downloadutil.core.queue.pool.ExecutePool; /** * Created by lyy on 2016/8/17. * 下载任务队列 */ -final class DownloadTaskQueue implements ITaskQueue { +public class DownloadTaskQueue implements ITaskQueue { private static final String TAG = "DownloadTaskQueue"; private CachePool mCachePool = CachePool.getInstance(); private ExecutePool mExecutePool = ExecutePool.getInstance(); @@ -126,11 +129,11 @@ final class DownloadTaskQueue implements ITaskQueue { mSchedulers = schedulers; } - static class Builder { + public static class Builder { Context context; IDownloadSchedulers schedulers; - Builder(Context context) { + public Builder(Context context) { this.context = context.getApplicationContext(); } @@ -139,7 +142,7 @@ final class DownloadTaskQueue implements ITaskQueue { return this; } - DownloadTaskQueue build() { + public DownloadTaskQueue build() { DownloadTaskQueue queue = new DownloadTaskQueue(context); if (schedulers == null) { schedulers = DownloadSchedulers.getInstance(queue); diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/inf/IDownloader.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/IDownloader.java similarity index 84% rename from downloadutil/src/main/java/com/arialyy/downloadutil/core/inf/IDownloader.java rename to downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/IDownloader.java index fc8e0d8e..cb56cdff 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/inf/IDownloader.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/IDownloader.java @@ -1,6 +1,6 @@ -package com.arialyy.downloadutil.core.inf; +package com.arialyy.downloadutil.core.queue; -import com.arialyy.downloadutil.core.Task; +import com.arialyy.downloadutil.core.task.Task; /** * Created by lyy on 2016/8/16. diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/inf/IPool.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/IPool.java similarity index 91% rename from downloadutil/src/main/java/com/arialyy/downloadutil/core/inf/IPool.java rename to downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/IPool.java index 6b83219e..2ebfce19 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/inf/IPool.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/IPool.java @@ -1,6 +1,6 @@ -package com.arialyy.downloadutil.core.inf; +package com.arialyy.downloadutil.core.queue; -import com.arialyy.downloadutil.core.Task; +import com.arialyy.downloadutil.core.task.Task; /** * Created by lyy on 2016/8/14. diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/inf/ITaskQueue.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/ITaskQueue.java similarity index 83% rename from downloadutil/src/main/java/com/arialyy/downloadutil/core/inf/ITaskQueue.java rename to downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/ITaskQueue.java index 2fa7517f..404f354a 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/inf/ITaskQueue.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/ITaskQueue.java @@ -1,13 +1,14 @@ -package com.arialyy.downloadutil.core.inf; +package com.arialyy.downloadutil.core.queue; import com.arialyy.downloadutil.core.DownloadEntity; -import com.arialyy.downloadutil.core.Task; +import com.arialyy.downloadutil.core.task.Task; +import com.arialyy.downloadutil.core.scheduler.IDownloadSchedulers; /** * Created by lyy on 2016/8/16. * 任务功能接口 */ -public interface ITaskQueue extends IDownloader{ +public interface ITaskQueue extends IDownloader { /** * 创建一个新的下载任务,创建时只是将新任务存储到缓存池 diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/pool/CachePool.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/pool/CachePool.java similarity index 95% rename from downloadutil/src/main/java/com/arialyy/downloadutil/core/pool/CachePool.java rename to downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/pool/CachePool.java index 7639bebe..5d8ed99b 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/pool/CachePool.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/pool/CachePool.java @@ -1,9 +1,9 @@ -package com.arialyy.downloadutil.core.pool; +package com.arialyy.downloadutil.core.queue.pool; import android.text.TextUtils; import android.util.Log; -import com.arialyy.downloadutil.core.Task; -import com.arialyy.downloadutil.core.inf.IPool; +import com.arialyy.downloadutil.core.task.Task; +import com.arialyy.downloadutil.core.queue.IPool; import com.arialyy.downloadutil.util.Util; import java.util.HashMap; import java.util.Map; diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/pool/ExecutePool.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/pool/ExecutePool.java similarity index 96% rename from downloadutil/src/main/java/com/arialyy/downloadutil/core/pool/ExecutePool.java rename to downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/pool/ExecutePool.java index 0ac1a5f0..059177f3 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/pool/ExecutePool.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/queue/pool/ExecutePool.java @@ -1,9 +1,9 @@ -package com.arialyy.downloadutil.core.pool; +package com.arialyy.downloadutil.core.queue.pool; import android.text.TextUtils; import android.util.Log; -import com.arialyy.downloadutil.core.Task; -import com.arialyy.downloadutil.core.inf.IPool; +import com.arialyy.downloadutil.core.task.Task; +import com.arialyy.downloadutil.core.queue.IPool; import com.arialyy.downloadutil.util.Util; import java.util.HashMap; import java.util.Map; diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/DownloadSchedulers.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/scheduler/DownloadSchedulers.java similarity index 94% rename from downloadutil/src/main/java/com/arialyy/downloadutil/core/DownloadSchedulers.java rename to downloadutil/src/main/java/com/arialyy/downloadutil/core/scheduler/DownloadSchedulers.java index 3c1ea3f9..85e2235a 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/DownloadSchedulers.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/scheduler/DownloadSchedulers.java @@ -1,9 +1,11 @@ -package com.arialyy.downloadutil.core; +package com.arialyy.downloadutil.core.scheduler; import android.os.Message; import android.util.Log; -import com.arialyy.downloadutil.core.inf.IDownloadSchedulers; -import com.arialyy.downloadutil.core.pool.ExecutePool; +import com.arialyy.downloadutil.core.DownloadEntity; +import com.arialyy.downloadutil.core.task.Task; +import com.arialyy.downloadutil.core.queue.pool.ExecutePool; +import com.arialyy.downloadutil.core.queue.DownloadTaskQueue; /** * Created by lyy on 2016/8/16. diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/inf/IDownloadSchedulers.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/scheduler/IDownloadSchedulers.java similarity index 92% rename from downloadutil/src/main/java/com/arialyy/downloadutil/core/inf/IDownloadSchedulers.java rename to downloadutil/src/main/java/com/arialyy/downloadutil/core/scheduler/IDownloadSchedulers.java index 630acf49..e2a14e38 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/inf/IDownloadSchedulers.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/scheduler/IDownloadSchedulers.java @@ -1,4 +1,4 @@ -package com.arialyy.downloadutil.core.inf; +package com.arialyy.downloadutil.core.scheduler; import android.os.Handler; import com.arialyy.downloadutil.core.DownloadEntity; diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/DownloadListener.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/task/DownloadListener.java similarity index 85% rename from downloadutil/src/main/java/com/arialyy/downloadutil/core/DownloadListener.java rename to downloadutil/src/main/java/com/arialyy/downloadutil/core/task/DownloadListener.java index c3d1c08c..53b0193b 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/DownloadListener.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/task/DownloadListener.java @@ -1,6 +1,6 @@ -package com.arialyy.downloadutil.core; +package com.arialyy.downloadutil.core.task; -public class DownloadListener implements IDownloadListener { +class DownloadListener implements IDownloadListener { @Override public void onResume(long resumeLocation) { diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/DownLoadUtil.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/task/DownloadUtil.java similarity index 99% rename from downloadutil/src/main/java/com/arialyy/downloadutil/core/DownLoadUtil.java rename to downloadutil/src/main/java/com/arialyy/downloadutil/core/task/DownloadUtil.java index 5578f224..70e77d97 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/DownLoadUtil.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/task/DownloadUtil.java @@ -1,9 +1,9 @@ -package com.arialyy.downloadutil.core; +package com.arialyy.downloadutil.core.task; import android.content.Context; import android.util.Log; import android.util.SparseArray; -import com.arialyy.downloadutil.core.inf.IDownloadUtil; +import com.arialyy.downloadutil.core.DownloadEntity; import com.arialyy.downloadutil.util.Util; import java.io.File; import java.io.IOException; diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/IDownloadListener.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/task/IDownloadListener.java similarity index 95% rename from downloadutil/src/main/java/com/arialyy/downloadutil/core/IDownloadListener.java rename to downloadutil/src/main/java/com/arialyy/downloadutil/core/task/IDownloadListener.java index a10afd55..54a9dc26 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/IDownloadListener.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/task/IDownloadListener.java @@ -1,4 +1,4 @@ -package com.arialyy.downloadutil.core; +package com.arialyy.downloadutil.core.task; /** * 下载监听 diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/inf/IDownloadUtil.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/task/IDownloadUtil.java similarity index 94% rename from downloadutil/src/main/java/com/arialyy/downloadutil/core/inf/IDownloadUtil.java rename to downloadutil/src/main/java/com/arialyy/downloadutil/core/task/IDownloadUtil.java index 83915bd0..91d3b472 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/inf/IDownloadUtil.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/task/IDownloadUtil.java @@ -1,4 +1,4 @@ -package com.arialyy.downloadutil.core.inf; +package com.arialyy.downloadutil.core.task; /** * Created by “AriaLyy@outlook.com” on 2016/10/31. diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/Task.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/task/Task.java similarity index 96% rename from downloadutil/src/main/java/com/arialyy/downloadutil/core/Task.java rename to downloadutil/src/main/java/com/arialyy/downloadutil/core/task/Task.java index 654c6093..c3e4aab0 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/Task.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/task/Task.java @@ -1,12 +1,14 @@ -package com.arialyy.downloadutil.core; +package com.arialyy.downloadutil.core.task; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Handler; import android.util.Log; -import com.arialyy.downloadutil.core.inf.IDownloadSchedulers; -import com.arialyy.downloadutil.core.inf.IDownloadUtil; +import com.arialyy.downloadutil.core.DownloadEntity; +import com.arialyy.downloadutil.core.DownloadManager; +import com.arialyy.downloadutil.core.scheduler.IDownloadSchedulers; +import com.arialyy.downloadutil.core.scheduler.DownloadSchedulers; /** * Created by lyy on 2016/8/11. diff --git a/downloadutil/src/main/java/com/arialyy/downloadutil/core/TaskFactory.java b/downloadutil/src/main/java/com/arialyy/downloadutil/core/task/TaskFactory.java similarity index 83% rename from downloadutil/src/main/java/com/arialyy/downloadutil/core/TaskFactory.java rename to downloadutil/src/main/java/com/arialyy/downloadutil/core/task/TaskFactory.java index 4019c114..187a9dee 100644 --- a/downloadutil/src/main/java/com/arialyy/downloadutil/core/TaskFactory.java +++ b/downloadutil/src/main/java/com/arialyy/downloadutil/core/task/TaskFactory.java @@ -1,7 +1,8 @@ -package com.arialyy.downloadutil.core; +package com.arialyy.downloadutil.core.task; import android.content.Context; -import com.arialyy.downloadutil.core.inf.IDownloadSchedulers; +import com.arialyy.downloadutil.core.DownloadEntity; +import com.arialyy.downloadutil.core.scheduler.IDownloadSchedulers; /** * Created by lyy on 2016/8/18.