From 02420fe1f5ea9596bd944d143b17f8e934084e5c Mon Sep 17 00:00:00 2001
From: AriaLyy <511455842@qq.com>
Date: Tue, 6 Dec 2016 23:09:59 +0800
Subject: [PATCH] =?UTF-8?q?DownloadUtil=20=E9=87=8D=E5=91=BD=E5=90=8D?=
=?UTF-8?q?=E4=B8=BA=20Aria=EF=BC=8C=E4=BB=A3=E7=A0=81=E5=B7=B2=E9=87=8D?=
=?UTF-8?q?=E6=9E=84=EF=BC=8C=E4=BD=BF=E7=94=A8=E8=B5=B7=E6=9D=A5=E6=9B=B4?=
=?UTF-8?q?=E5=8A=A0=E7=AE=80=E4=BE=BF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/gradle.xml | 2 +-
.idea/modules.xml | 2 +-
{downloadutil => Aria}/.gitignore | 0
{downloadutil => Aria}/build.gradle | 2 +-
{downloadutil => Aria}/jcenter.gradle | 0
{downloadutil => Aria}/proguard-rules.pro | 0
.../arialyy/downloadutil/ApplicationTest.java | 0
.../src/main/AndroidManifest.xml | 2 +-
.../com/arialyy/aria}/core/AMReceiver.java | 5 ++--
.../java/com/arialyy/aria}/core/AMTarget.java | 23 +++++++++++-------
.../java/com/arialyy/aria}/core/Aria.java | 2 +-
.../com/arialyy/aria}/core/AriaManager.java | 18 ++++++++++----
.../arialyy/aria}/core/DownloadEntity.java | 6 ++---
.../arialyy/aria}/core/DownloadManager.java | 14 +++++------
.../arialyy/aria}/core/command/AddCmd.java | 6 ++---
.../arialyy/aria}/core/command/CancelCmd.java | 7 +++---
.../aria}/core/command/CmdFactory.java | 6 ++---
.../aria}/core/command/IDownloadCmd.java | 12 +++++-----
.../arialyy/aria}/core/command/SingleCmd.java | 7 +++---
.../arialyy/aria}/core/command/StartCmd.java | 7 +++---
.../arialyy/aria}/core/command/StopCmd.java | 7 +++---
.../aria}/core/queue/DownloadTaskQueue.java | 16 ++++++-------
.../arialyy/aria}/core/queue/IDownloader.java | 4 ++--
.../com/arialyy/aria}/core/queue/IPool.java | 4 ++--
.../arialyy/aria}/core/queue/ITaskQueue.java | 8 +++----
.../aria}/core/queue/pool/CachePool.java | 8 +++----
.../aria}/core/queue/pool/ExecutePool.java | 8 +++----
.../core/scheduler/DownloadSchedulers.java | 12 +++++-----
.../core/scheduler/IDownloadSchedulers.java | 5 ++--
.../core/scheduler/OnSchedulerListener.java | 4 ++--
.../aria}/core/task/DownloadListener.java | 2 +-
.../arialyy/aria}/core/task/DownloadUtil.java | 6 ++---
.../aria}/core/task/IDownloadListener.java | 2 +-
.../aria}/core/task/IDownloadUtil.java | 2 +-
.../com/arialyy/aria}/core/task/Task.java | 12 +++++-----
.../arialyy/aria}/core/task/TaskFactory.java | 6 ++---
.../java/com/arialyy/aria}/orm/DbEntity.java | 4 ++--
.../java/com/arialyy/aria}/orm/DbUtil.java | 4 ++--
.../main/java/com/arialyy/aria}/orm/Id.java | 2 +-
.../java/com/arialyy/aria}/orm/Ignore.java | 2 +-
.../java/com/arialyy/aria}/orm/SqlHelper.java | 2 +-
.../com/arialyy/aria}/util/CheckUtil.java | 4 ++--
.../com/arialyy/aria}/util/CommonUtil.java | 8 +++----
.../java/com/arialyy/aria}/util/PathUtil.java | 2 +-
.../src/main/res/values/strings.xml | 0
app/build.gradle | 2 +-
app/src/main/AndroidManifest.xml | 5 ++--
.../simple/activity/MultiTaskActivity.java | 7 +++---
.../simple/activity/SingleTaskActivity.java | 13 +++++-----
.../simple/adapter/DownloadAdapter.java | 24 +++++--------------
.../com/arialyy/simple/base/BaseActivity.java | 12 +++++++++-
.../arialyy/simple/base/BaseApplication.java | 2 +-
.../arialyy/simple/module/DownloadModule.java | 6 ++---
app/src/main/res/layout/activity_single.xml | 1 -
app/src/main/res/values-v21/styles.xml | 20 ++++++++--------
app/src/main/res/values/styles.xml | 18 +++++++-------
settings.gradle | 2 +-
57 files changed, 190 insertions(+), 177 deletions(-)
rename {downloadutil => Aria}/.gitignore (100%)
rename {downloadutil => Aria}/build.gradle (95%)
rename {downloadutil => Aria}/jcenter.gradle (100%)
rename {downloadutil => Aria}/proguard-rules.pro (100%)
rename {downloadutil => Aria}/src/androidTest/java/com/arialyy/downloadutil/ApplicationTest.java (100%)
rename {downloadutil => Aria}/src/main/AndroidManifest.xml (84%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/AMReceiver.java (90%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/AMTarget.java (78%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/Aria.java (98%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/AriaManager.java (90%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/DownloadEntity.java (97%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/DownloadManager.java (91%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/command/AddCmd.java (88%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/command/CancelCmd.java (85%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/command/CmdFactory.java (97%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/command/IDownloadCmd.java (81%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/command/SingleCmd.java (77%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/command/StartCmd.java (85%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/command/StopCmd.java (87%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/queue/DownloadTaskQueue.java (91%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/queue/IDownloader.java (92%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/queue/IPool.java (94%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/queue/ITaskQueue.java (90%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/queue/pool/CachePool.java (94%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/queue/pool/ExecutePool.java (96%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/scheduler/DownloadSchedulers.java (94%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/scheduler/IDownloadSchedulers.java (92%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/scheduler/OnSchedulerListener.java (86%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/task/DownloadListener.java (96%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/task/DownloadUtil.java (99%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/task/IDownloadListener.java (97%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/task/IDownloadUtil.java (96%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/task/Task.java (96%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/core/task/TaskFactory.java (90%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/orm/DbEntity.java (97%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/orm/DbUtil.java (99%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/orm/Id.java (96%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/orm/Ignore.java (96%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/orm/SqlHelper.java (97%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/util/CheckUtil.java (95%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/util/CommonUtil.java (97%)
rename {downloadutil/src/main/java/com/arialyy/downloadutil => Aria/src/main/java/com/arialyy/aria}/util/PathUtil.java (98%)
rename {downloadutil => Aria}/src/main/res/values/strings.xml (100%)
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index e12fe0b2..3889b503 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -9,8 +9,8 @@
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 8700295b..4708f7cb 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -2,9 +2,9 @@
+
-
\ No newline at end of file
diff --git a/downloadutil/.gitignore b/Aria/.gitignore
similarity index 100%
rename from downloadutil/.gitignore
rename to Aria/.gitignore
diff --git a/downloadutil/build.gradle b/Aria/build.gradle
similarity index 95%
rename from downloadutil/build.gradle
rename to Aria/build.gradle
index 5bbfce46..4ba96047 100644
--- a/downloadutil/build.gradle
+++ b/Aria/build.gradle
@@ -8,7 +8,7 @@ android {
minSdkVersion 9
targetSdkVersion 23
versionCode 58
- versionName "2.1.0"
+ versionName "2.3.0"
}
buildTypes {
release {
diff --git a/downloadutil/jcenter.gradle b/Aria/jcenter.gradle
similarity index 100%
rename from downloadutil/jcenter.gradle
rename to Aria/jcenter.gradle
diff --git a/downloadutil/proguard-rules.pro b/Aria/proguard-rules.pro
similarity index 100%
rename from downloadutil/proguard-rules.pro
rename to Aria/proguard-rules.pro
diff --git a/downloadutil/src/androidTest/java/com/arialyy/downloadutil/ApplicationTest.java b/Aria/src/androidTest/java/com/arialyy/downloadutil/ApplicationTest.java
similarity index 100%
rename from downloadutil/src/androidTest/java/com/arialyy/downloadutil/ApplicationTest.java
rename to Aria/src/androidTest/java/com/arialyy/downloadutil/ApplicationTest.java
diff --git a/downloadutil/src/main/AndroidManifest.xml b/Aria/src/main/AndroidManifest.xml
similarity index 84%
rename from downloadutil/src/main/AndroidManifest.xml
rename to Aria/src/main/AndroidManifest.xml
index 7e405fd7..952e1869 100644
--- a/downloadutil/src/main/AndroidManifest.xml
+++ b/Aria/src/main/AndroidManifest.xml
@@ -1,5 +1,5 @@
+ package="com.arialyy.aria">
+ android:theme="@style/AppTheme.NoActionBar">
+ android:label="@string/app_name">
diff --git a/app/src/main/java/com/arialyy/simple/activity/MultiTaskActivity.java b/app/src/main/java/com/arialyy/simple/activity/MultiTaskActivity.java
index 4fb51665..98e57a11 100644
--- a/app/src/main/java/com/arialyy/simple/activity/MultiTaskActivity.java
+++ b/app/src/main/java/com/arialyy/simple/activity/MultiTaskActivity.java
@@ -23,9 +23,9 @@ import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import butterknife.Bind;
-import com.arialyy.downloadutil.core.AMTarget;
-import com.arialyy.downloadutil.core.Aria;
-import com.arialyy.downloadutil.core.task.Task;
+import com.arialyy.aria.core.AMTarget;
+import com.arialyy.aria.core.Aria;
+import com.arialyy.aria.core.task.Task;
import com.arialyy.frame.util.show.L;
import com.arialyy.simple.R;
import com.arialyy.simple.adapter.DownloadAdapter;
@@ -135,6 +135,7 @@ public class MultiTaskActivity extends BaseActivity {
@Override public void onTaskStart(Task task) {
super.onTaskStart(task);
L.d(TAG, "download start");
+ mAdapter.updateState(task.getDownloadEntity());
}
@Override public void onTaskResume(Task task) {
diff --git a/app/src/main/java/com/arialyy/simple/activity/SingleTaskActivity.java b/app/src/main/java/com/arialyy/simple/activity/SingleTaskActivity.java
index a015f092..643335df 100644
--- a/app/src/main/java/com/arialyy/simple/activity/SingleTaskActivity.java
+++ b/app/src/main/java/com/arialyy/simple/activity/SingleTaskActivity.java
@@ -24,16 +24,15 @@ import android.os.Message;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
-import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import butterknife.Bind;
-import com.arialyy.downloadutil.core.AMTarget;
-import com.arialyy.downloadutil.core.Aria;
-import com.arialyy.downloadutil.core.DownloadEntity;
-import com.arialyy.downloadutil.core.task.Task;
-import com.arialyy.downloadutil.orm.DbEntity;
-import com.arialyy.downloadutil.util.CommonUtil;
+import com.arialyy.aria.core.AMTarget;
+import com.arialyy.aria.core.Aria;
+import com.arialyy.aria.core.DownloadEntity;
+import com.arialyy.aria.core.task.Task;
+import com.arialyy.aria.orm.DbEntity;
+import com.arialyy.aria.util.CommonUtil;
import com.arialyy.simple.R;
import com.arialyy.simple.base.BaseActivity;
import com.arialyy.simple.databinding.ActivitySingleBinding;
diff --git a/app/src/main/java/com/arialyy/simple/adapter/DownloadAdapter.java b/app/src/main/java/com/arialyy/simple/adapter/DownloadAdapter.java
index 46e5acec..ef15f824 100644
--- a/app/src/main/java/com/arialyy/simple/adapter/DownloadAdapter.java
+++ b/app/src/main/java/com/arialyy/simple/adapter/DownloadAdapter.java
@@ -25,16 +25,11 @@ import android.widget.TextView;
import butterknife.Bind;
import com.arialyy.absadapter.common.AbsHolder;
import com.arialyy.absadapter.recycler_view.AbsRVAdapter;
-import com.arialyy.downloadutil.core.Aria;
-import com.arialyy.downloadutil.core.DownloadEntity;
-import com.arialyy.downloadutil.core.DownloadManager;
-import com.arialyy.downloadutil.core.command.CmdFactory;
-import com.arialyy.downloadutil.core.command.IDownloadCmd;
-import com.arialyy.downloadutil.util.CommonUtil;
+import com.arialyy.aria.core.Aria;
+import com.arialyy.aria.core.DownloadEntity;
+import com.arialyy.aria.util.CommonUtil;
import com.arialyy.simple.R;
import com.arialyy.simple.widget.HorizontalProgressBarWithNumber;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -46,22 +41,16 @@ import java.util.concurrent.ConcurrentHashMap;
*/
public class DownloadAdapter extends AbsRVAdapter {
private static final String TAG = "DownloadAdapter";
- private DownloadManager mManager;
- private CmdFactory mFactory;
private Map mPositions = new ConcurrentHashMap<>();
public DownloadAdapter(Context context, List data) {
super(context, data);
- mFactory = CmdFactory.getInstance();
- mManager = DownloadManager.getInstance();
- List addCmd = new ArrayList<>();
int i = 0;
for (DownloadEntity entity : data) {
mPositions.put(entity.getDownloadUrl(), i);
- addCmd.add(mFactory.createCmd(entity, CmdFactory.TASK_CREATE));
+ Aria.whit(getContext()).load(entity).add();
i++;
}
- mManager.setCmds(addCmd).exe();
}
@Override protected MyHolder getViewHolder(View convertView, int viewType) {
@@ -152,14 +141,13 @@ public class DownloadAdapter extends AbsRVAdapter extends AbsActivity {
+
+ @Override protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (AndroidVersionUtil.hasLollipop()) {
+ getWindow().setStatusBarColor(getResources().getColor(R.color.colorPrimaryDark));
+ }
+ }
+
@Override protected void dataCallback(int result, Object data) {
}
diff --git a/app/src/main/java/com/arialyy/simple/base/BaseApplication.java b/app/src/main/java/com/arialyy/simple/base/BaseApplication.java
index 4710265d..1b97cde5 100644
--- a/app/src/main/java/com/arialyy/simple/base/BaseApplication.java
+++ b/app/src/main/java/com/arialyy/simple/base/BaseApplication.java
@@ -18,7 +18,7 @@
package com.arialyy.simple.base;
import android.app.Application;
-import com.arialyy.downloadutil.core.DownloadManager;
+import com.arialyy.aria.core.DownloadManager;
import com.arialyy.frame.core.AbsFrame;
/**
diff --git a/app/src/main/java/com/arialyy/simple/module/DownloadModule.java b/app/src/main/java/com/arialyy/simple/module/DownloadModule.java
index 559dac04..48fffd6b 100644
--- a/app/src/main/java/com/arialyy/simple/module/DownloadModule.java
+++ b/app/src/main/java/com/arialyy/simple/module/DownloadModule.java
@@ -22,9 +22,9 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.os.Environment;
import android.os.Handler;
-import com.arialyy.downloadutil.core.DownloadEntity;
-import com.arialyy.downloadutil.core.DownloadManager;
-import com.arialyy.downloadutil.util.CommonUtil;
+import com.arialyy.aria.core.DownloadEntity;
+import com.arialyy.aria.core.DownloadManager;
+import com.arialyy.aria.util.CommonUtil;
import com.arialyy.frame.util.AndroidUtils;
import com.arialyy.frame.util.StringUtil;
import com.arialyy.frame.util.show.L;
diff --git a/app/src/main/res/layout/activity_single.xml b/app/src/main/res/layout/activity_single.xml
index 3c74a58e..851b49dc 100644
--- a/app/src/main/res/layout/activity_single.xml
+++ b/app/src/main/res/layout/activity_single.xml
@@ -12,7 +12,6 @@
diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml
index ecada24b..0d719a06 100644
--- a/app/src/main/res/values-v21/styles.xml
+++ b/app/src/main/res/values-v21/styles.xml
@@ -1,16 +1,16 @@
-
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
-