From 1764f50258d7535c56dd6028362ac1e55a8e72c4 Mon Sep 17 00:00:00 2001 From: AriaLyy <511455842@qq.com> Date: Sat, 3 Jun 2017 15:55:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E9=AB=98=E4=BC=98=E5=85=88=E7=BA=A7?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8A=9F=E8=83=BD=E5=AE=9E=E7=8E=B0=EF=BC=8C?= =?UTF-8?q?demo=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/arialyy/aria/core/Aria.java | 9 +- .../aria/core/command/HighestPriorityCmd.java | 2 +- .../aria/core/download/DownloadTask.java | 18 ++- .../com/arialyy/aria/core/inf/AbsTarget.java | 11 +- .../com/arialyy/aria/core/inf/AbsTask.java | 9 ++ .../java/com/arialyy/aria/core/inf/ITask.java | 9 ++ .../arialyy/aria/core/queue/AbsTaskQueue.java | 1 + .../aria/core/queue/DownloadTaskQueue.java | 15 +++ .../aria/core/queue/pool/CachePool.java | 23 ++-- .../aria/core/queue/pool/ExecutePool.java | 30 +++-- .../core/scheduler/DownloadSchedulers.java | 2 +- .../core/scheduler/ISchedulerListener.java | 2 +- .../aria/core/scheduler/UploadSchedulers.java | 2 +- .../arialyy/aria/core/upload/UploadTask.java | 16 ++- .../com/arialyy/aria/util/CommonUtil.java | 8 +- .../java/com/arialyy/aria/util/FileUtil.java | 20 ---- .../aria/window/AriaFileChangeActivity.java | 67 ----------- .../aria/window/FileChangeAdapter.java | 92 -------------- .../com/arialyy/aria/window/FileEntity.java | 29 ----- README.md | 2 +- app/src/main/AndroidManifest.xml | 1 + app/src/main/assets/aria_config.xml | 2 +- .../java/com/arialyy/simple/MainActivity.java | 4 +- .../com/arialyy/simple/base/BaseActivity.java | 41 ++++++- .../com/arialyy/simple/common/MsgDialog.java | 38 ++++++ .../simple/download/DownloadActivity.java | 8 +- .../simple/download/DownloadModule.java | 113 +++--------------- .../download/HighestPriorityActivity.java | 97 +++++++++++---- .../simple/download/SingleTaskActivity.java | 24 ++-- .../multi_download/DownloadAdapter.java | 7 +- .../multi_download/MultiDownloadActivity.java | 7 +- .../multi_download/MultiTaskActivity.java | 5 +- .../arialyy/simple/upload/UploadActivity.java | 5 +- .../res/layout/activity_highest_priority.xml | 10 +- app/src/main/res/layout/dialog_msg.xml | 63 ++++++++++ app/src/main/res/layout/item_download.xml | 18 ++- .../main/res/menu/menu_highest_priority.xml | 21 ++++ .../res/mipmap-mdpi/ic_add_black_48dp.png | Bin 0 -> 199 bytes .../res/mipmap-mdpi/ic_help_black_48dp.png | Bin 0 -> 578 bytes app/src/main/res/values/strings.xml | 12 ++ 40 files changed, 434 insertions(+), 409 deletions(-) create mode 100644 Aria/src/main/java/com/arialyy/aria/core/inf/AbsTask.java delete mode 100644 Aria/src/main/java/com/arialyy/aria/window/AriaFileChangeActivity.java delete mode 100644 Aria/src/main/java/com/arialyy/aria/window/FileChangeAdapter.java delete mode 100644 Aria/src/main/java/com/arialyy/aria/window/FileEntity.java create mode 100644 app/src/main/java/com/arialyy/simple/common/MsgDialog.java create mode 100644 app/src/main/res/layout/dialog_msg.xml create mode 100644 app/src/main/res/menu/menu_highest_priority.xml create mode 100644 app/src/main/res/mipmap-mdpi/ic_add_black_48dp.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_help_black_48dp.png diff --git a/Aria/src/main/java/com/arialyy/aria/core/Aria.java b/Aria/src/main/java/com/arialyy/aria/core/Aria.java index 241c0fb6..f4cfd252 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/Aria.java +++ b/Aria/src/main/java/com/arialyy/aria/core/Aria.java @@ -177,9 +177,9 @@ import com.arialyy.aria.core.upload.UploadTask; /** * 预处理,有时有些地址链接比较慢,这时可以先在这个地方出来一些界面上的UI,如按钮的状态。 * - * @param url 任务上传地址 + * @param task 上传文物实体 */ - @Override public void onPre(String url) { + @Override public void onPre(UploadTask task) { } @@ -223,10 +223,11 @@ import com.arialyy.aria.core.upload.UploadTask; implements IDownloadSchedulerListener { /** * 预处理,有时有些地址链接比较慢,这时可以先在这个地方出来一些界面上的UI,如按钮的状态。 + * 需要注意的是,在该回调中,是得不到文件长度的,如果需要获取文件长度,需要在onTaskPre中获取 * - * @param url 任务下载地址 + * @param task 下载任务 */ - @Override public void onPre(String url) { + @Override public void onPre(DownloadTask task) { } diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/HighestPriorityCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/HighestPriorityCmd.java index 0f100a84..b693ec3c 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/HighestPriorityCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/HighestPriorityCmd.java @@ -47,7 +47,7 @@ final class HighestPriorityCmd extends AbsCmd { if (!TextUtils.isEmpty(mTargetName)) { task.setTargetName(mTargetName); } - task.setHighestPriority(true); + mQueue.setTaskHighestPriority(task); } } } diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTask.java b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTask.java index 4a2722de..99ea4c93 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTask.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTask.java @@ -76,7 +76,7 @@ public class DownloadTask implements ITask { } /** - * @return 返回转换单位后的速度,需要你在配置文件中配置,转换完成后为:1b/s、1k/s、1m/s、1g/s、1t/s + * @return 返回转换单位后的速度,需要你在配置文件中配置,转换完成后为:1b/s、1kb/s、1mb/s、1gb/s、1tb/s *
    *   {@code
    *    
@@ -118,11 +118,11 @@ public class DownloadTask implements ITask {
   /**
    * 转换单位后的文件长度
    *
-   * @return 如果文件长度为0,则返回0m,否则返回转换后的长度1b、1k、1m、1g、1t
+   * @return 如果文件长度为0,则返回0m,否则返回转换后的长度1b、1kb、1mb、1gb、1tb
    */
   @Override public String getConvertFileSize() {
     if (mEntity.getFileSize() == 0) {
-      return "0m";
+      return "0mb";
     }
     return CommonUtil.formatFileSize(mEntity.getFileSize());
   }
@@ -134,6 +134,18 @@ public class DownloadTask implements ITask {
     return mEntity.getCurrentProgress();
   }
 
+  /**
+   * 获取单位转换后的进度
+   *
+   * @return 如:已经下载3mb的大小,则返回{@code 3mb}
+   */
+  @Override public String getConvertCurrentProgress() {
+    if (mEntity.getCurrentProgress() == 0) {
+      return "0b";
+    }
+    return CommonUtil.formatFileSize(mEntity.getCurrentProgress());
+  }
+
   /**
    * 获取当前下载任务的下载地址
    *
diff --git a/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java b/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java
index e98eb937..fe9005be 100644
--- a/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java
+++ b/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java
@@ -35,11 +35,20 @@ import java.util.Set;
 /**
  * Created by lyy on 2017/2/28.
  */
-public class AbsTarget {
+public abstract class AbsTarget {
   protected ENTITY entity;
   protected TASK_ENTITY taskEntity;
   protected String targetName;
 
+  /**
+   * 获取任务状态
+   *
+   * @return {@link IEntity}
+   */
+  public int getTaskState() {
+    return entity.getState();
+  }
+
   /**
    * 将任务设置为最高优先级任务,最高优先级任务有以下特点:
    * 1、在下载队列中,有且只有一个最高优先级任务
diff --git a/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTask.java b/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTask.java
new file mode 100644
index 00000000..38e795ae
--- /dev/null
+++ b/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTask.java
@@ -0,0 +1,9 @@
+package com.arialyy.aria.core.inf;
+
+/**
+ * Created by lyy on 2017/6/3.
+ */
+public abstract class AbsTask implements ITask{
+
+
+}
diff --git a/Aria/src/main/java/com/arialyy/aria/core/inf/ITask.java b/Aria/src/main/java/com/arialyy/aria/core/inf/ITask.java
index 4a67f049..c988f655 100644
--- a/Aria/src/main/java/com/arialyy/aria/core/inf/ITask.java
+++ b/Aria/src/main/java/com/arialyy/aria/core/inf/ITask.java
@@ -81,8 +81,17 @@ public interface ITask {
    */
   public String getConvertFileSize();
 
+  /**
+   * 获取当前进度
+   */
   public long getCurrentProgress();
 
+  /**
+   * 获取单位转换后的进度
+   * @return 返回 3mb
+   */
+  public String getConvertCurrentProgress();
+
   public void setTargetName(String targetName);
 
   public void removeRecord();
diff --git a/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java b/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java
index 70f5523c..d17b5509 100644
--- a/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java
+++ b/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java
@@ -87,6 +87,7 @@ abstract class AbsTaskQueue exeTasks = mExecutePool.getAllTask();
+    if (exeTasks != null && !exeTasks.isEmpty()) {
+      Set keys = exeTasks.keySet();
+      for (String key : keys) {
+        DownloadTask temp = exeTasks.get(key);
+        if (temp != null && temp.isRunning() &&  temp.isHighestPriorityTask() && !temp.getKey()
+            .equals(task.getKey())) {
+          Log.e(TAG, "设置最高优先级任务失败,失败原因【任务中已经有最高优先级任务,请等待上一个最高优先级任务完成,或手动暂停该任务】");
+          task.setHighestPriority(false);
+          return;
+        }
+      }
+    }
     int maxSize = AriaManager.getInstance(AriaManager.APP).getDownloadConfig().getMaxTaskNum();
     int currentSize = mExecutePool.size();
     if (currentSize == 0 || currentSize < maxSize) {
diff --git a/Aria/src/main/java/com/arialyy/aria/core/queue/pool/CachePool.java b/Aria/src/main/java/com/arialyy/aria/core/queue/pool/CachePool.java
index aa2f37cf..fb46b434 100644
--- a/Aria/src/main/java/com/arialyy/aria/core/queue/pool/CachePool.java
+++ b/Aria/src/main/java/com/arialyy/aria/core/queue/pool/CachePool.java
@@ -34,12 +34,19 @@ public class CachePool implements IPool {
   private static final Object LOCK = new Object();
   private static final int MAX_NUM = Integer.MAX_VALUE;  //最大下载任务数
   private static final long TIME_OUT = 1000;
-  private Map mCacheArray;
+  private Map mCacheMap;
   private LinkedBlockingQueue mCacheQueue;
 
   public CachePool() {
     mCacheQueue = new LinkedBlockingQueue<>(MAX_NUM);
-    mCacheArray = new HashMap<>();
+    mCacheMap = new HashMap<>();
+  }
+
+  /**
+   * 获取所有正在执行的任务
+   */
+  public Map getAllTask() {
+    return mCacheMap;
   }
 
   @Override public boolean putTask(TASK task) {
@@ -56,7 +63,7 @@ public class CachePool implements IPool {
         boolean s = mCacheQueue.offer(task);
         Log.d(TAG, "任务添加" + (s ? "成功" : "失败,【" + url + "】"));
         if (s) {
-          mCacheArray.put(CommonUtil.keyToHashKey(url), task);
+          mCacheMap.put(CommonUtil.keyToHashKey(url), task);
         }
         return s;
       }
@@ -70,7 +77,7 @@ public class CachePool implements IPool {
         task = mCacheQueue.poll(TIME_OUT, TimeUnit.MICROSECONDS);
         if (task != null) {
           String url = task.getKey();
-          mCacheArray.remove(CommonUtil.keyToHashKey(url));
+          mCacheMap.remove(CommonUtil.keyToHashKey(url));
         }
         return task;
       } catch (InterruptedException e) {
@@ -87,7 +94,7 @@ public class CachePool implements IPool {
         return null;
       }
       String key = CommonUtil.keyToHashKey(downloadUrl);
-      return mCacheArray.get(key);
+      return mCacheMap.get(key);
     }
   }
 
@@ -98,7 +105,7 @@ public class CachePool implements IPool {
         return false;
       } else {
         String key = CommonUtil.keyToHashKey(task.getKey());
-        mCacheArray.remove(key);
+        mCacheMap.remove(key);
         return mCacheQueue.remove(task);
       }
     }
@@ -111,8 +118,8 @@ public class CachePool implements IPool {
         return false;
       }
       String key = CommonUtil.keyToHashKey(downloadUrl);
-      TASK task = mCacheArray.get(key);
-      mCacheArray.remove(key);
+      TASK task = mCacheMap.get(key);
+      mCacheMap.remove(key);
       return mCacheQueue.remove(task);
     }
   }
diff --git a/Aria/src/main/java/com/arialyy/aria/core/queue/pool/ExecutePool.java b/Aria/src/main/java/com/arialyy/aria/core/queue/pool/ExecutePool.java
index b83df832..0ae398c1 100644
--- a/Aria/src/main/java/com/arialyy/aria/core/queue/pool/ExecutePool.java
+++ b/Aria/src/main/java/com/arialyy/aria/core/queue/pool/ExecutePool.java
@@ -23,6 +23,7 @@ import com.arialyy.aria.core.inf.ITask;
 import com.arialyy.aria.util.CommonUtil;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.TimeUnit;
 
@@ -35,7 +36,7 @@ public class ExecutePool implements IPool {
   private static final Object LOCK = new Object();
   private static final long TIME_OUT = 1000;
   private ArrayBlockingQueue mExecuteQueue;
-  private Map mExecuteArray;
+  private Map mExecuteMap;
   private int mSize;
 
   public ExecutePool(boolean isDownload) {
@@ -45,7 +46,14 @@ public class ExecutePool implements IPool {
       mSize = AriaManager.getInstance(AriaManager.APP).getUploadConfig().getMaxTaskNum();
     }
     mExecuteQueue = new ArrayBlockingQueue<>(mSize);
-    mExecuteArray = new HashMap<>();
+    mExecuteMap = new HashMap<>();
+  }
+
+  /**
+   * 获取所有正在执行的任务
+   */
+  public Map getAllTask() {
+    return mExecuteMap;
   }
 
   @Override public boolean putTask(TASK task) {
@@ -60,6 +68,10 @@ public class ExecutePool implements IPool {
         return false;
       } else {
         if (mExecuteQueue.size() >= mSize) {
+          Set keys = mExecuteMap.keySet();
+          for (String key : keys) {
+            if (mExecuteMap.get(key).isHighestPriorityTask()) return false;
+          }
           if (pollFirstTask()) {
             return putNewTask(task);
           }
@@ -100,7 +112,7 @@ public class ExecutePool implements IPool {
     boolean s = mExecuteQueue.offer(newTask);
     Log.w(TAG, "任务添加" + (s ? "成功" : "失败,【" + url + "】"));
     if (s) {
-      mExecuteArray.put(CommonUtil.keyToHashKey(url), newTask);
+      mExecuteMap.put(CommonUtil.keyToHashKey(url), newTask);
     }
     return s;
   }
@@ -120,7 +132,7 @@ public class ExecutePool implements IPool {
       }
       oldTask.stop();
       String key = CommonUtil.keyToHashKey(oldTask.getKey());
-      mExecuteArray.remove(key);
+      mExecuteMap.remove(key);
     } catch (InterruptedException e) {
       e.printStackTrace();
       return false;
@@ -135,7 +147,7 @@ public class ExecutePool implements IPool {
         task = mExecuteQueue.poll(TIME_OUT, TimeUnit.MICROSECONDS);
         if (task != null) {
           String url = task.getKey();
-          mExecuteArray.remove(CommonUtil.keyToHashKey(url));
+          mExecuteMap.remove(CommonUtil.keyToHashKey(url));
         }
         return task;
       } catch (InterruptedException e) {
@@ -152,7 +164,7 @@ public class ExecutePool implements IPool {
         return null;
       }
       String key = CommonUtil.keyToHashKey(downloadUrl);
-      return mExecuteArray.get(key);
+      return mExecuteMap.get(key);
     }
   }
 
@@ -163,7 +175,7 @@ public class ExecutePool implements IPool {
         return false;
       } else {
         String key = CommonUtil.keyToHashKey(task.getKey());
-        mExecuteArray.remove(key);
+        mExecuteMap.remove(key);
         return mExecuteQueue.remove(task);
       }
     }
@@ -176,8 +188,8 @@ public class ExecutePool implements IPool {
         return false;
       }
       String key = CommonUtil.keyToHashKey(downloadUrl);
-      TASK task = mExecuteArray.get(key);
-      mExecuteArray.remove(key);
+      TASK task = mExecuteMap.get(key);
+      mExecuteMap.remove(key);
       return mExecuteQueue.remove(task);
     }
   }
diff --git a/Aria/src/main/java/com/arialyy/aria/core/scheduler/DownloadSchedulers.java b/Aria/src/main/java/com/arialyy/aria/core/scheduler/DownloadSchedulers.java
index 620138d8..43b6016f 100644
--- a/Aria/src/main/java/com/arialyy/aria/core/scheduler/DownloadSchedulers.java
+++ b/Aria/src/main/java/com/arialyy/aria/core/scheduler/DownloadSchedulers.java
@@ -129,7 +129,7 @@ public class DownloadSchedulers implements ISchedulers {
       }
       switch (state) {
         case PRE:
-          listener.onPre(task.getKey());
+          listener.onPre(task);
           break;
         case POST_PRE:
           listener.onTaskPre(task);
diff --git a/Aria/src/main/java/com/arialyy/aria/core/scheduler/ISchedulerListener.java b/Aria/src/main/java/com/arialyy/aria/core/scheduler/ISchedulerListener.java
index 7a37277c..2be98fe3 100644
--- a/Aria/src/main/java/com/arialyy/aria/core/scheduler/ISchedulerListener.java
+++ b/Aria/src/main/java/com/arialyy/aria/core/scheduler/ISchedulerListener.java
@@ -25,7 +25,7 @@ public interface ISchedulerListener {
    * 预处理,有时有些地址链接比较慢,这时可以先在这个地方出来一些界面上的UI,如按钮的状态。
    * 在这个回调中,任务是获取不到文件大小,下载速度等参数
    */
-  public void onPre(String url);
+  public void onPre(TASK task);
 
   /**
    * 任务预加载完成
diff --git a/Aria/src/main/java/com/arialyy/aria/core/scheduler/UploadSchedulers.java b/Aria/src/main/java/com/arialyy/aria/core/scheduler/UploadSchedulers.java
index c1139095..1c6821c4 100644
--- a/Aria/src/main/java/com/arialyy/aria/core/scheduler/UploadSchedulers.java
+++ b/Aria/src/main/java/com/arialyy/aria/core/scheduler/UploadSchedulers.java
@@ -132,7 +132,7 @@ public class UploadSchedulers implements ISchedulers {
       }
       switch (state) {
         case PRE:
-          listener.onPre(task.getKey());
+          listener.onPre(task);
           break;
         case POST_PRE:
           listener.onTaskPre(task);
diff --git a/Aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java b/Aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java
index 6df5fdd8..b81dc90d 100644
--- a/Aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java
+++ b/Aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java
@@ -139,7 +139,7 @@ public class UploadTask implements ITask {
   }
 
   /**
-   * @return 返回转换单位后的速度,需要你在配置文件中配置,转换完成后为:1b/s、1k/s、1m/s、1g/s、1t/s
+   * @return 返回转换单位后的速度,需要你在配置文件中配置,转换完成后为:1b/s、1kb/s、1mb/s、1gb/s、1tb/s
    * 
    *   {@code
    *   
@@ -175,7 +175,7 @@ public class UploadTask implements ITask {
   /**
    * 转换单位后的文件长度
    *
-   * @return 如果文件长度为0,则返回0m,否则返回转换后的长度1b、1k、1m、1g、1t
+   * @return 如果文件长度为0,则返回0m,否则返回转换后的长度1b、1kb、1mb、1gb、1tb
    */
   @Override public String getConvertFileSize() {
     if (mUploadEntity.getFileSize() == 0) {
@@ -192,6 +192,18 @@ public class UploadTask implements ITask {
     return mUploadEntity.getCurrentProgress();
   }
 
+  /**
+   * 获取单位转换后的进度
+   *
+   * @return 如:已经下载3mb的大小,则返回{@code 3mb}
+   */
+  @Override public String getConvertCurrentProgress() {
+    if (mUploadEntity.getCurrentProgress() == 0) {
+      return "0b";
+    }
+    return CommonUtil.formatFileSize(mUploadEntity.getCurrentProgress());
+  }
+
   private static class UListener extends UploadListener {
     WeakReference outHandler;
     WeakReference task;
diff --git a/Aria/src/main/java/com/arialyy/aria/util/CommonUtil.java b/Aria/src/main/java/com/arialyy/aria/util/CommonUtil.java
index 47c59018..87e4da52 100644
--- a/Aria/src/main/java/com/arialyy/aria/util/CommonUtil.java
+++ b/Aria/src/main/java/com/arialyy/aria/util/CommonUtil.java
@@ -207,22 +207,22 @@ public class CommonUtil {
     double megaByte = kiloByte / 1024;
     if (megaByte < 1) {
       BigDecimal result1 = new BigDecimal(Double.toString(kiloByte));
-      return result1.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "k";
+      return result1.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "kb";
     }
 
     double gigaByte = megaByte / 1024;
     if (gigaByte < 1) {
       BigDecimal result2 = new BigDecimal(Double.toString(megaByte));
-      return result2.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "m";
+      return result2.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "mb";
     }
 
     double teraBytes = gigaByte / 1024;
     if (teraBytes < 1) {
       BigDecimal result3 = new BigDecimal(Double.toString(gigaByte));
-      return result3.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "g";
+      return result3.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "gb";
     }
     BigDecimal result4 = new BigDecimal(teraBytes);
-    return result4.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "t";
+    return result4.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "tb";
   }
 
   /**
diff --git a/Aria/src/main/java/com/arialyy/aria/util/FileUtil.java b/Aria/src/main/java/com/arialyy/aria/util/FileUtil.java
index fb4925e3..1f272bb5 100644
--- a/Aria/src/main/java/com/arialyy/aria/util/FileUtil.java
+++ b/Aria/src/main/java/com/arialyy/aria/util/FileUtil.java
@@ -17,7 +17,6 @@ package com.arialyy.aria.util;
 
 import android.text.TextUtils;
 import android.util.Log;
-import com.arialyy.aria.window.FileEntity;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -27,8 +26,6 @@ import java.io.InputStream;
 import java.math.BigInteger;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.List;
 
 /**
  * Created by lyy on 2017/3/21.
@@ -138,21 +135,4 @@ public class FileUtil {
       }
     }
   }
-
-  /**
-   * 文件列表
-   */
-  public List loadFiles(String path) {
-    File file = new File(path);
-    File[] files = file.listFiles();
-    List list = new ArrayList<>();
-    for (File f : files) {
-      FileEntity entity = new FileEntity();
-      entity.fileName = f.getName();
-      //entity.fileInfo = getFileType(f.getPath());
-      //entity.fileDrawable = getApkIcon(mContext, f.getPath());
-      list.add(entity);
-    }
-    return list;
-  }
 }
diff --git a/Aria/src/main/java/com/arialyy/aria/window/AriaFileChangeActivity.java b/Aria/src/main/java/com/arialyy/aria/window/AriaFileChangeActivity.java
deleted file mode 100644
index aa8ca56b..00000000
--- a/Aria/src/main/java/com/arialyy/aria/window/AriaFileChangeActivity.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.arialyy.aria.window;
-
-import android.os.Bundle;
-import android.os.Environment;
-import android.support.annotation.Nullable;
-import android.support.v4.app.FragmentActivity;
-import android.widget.AbsListView;
-import android.widget.ListView;
-import com.arialyy.aria.R;
-import com.arialyy.aria.util.FileUtil;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Created by lyy on 2017/3/21.
- * 文件选择
- */
-class AriaFileChangeActivity extends FragmentActivity {
-  final String ROOT_PAT = Environment.getExternalStorageDirectory().getPath();
-  ListView mList;
-  FileChangeAdapter mAdapter;
-  Map> mData = new HashMap<>();
-  private String mCurrentPath = ROOT_PAT;
-
-  @Override protected void onCreate(@Nullable Bundle savedInstanceState) {
-    super.onCreate(savedInstanceState);
-    setContentView(R.layout.activity_aria_file_shange);
-    mList = (ListView) findViewById(R.id.list);
-    mList.setOnScrollListener(new AbsListView.OnScrollListener() {
-      int state;
-
-      @Override public void onScrollStateChanged(AbsListView view, int scrollState) {
-        state = scrollState;
-      }
-
-      @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
-          int totalItemCount) {
-        if (state == AbsListView.OnScrollListener.SCROLL_STATE_IDLE
-            && firstVisibleItem + visibleItemCount == totalItemCount) {
-          loadMore();
-        }
-      }
-    });
-  }
-
-  private void loadMore() {
-
-  }
-}
diff --git a/Aria/src/main/java/com/arialyy/aria/window/FileChangeAdapter.java b/Aria/src/main/java/com/arialyy/aria/window/FileChangeAdapter.java
deleted file mode 100644
index c8a77ca5..00000000
--- a/Aria/src/main/java/com/arialyy/aria/window/FileChangeAdapter.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.arialyy.aria.window;
-
-import android.content.Context;
-import android.util.SparseBooleanArray;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.CheckBox;
-import android.widget.ImageView;
-import android.widget.TextView;
-import com.arialyy.aria.R;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Created by lyy on 2017/3/21.
- */
-final class FileChangeAdapter extends BaseAdapter {
-
-  List mData = new ArrayList<>();
-  SparseBooleanArray mCheck = new SparseBooleanArray();
-  Context mContext;
-
-  public FileChangeAdapter(Context context, List list) {
-    mContext = context;
-    mData.addAll(list);
-    for (int i = 0, len = mData.size(); i < len; i++) {
-      mCheck.append(i, false);
-    }
-  }
-
-  @Override public int getCount() {
-    return mData.size();
-  }
-
-  @Override public Object getItem(int position) {
-    return null;
-  }
-
-  @Override public long getItemId(int position) {
-    return 0;
-  }
-
-  @Override public View getView(int position, View convertView, ViewGroup parent) {
-    FileChangeHolder holder = null;
-    if (convertView == null) {
-      convertView = LayoutInflater.from(mContext).inflate(R.layout.item_file, null);
-      holder = new FileChangeHolder(convertView);
-      convertView.setTag(holder);
-    } else {
-      holder = (FileChangeHolder) convertView.getTag();
-    }
-
-    holder.checkBox.setChecked(mCheck.get(position, false));
-    return convertView;
-  }
-
-  public void setCheck(int position, boolean check) {
-    if (position >= mData.size()) return;
-    mCheck.put(position, check);
-    notifyDataSetChanged();
-  }
-
-  private static class FileChangeHolder {
-    TextView title, info;
-    ImageView icon;
-    CheckBox checkBox;
-
-    FileChangeHolder(View view) {
-      title = (TextView) view.findViewById(R.id.title);
-      info = (TextView) view.findViewById(R.id.info);
-      icon = (ImageView) view.findViewById(R.id.icon);
-      checkBox = (CheckBox) view.findViewById(R.id.checkbox);
-    }
-  }
-}
diff --git a/Aria/src/main/java/com/arialyy/aria/window/FileEntity.java b/Aria/src/main/java/com/arialyy/aria/window/FileEntity.java
deleted file mode 100644
index 0f05b591..00000000
--- a/Aria/src/main/java/com/arialyy/aria/window/FileEntity.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.arialyy.aria.window;
-
-import android.graphics.drawable.Drawable;
-
-/**
- * Created by lyy on 2017/3/21.
- */
-
-class FileEntity {
-  public String fileName;
-  public String fileInfo;
-  public int fileIcon;
-  public Drawable fileDrawable;
-}
diff --git a/README.md b/README.md
index 4a189153..a9e2a00f 100644
--- a/README.md
+++ b/README.md
@@ -158,7 +158,7 @@ compile 'com.arialyy.aria:Aria:3.1.4'
     
     
 
-    
+    
     
 
   
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 8e18878f..c2b2e5e9 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -29,6 +29,7 @@
     
     
     
+    
 
     
   
diff --git a/app/src/main/assets/aria_config.xml b/app/src/main/assets/aria_config.xml
index c6ca4927..0c860dd8 100644
--- a/app/src/main/assets/aria_config.xml
+++ b/app/src/main/assets/aria_config.xml
@@ -31,7 +31,7 @@
     
     
 
-    
+    
     
 
   
diff --git a/app/src/main/java/com/arialyy/simple/MainActivity.java b/app/src/main/java/com/arialyy/simple/MainActivity.java
index c9aa634d..69cd6d6e 100644
--- a/app/src/main/java/com/arialyy/simple/MainActivity.java
+++ b/app/src/main/java/com/arialyy/simple/MainActivity.java
@@ -33,11 +33,11 @@ import com.arialyy.simple.upload.UploadActivity;
  */
 public class MainActivity extends BaseActivity {
 
-  @Bind(R.id.toolbar) Toolbar mBar;
-
   @Override protected void init(Bundle savedInstanceState) {
     super.init(savedInstanceState);
+    setSupportActionBar(mBar);
     mBar.setTitle("Aria  Demo");
+    getSupportActionBar().setDisplayHomeAsUpEnabled(false);
   }
 
   @Override protected int setLayoutId() {
diff --git a/app/src/main/java/com/arialyy/simple/base/BaseActivity.java b/app/src/main/java/com/arialyy/simple/base/BaseActivity.java
index daa4b785..aa2f4a82 100644
--- a/app/src/main/java/com/arialyy/simple/base/BaseActivity.java
+++ b/app/src/main/java/com/arialyy/simple/base/BaseActivity.java
@@ -18,15 +18,21 @@ package com.arialyy.simple.base;
 
 import android.databinding.ViewDataBinding;
 import android.os.Bundle;
-import android.os.PersistableBundle;
+import android.support.v7.widget.Toolbar;
+import android.view.MenuItem;
+import butterknife.Bind;
 import com.arialyy.frame.core.AbsActivity;
 import com.arialyy.frame.util.AndroidVersionUtil;
 import com.arialyy.simple.R;
+import com.arialyy.simple.common.MsgDialog;
 
 /**
  * Created by Lyy on 2016/9/27.
  */
-public abstract class BaseActivity extends AbsActivity {
+public abstract class BaseActivity extends AbsActivity
+    implements Toolbar.OnMenuItemClickListener {
+
+  @Bind(R.id.toolbar) protected Toolbar mBar;
 
   @Override protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
@@ -35,11 +41,36 @@ public abstract class BaseActivity extends AbsActivi
     }
   }
 
-  @Override protected void dataCallback(int result, Object data) {
+  @Override protected void init(Bundle savedInstanceState) {
+    super.init(savedInstanceState);
+    setSupportActionBar(mBar);
+    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+    mBar.setOnMenuItemClickListener(this);
+  }
 
+  protected void setTile(String title){
+    mBar.setTitle(title);
   }
 
-  @Override protected void init(Bundle savedInstanceState) {
-    super.init(savedInstanceState);
+  protected void showMsgDialog(String title, String msg){
+    MsgDialog dialog = new MsgDialog(this, title, msg);
+    dialog.show(getSupportFragmentManager(), "msg_dialog");
+  }
+
+  @Override public boolean onMenuItemClick(MenuItem item) {
+
+    return false;
+  }
+
+  @Override public boolean onOptionsItemSelected(MenuItem item) {
+    if (item.getItemId() == android.R.id.home) {
+      finish();
+      return true;
+    }
+    return super.onOptionsItemSelected(item);
+  }
+
+  @Override protected void dataCallback(int result, Object data) {
+
   }
 }
\ No newline at end of file
diff --git a/app/src/main/java/com/arialyy/simple/common/MsgDialog.java b/app/src/main/java/com/arialyy/simple/common/MsgDialog.java
new file mode 100644
index 00000000..cfedad38
--- /dev/null
+++ b/app/src/main/java/com/arialyy/simple/common/MsgDialog.java
@@ -0,0 +1,38 @@
+package com.arialyy.simple.common;
+
+import android.annotation.SuppressLint;
+import android.os.Bundle;
+import butterknife.OnClick;
+import com.arialyy.frame.util.show.T;
+import com.arialyy.simple.R;
+import com.arialyy.simple.base.BaseDialog;
+import com.arialyy.simple.databinding.DialogMsgBinding;
+
+/**
+ * Created by AriaL on 2017/6/3.
+ */
+@SuppressLint("ValidFragment") public class MsgDialog extends BaseDialog {
+
+  private String mTitle, mMsg;
+
+  public MsgDialog(Object obj, String title, String msg) {
+    super(obj);
+    mTitle = title;
+    mMsg = msg;
+  }
+
+  @Override protected void init(Bundle savedInstanceState) {
+    super.init(savedInstanceState);
+    getBinding().setTitle(mTitle);
+    getBinding().setMsg(mMsg);
+  }
+
+  @Override protected int setLayoutId() {
+    return R.layout.dialog_msg;
+  }
+
+  @OnClick(R.id.enter)
+  public void close(){
+    dismiss();
+  }
+}
diff --git a/app/src/main/java/com/arialyy/simple/download/DownloadActivity.java b/app/src/main/java/com/arialyy/simple/download/DownloadActivity.java
index 04084e06..5bd09c1a 100644
--- a/app/src/main/java/com/arialyy/simple/download/DownloadActivity.java
+++ b/app/src/main/java/com/arialyy/simple/download/DownloadActivity.java
@@ -39,7 +39,6 @@ import com.arialyy.simple.download.service_download.DownloadService;
  * Created by Lyy on 2016/10/13.
  */
 public class DownloadActivity extends BaseActivity {
-  @Bind(R.id.toolbar) Toolbar mBar;
   @Bind(R.id.single_task) Button mSigleBt;
   @Bind(R.id.multi_task) Button mMultiBt;
   @Bind(R.id.dialog_task) Button mDialogBt;
@@ -51,8 +50,7 @@ public class DownloadActivity extends BaseActivity
 
   @Override protected void init(Bundle savedInstanceState) {
     super.init(savedInstanceState);
-    setSupportActionBar(mBar);
-    mBar.setTitle("多线程多任务下载");
+    setTitle("Aria下载");
     if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
       setEnable(true);
     } else {  //6.0处理
@@ -85,6 +83,9 @@ public class DownloadActivity extends BaseActivity
 
   public void onClick(View view) {
     switch (view.getId()) {
+      case R.id.highest_priority:
+        startActivity(new Intent(this, HighestPriorityActivity.class));
+        break;
       case R.id.service:
         startService(new Intent(this, DownloadService.class));
         break;
@@ -100,7 +101,6 @@ public class DownloadActivity extends BaseActivity
         break;
       case R.id.pop_task:
         DownloadPopupWindow pop = new DownloadPopupWindow(this);
-        //pop.showAsDropDown(mRootView);
         pop.showAtLocation(mRootView, Gravity.CENTER_VERTICAL, 0, 0);
         break;
       case R.id.fragment_task:
diff --git a/app/src/main/java/com/arialyy/simple/download/DownloadModule.java b/app/src/main/java/com/arialyy/simple/download/DownloadModule.java
index 65eeb9ce..f4c2e831 100644
--- a/app/src/main/java/com/arialyy/simple/download/DownloadModule.java
+++ b/app/src/main/java/com/arialyy/simple/download/DownloadModule.java
@@ -20,6 +20,7 @@ import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.res.Resources;
 import android.os.Environment;
 import android.os.Handler;
 import com.arialyy.aria.core.Aria;
@@ -33,6 +34,7 @@ import com.arialyy.simple.download.multi_download.FileListEntity;
 import com.arialyy.simple.base.BaseModule;
 import java.io.File;
 import java.util.ArrayList;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Random;
 
@@ -40,39 +42,29 @@ import java.util.Random;
  * Created by Lyy on 2016/9/27.
  */
 public class DownloadModule extends BaseModule {
-  private List mTestDownloadUrl = new ArrayList<>();
 
   public DownloadModule(Context context) {
     super(context);
-    mTestDownloadUrl.add(
-        "http://static.gaoshouyou.com/d/e6/f5/4de6329f9cf5dc3a1d1e6bbcca0d003c.apk");
-    mTestDownloadUrl.add(
-        "http://static.gaoshouyou.com/d/6e/e5/ff6ecaaf45e532e6d07747af82357472.apk");
-    mTestDownloadUrl.add(
-        "http://static.gaoshouyou.com/d/36/69/2d3699acfa69e9632262442c46516ad8.apk");
   }
 
   /**
-   * 获取下载列表
+   * 最高优先级任务测试列表
    */
-  public List getDownloadTaskList() {
-    return Aria.download(getContext()).getTaskList();
-  }
-
-  public String getRadomUrl() {
-    Random random = new Random();
-    int i = random.nextInt(2);
-    return mTestDownloadUrl.get(i);
-  }
-
-  public DownloadEntity createRandomDownloadEntity() {
-    return createDownloadEntity(getRadomUrl());
+  public List getHighestTestList() {
+    List list = new LinkedList<>();
+    Resources res = getContext().getResources();
+    String[] urls = res.getStringArray(R.array.highest_urls);
+    String[] names = res.getStringArray(R.array.highest_names);
+    for (int i = 0, len = urls.length; i < len; i++) {
+      list.add(createDownloadEntity(urls[i], names[i]));
+    }
+    return list;
   }
 
   /**
    * 创建下载地址
    */
-  public List createFileList() {
+  public List createMultiTestList() {
     String[] names = getContext().getResources().getStringArray(R.array.file_nams);
     String[] downloadUrl = getContext().getResources().getStringArray(R.array.download_url);
     List list = new ArrayList<>();
@@ -89,70 +81,17 @@ public class DownloadModule extends BaseModule {
   }
 
   /**
-   * 设置下载数据
+   * 创建下载实体,Aria也可以通过下载实体启动下载
    */
-  public List getDownloadData() {
-    String[] urls = getContext().getResources().getStringArray(R.array.test_apk_download_url);
-    List list = new ArrayList<>();
-    for (String url : urls) {
-      DownloadEntity entity = Aria.download(getContext()).getDownloadEntity(url);
-      if (entity == null) {
-        entity = createDownloadEntity(url);
-      }
-      list.add(entity);
-    }
-    return list;
-  }
-
-  /**
-   * 过滤任务
-   *
-   * @param sqlEntity 数据库的下载实体
-   * @param createdEntity 通过下载链接生成的下载实体
-   */
-  private List filter(List sqlEntity,
-      List createdEntity) {
-    List list = new ArrayList<>();
-    list.addAll(sqlEntity);
-    for (DownloadEntity cEntity : createdEntity) {
-      int count = 0;
-      for (DownloadEntity sEntity : sqlEntity) {
-        if (cEntity.getDownloadUrl().equals(sEntity.getDownloadUrl())) {
-          break;
-        }
-        count++;
-        if (count == createdEntity.size()) {
-          list.add(cEntity);
-        }
-      }
-    }
-    return list;
-  }
-
-  private DownloadEntity createDownloadEntity(String url) {
-    String fileName = CommonUtil.keyToHashCode(url) + ".apk";
+  private DownloadEntity createDownloadEntity(String downloadUrl, String name) {
+    String path = Environment.getExternalStorageDirectory() + "/download/" + name + ".apk";
     DownloadEntity entity = new DownloadEntity();
-    entity.setDownloadUrl(url);
-    entity.setDownloadPath(getDownloadPath(url));
-    entity.setFileName(fileName);
-    //entity.setFileName("taskName_________" + i);
+    entity.setFileName(name);
+    entity.setDownloadUrl(downloadUrl);
+    entity.setDownloadPath(path);
     return entity;
   }
 
-  /**
-   * 创建下载列表
-   */
-  private List createNewDownload() {
-    List list = new ArrayList<>();
-    String[] urls = getContext().getResources().getStringArray(R.array.test_apk_download_url);
-    int i = 0;
-    for (String url : urls) {
-      list.add(createDownloadEntity(url));
-      i++;
-    }
-    return list;
-  }
-
   /**
    * 下载广播过滤器
    */
@@ -218,18 +157,4 @@ public class DownloadModule extends BaseModule {
       }
     };
   }
-
-  /**
-   * 设置下载队列
-   */
-  private String getDownloadPath(String url) {
-    String path =
-        Environment.getExternalStorageDirectory().getPath() + "/" + AndroidUtils.getAppName(
-            getContext()) + "downloads/" + StringUtil.keyToHashKey(url) + ".apk";
-    File file = new File(path);
-    if (!file.getParentFile().exists()) {
-      file.getParentFile().mkdirs();
-    }
-    return path;
-  }
 }
\ No newline at end of file
diff --git a/app/src/main/java/com/arialyy/simple/download/HighestPriorityActivity.java b/app/src/main/java/com/arialyy/simple/download/HighestPriorityActivity.java
index 00a3e74c..0fca613c 100644
--- a/app/src/main/java/com/arialyy/simple/download/HighestPriorityActivity.java
+++ b/app/src/main/java/com/arialyy/simple/download/HighestPriorityActivity.java
@@ -4,20 +4,27 @@ import android.os.Bundle;
 import android.os.Environment;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.Toolbar;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
 import android.view.View;
 import android.widget.Button;
 import android.widget.TextView;
 import butterknife.Bind;
 import com.arialyy.aria.core.Aria;
-import com.arialyy.aria.core.download.DownloadTarget;
+import com.arialyy.aria.core.download.DownloadEntity;
 import com.arialyy.aria.core.download.DownloadTask;
+import com.arialyy.aria.core.inf.IEntity;
 import com.arialyy.frame.util.show.L;
 import com.arialyy.simple.R;
 import com.arialyy.simple.base.BaseActivity;
 import com.arialyy.simple.databinding.ActivityHighestPriorityBinding;
 import com.arialyy.simple.download.multi_download.DownloadAdapter;
 import com.arialyy.simple.widget.HorizontalProgressBarWithNumber;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
 
 /**
  * Created by lyy on 2017/6/2.
@@ -29,14 +36,15 @@ public class HighestPriorityActivity extends BaseActivity mData = new ArrayList<>();
+  private Set mRecord = new HashSet<>();
 
   @Override protected int setLayoutId() {
     return R.layout.activity_highest_priority;
@@ -44,17 +52,27 @@ public class HighestPriorityActivity extends BaseActivity temp = Aria.download(this).getTaskList();
+    if (temp != null && !temp.isEmpty()) {
+      for (DownloadEntity entity : temp) {
+        if (entity.getDownloadUrl().equals(DOWNLOAD_URL)) continue;
+        mData.add(entity);
+        mRecord.add(entity.getDownloadUrl());
+      }
     }
-    mAdapter = new DownloadAdapter(this, getModule(DownloadModule.class).getDownloadTaskList());
+    mAdapter = new DownloadAdapter(this, mData);
     mList.setLayoutManager(new LinearLayoutManager(this));
     mList.setAdapter(mAdapter);
   }
@@ -64,6 +82,41 @@ public class HighestPriorityActivity extends BaseActivity temp = getModule(DownloadModule.class).getHighestTestList();
+        for (DownloadEntity entity : temp) {
+          String url = entity.getDownloadUrl();
+          if (mRecord.contains(url)) {
+            continue;
+          }
+          mAdapter.addDownloadEntity(entity);
+          mRecord.add(url);
+        }
+        mAdapter.notifyDataSetChanged();
+        break;
+      case R.id.help:
+        String title = "最高优先级任务介绍";
+        String msg = " 将任务设置为最高优先级任务,最高优先级任务有以下特点:\n"
+            + " 1、在下载队列中,有且只有一个最高优先级任务\n"
+            + " 2、最高优先级任务会一直存在,直到用户手动暂停或任务完成\n"
+            + " 3、任务调度器不会暂停最高优先级任务\n"
+            + " 4、用户手动暂停或任务完成后,第二次重新执行该任务,该命令将失效\n"
+            + " 5、如果下载队列中已经满了,则会停止队尾的任务\n"
+            + " 6、把任务设置为最高优先级任务后,将自动执行任务,不需要重新调用start()启动任务";
+        showMsgDialog(title, msg);
+        break;
+    }
+    return true;
+  }
+
   public void onClick(View view) {
     switch (view.getId()) {
       case R.id.start:
@@ -99,45 +152,46 @@ public class HighestPriorityActivity extends BaseActivity {
   @Bind(R.id.stop) Button mStop;
   @Bind(R.id.cancel) Button mCancel;
   @Bind(R.id.size) TextView mSize;
-  @Bind(R.id.toolbar) Toolbar toolbar;
   @Bind(R.id.speed) TextView mSpeed;
   @Bind(R.id.speeds) RadioGroup mRg;
   private DownloadEntity mEntity;
@@ -140,11 +140,6 @@ public class SingleTaskActivity extends BaseActivity {
     mStop.setEnabled(!state);
   }
 
-  @Override protected void onCreate(Bundle savedInstanceState) {
-    super.onCreate(savedInstanceState);
-    init();
-  }
-
   @Override protected void onResume() {
     super.onResume();
     Aria.download(this).addSchedulerListener(new MySchedulerListener());
@@ -157,16 +152,14 @@ public class SingleTaskActivity extends BaseActivity {
 
   @Override protected void init(Bundle savedInstanceState) {
     super.init(savedInstanceState);
-    setSupportActionBar(toolbar);
-    toolbar.setTitle("单任务下载");
-    init();
-    Aria.get(this).getDownloadConfig().setOpenBreadCast(true);
-  }
-
-  private void init() {
+    setTitle("单任务下载");
     if (Aria.download(this).taskExists(DOWNLOAD_URL)) {
       mPb.setProgress(Aria.download(this).load(DOWNLOAD_URL).getPercent());
+      if (Aria.download(this).load(DOWNLOAD_URL).getTaskState() == IEntity.STATE_STOP) {
+        mStart.setText("恢复");
+      }
     }
+    Aria.get(this).getDownloadConfig().setOpenBreadCast(true);
   }
 
   public void onClick(View view) {
@@ -193,9 +186,8 @@ public class SingleTaskActivity extends BaseActivity {
 
   private class MySchedulerListener extends Aria.DownloadSchedulerListener {
 
-    @Override public void onPre(String url) {
-      super.onPre(url);
-      Log.d(TAG, "url ==> " + url);
+    @Override public void onPre(DownloadTask task) {
+      super.onPre(task);
     }
 
     @Override public void onNoSupportBreakPoint(DownloadTask task) {
diff --git a/app/src/main/java/com/arialyy/simple/download/multi_download/DownloadAdapter.java b/app/src/main/java/com/arialyy/simple/download/multi_download/DownloadAdapter.java
index ff8da924..4b3dff78 100644
--- a/app/src/main/java/com/arialyy/simple/download/multi_download/DownloadAdapter.java
+++ b/app/src/main/java/com/arialyy/simple/download/multi_download/DownloadAdapter.java
@@ -55,6 +55,11 @@ public class DownloadAdapter extends AbsRVAdapter {
   @Bind(R.id.list) RecyclerView mList;
-  @Bind(R.id.toolbar) Toolbar mBar;
   private DownloadAdapter mAdapter;
 
   @Override protected int setLayoutId() {
@@ -43,14 +42,10 @@ public class MultiDownloadActivity extends BaseActivity {
 
   @Override protected void init(Bundle savedInstanceState) {
     super.init(savedInstanceState);
-    setSupportActionBar(mBar);
-    mBar.setTitle("多任务下载");
-    mData.addAll(getModule(DownloadModule.class).createFileList());
+    setTitle("多任务下载");
+    mData.addAll(getModule(DownloadModule.class).createMultiTestList());
     mAdapter = new FileListAdapter(this, mData);
     mList.setLayoutManager(new LinearLayoutManager(this));
     mList.setAdapter(mAdapter);
diff --git a/app/src/main/java/com/arialyy/simple/upload/UploadActivity.java b/app/src/main/java/com/arialyy/simple/upload/UploadActivity.java
index d6597b7e..f958789b 100644
--- a/app/src/main/java/com/arialyy/simple/upload/UploadActivity.java
+++ b/app/src/main/java/com/arialyy/simple/upload/UploadActivity.java
@@ -108,9 +108,8 @@ public class UploadActivity extends BaseActivity {
       this.handler = new WeakReference<>(handler);
     }
 
-    @Override public void onPre(String url) {
-      super.onPre(url);
-      L.e(TAG, "url ==> " + url);
+    @Override public void onPre(UploadTask task) {
+      super.onPre(task);
     }
 
     @Override public void onTaskPre(UploadTask task) {
diff --git a/app/src/main/res/layout/activity_highest_priority.xml b/app/src/main/res/layout/activity_highest_priority.xml
index 4ffcbd98..48aa48cd 100644
--- a/app/src/main/res/layout/activity_highest_priority.xml
+++ b/app/src/main/res/layout/activity_highest_priority.xml
@@ -35,12 +35,18 @@
         android:layout_below="@+id/name"
         />
 
+    
+
     
 
   
diff --git a/app/src/main/res/layout/dialog_msg.xml b/app/src/main/res/layout/dialog_msg.xml
new file mode 100644
index 00000000..61a9dd99
--- /dev/null
+++ b/app/src/main/res/layout/dialog_msg.xml
@@ -0,0 +1,63 @@
+
+
+  
+    
+    
+  
+  
+
+
+    
+
+    
+      
+    
+
+