diff --git a/Aria/src/main/java/com/arialyy/aria/core/common/BaseListener.java b/Aria/src/main/java/com/arialyy/aria/core/common/BaseListener.java new file mode 100644 index 00000000..cf182319 --- /dev/null +++ b/Aria/src/main/java/com/arialyy/aria/core/common/BaseListener.java @@ -0,0 +1,139 @@ +/* + * 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.core.common; + +import android.os.Handler; +import com.arialyy.aria.core.AriaManager; +import com.arialyy.aria.core.inf.AbsEntity; +import com.arialyy.aria.core.inf.AbsTask; +import com.arialyy.aria.core.inf.AbsTaskEntity; +import com.arialyy.aria.core.inf.IEntity; +import com.arialyy.aria.core.inf.IEventListener; +import com.arialyy.aria.core.inf.TaskSchedulerType; +import com.arialyy.aria.core.scheduler.ISchedulers; +import com.arialyy.aria.util.CommonUtil; +import java.lang.ref.WeakReference; + +public abstract class BaseListener, TASK extends AbsTask> + implements IEventListener { + private static final String TAG = "BaseListener"; + protected WeakReference outHandler; + private int RUN_SAVE_INTERVAL = 5 * 1000; //5s保存一次下载中的进度 + private long mLastLen; //上一次发送长度 + private boolean isFirst = true; + private TASK mTask; + private long mLastSaveTime; + protected ENTITY mEntity; + protected TASK_ENTITY mTaskEntity; + protected boolean isConvertSpeed; + protected long mUpdateInterval; + protected AriaManager manager; + + protected BaseListener(TASK task, Handler outHandler) { + this.outHandler = new WeakReference<>(outHandler); + this.mTask = new WeakReference<>(task).get(); + this.mEntity = mTask.getTaskEntity().getEntity(); + this.mTaskEntity = mTask.getTaskEntity(); + manager = AriaManager.getInstance(AriaManager.APP); + mLastLen = mEntity.getCurrentProgress(); + mLastSaveTime = System.currentTimeMillis(); + } + + @Override public void onPre() { + saveData(IEntity.STATE_PRE, -1); + sendInState2Target(ISchedulers.PRE); + } + + @Override public void onStart(long startLocation) { + saveData(IEntity.STATE_RUNNING, startLocation); + sendInState2Target(ISchedulers.START); + } + + @Override public void onResume(long resumeLocation) { + saveData(IEntity.STATE_RUNNING, resumeLocation); + sendInState2Target(ISchedulers.RESUME); + } + + @Override public void onProgress(long currentLocation) { + mEntity.setCurrentProgress(currentLocation); + long speed = currentLocation - mLastLen; + if (isFirst) { + speed = 0; + isFirst = false; + } + handleSpeed(speed); + sendInState2Target(ISchedulers.RUNNING); + if (System.currentTimeMillis() - mLastSaveTime >= RUN_SAVE_INTERVAL) { + saveData(IEntity.STATE_RUNNING, currentLocation); + mLastSaveTime = System.currentTimeMillis(); + } + + mLastLen = currentLocation; + } + + @Override public void onStop(long stopLocation) { + saveData(mTask.getSchedulerType() == TaskSchedulerType.TYPE_STOP_AND_WAIT ? IEntity.STATE_WAIT + : IEntity.STATE_STOP, stopLocation); + handleSpeed(0); + sendInState2Target(ISchedulers.STOP); + } + + @Override public void onComplete() { + saveData(IEntity.STATE_COMPLETE, mEntity.getFileSize()); + handleSpeed(0); + sendInState2Target(ISchedulers.COMPLETE); + } + + @Override public void onCancel() { + saveData(IEntity.STATE_CANCEL, -1); + handleSpeed(0); + sendInState2Target(ISchedulers.CANCEL); + } + + @Override public void onFail(boolean needRetry) { + mEntity.setFailNum(mEntity.getFailNum() + 1); + saveData(IEntity.STATE_FAIL, mEntity.getCurrentProgress()); + handleSpeed(0); + mTask.needRetry = needRetry; + sendInState2Target(ISchedulers.FAIL); + } + + private void handleSpeed(long speed) { + if (mUpdateInterval != 1000) { + speed = speed * 1000 / mUpdateInterval; + } + if (isConvertSpeed) { + mEntity.setConvertSpeed(CommonUtil.formatFileSize(speed < 0 ? 0 : speed) + "/s"); + } + mEntity.setSpeed(speed < 0 ? 0 : speed); + + mEntity.setPercent((int) (mEntity.getFileSize() <= 0 ? 0 + : mEntity.getCurrentProgress() * 100 / mEntity.getFileSize())); + } + + /** + * 将任务状态发送给下载器 + * + * @param state {@link ISchedulers#START} + */ + protected void sendInState2Target(int state) { + if (outHandler.get() != null) { + outHandler.get().obtainMessage(state, mTask).sendToTarget(); + } + } + + protected abstract void saveData(int state, long location); +} diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/BaseDListener.java b/Aria/src/main/java/com/arialyy/aria/core/download/BaseDListener.java index 9f375155..a2ddef33 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/BaseDListener.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/BaseDListener.java @@ -16,53 +16,27 @@ package com.arialyy.aria.core.download; import android.os.Handler; -import com.arialyy.aria.core.AriaManager; +import com.arialyy.aria.core.common.BaseListener; import com.arialyy.aria.core.common.TaskRecord; -import com.arialyy.aria.core.inf.AbsEntity; -import com.arialyy.aria.core.inf.AbsTask; -import com.arialyy.aria.core.inf.AbsTaskEntity; import com.arialyy.aria.core.inf.IDownloadListener; import com.arialyy.aria.core.inf.IEntity; -import com.arialyy.aria.core.inf.TaskSchedulerType; import com.arialyy.aria.core.scheduler.ISchedulers; import com.arialyy.aria.orm.DbEntity; import com.arialyy.aria.util.CommonUtil; -import java.lang.ref.WeakReference; /** * 下载监听类 */ -class BaseDListener, TASK extends AbsTask> +class BaseDListener extends BaseListener implements IDownloadListener { private static final String TAG = "BaseDListener"; - WeakReference outHandler; - private int RUN_SAVE_INTERVAL = 5 * 1000; //5s保存一次下载中的进度 - private long mLastLen; //上一次发送长度 - private boolean isFirst = true; - protected ENTITY mEntity; - protected TASK_ENTITY mTaskEntity; - private TASK mTask; - private boolean isConvertSpeed; - private long mLastSaveTime; - private long mUpdateInterval; - BaseDListener(TASK task, Handler outHandler) { - this.outHandler = new WeakReference<>(outHandler); - this.mTask = new WeakReference<>(task).get(); - this.mEntity = mTask.getTaskEntity().getEntity(); - this.mTaskEntity = mTask.getTaskEntity(); - final AriaManager manager = AriaManager.getInstance(AriaManager.APP); + BaseDListener(DownloadTask task, Handler outHandler) { + super(task, outHandler); isConvertSpeed = manager.getDownloadConfig().isConvertSpeed(); - mLastLen = mEntity.getCurrentProgress(); - mLastSaveTime = System.currentTimeMillis(); mUpdateInterval = manager.getDownloadConfig().getUpdateInterval(); } - @Override public void onPre() { - saveData(IEntity.STATE_PRE, -1); - sendInState2Target(ISchedulers.PRE); - } - @Override public void onPostPre(long fileSize) { mEntity.setFileSize(fileSize); mEntity.setConvertFileSize(CommonUtil.formatFileSize(fileSize)); @@ -74,84 +48,8 @@ class BaseDListener= RUN_SAVE_INTERVAL) { - saveData(IEntity.STATE_RUNNING, currentLocation); - mLastSaveTime = System.currentTimeMillis(); - } - - mLastLen = currentLocation; - } - - @Override public void onStop(long stopLocation) { - saveData(mTask.getSchedulerType() == TaskSchedulerType.TYPE_STOP_AND_WAIT ? IEntity.STATE_WAIT : IEntity.STATE_STOP, stopLocation); - handleSpeed(0); - sendInState2Target(ISchedulers.STOP); - } - - @Override public void onCancel() { - saveData(IEntity.STATE_CANCEL, -1); - handleSpeed(0); - sendInState2Target(ISchedulers.CANCEL); - } - - @Override public void onComplete() { - saveData(IEntity.STATE_COMPLETE, mEntity.getFileSize()); - handleSpeed(0); - sendInState2Target(ISchedulers.COMPLETE); - } - - @Override public void onFail(boolean needRetry) { - mEntity.setFailNum(mEntity.getFailNum() + 1); - saveData(IEntity.STATE_FAIL, mEntity.getCurrentProgress()); - handleSpeed(0); - mTask.needRetry = needRetry; - sendInState2Target(ISchedulers.FAIL); - } - - private void handleSpeed(long speed) { - if (mUpdateInterval != 1000) { - speed = speed * 1000 / mUpdateInterval; - } - if (isConvertSpeed) { - mEntity.setConvertSpeed(CommonUtil.formatFileSize(speed < 0 ? 0 : speed) + "/s"); - } - mEntity.setSpeed(speed < 0 ? 0 : speed); - - mEntity.setPercent((int) (mEntity.getFileSize() <= 0 ? 0 - : mEntity.getCurrentProgress() * 100 / mEntity.getFileSize())); - } - - /** - * 将任务状态发送给下载器 - * - * @param state {@link ISchedulers#START} - */ - private void sendInState2Target(int state) { - if (outHandler.get() != null) { - outHandler.get().obtainMessage(state, mTask).sendToTarget(); - } - } - - private void saveData(int state, long location) { + @Override + protected void saveData(int state, long location) { mTaskEntity.setState(state); mEntity.setState(state); mEntity.setComplete(state == IEntity.STATE_COMPLETE); @@ -160,14 +58,11 @@ class BaseDListener extends AbsDownloadTarget { diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupListener.java b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupListener.java index d029b959..403d9e1b 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupListener.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupListener.java @@ -16,17 +16,20 @@ package com.arialyy.aria.core.download; import android.os.Handler; +import com.arialyy.aria.core.common.BaseListener; import com.arialyy.aria.core.download.downloader.IDownloadGroupListener; import com.arialyy.aria.core.inf.GroupSendParams; +import com.arialyy.aria.core.inf.IEntity; import com.arialyy.aria.core.scheduler.ISchedulers; import com.arialyy.aria.util.ALog; +import com.arialyy.aria.util.CommonUtil; /** * Created by Aria.Lao on 2017/7/20. * 任务组下载事件 */ class DownloadGroupListener - extends BaseDListener + extends BaseListener implements IDownloadGroupListener { private final String TAG = "DownloadGroupListener"; private GroupSendParams mSeedEntity; @@ -35,6 +38,8 @@ class DownloadGroupListener super(task, outHandler); mSeedEntity = new GroupSendParams<>(); mSeedEntity.groupTask = task; + isConvertSpeed = manager.getDownloadConfig().isConvertSpeed(); + mUpdateInterval = manager.getDownloadConfig().getUpdateInterval(); } @Override public void onSubPre(DownloadEntity subEntity) { @@ -100,4 +105,36 @@ class DownloadGroupListener mEntity.setCurrentProgress(location); mEntity.update(); } + + @Override public void onPostPre(long fileSize) { + mEntity.setFileSize(fileSize); + mEntity.setConvertFileSize(CommonUtil.formatFileSize(fileSize)); + saveData(IEntity.STATE_POST_PRE, -1); + sendInState2Target(ISchedulers.POST_PRE); + } + + @Override public void supportBreakpoint(boolean support) { + + } + + @Override protected void saveData(int state, long location) { + mTaskEntity.setState(state); + mEntity.setState(state); + mEntity.setComplete(state == IEntity.STATE_COMPLETE); + if (state == IEntity.STATE_CANCEL) { + if (mEntity instanceof DownloadGroupEntity) { + CommonUtil.delGroupTaskRecord(mTaskEntity.isRemoveFile(), mEntity); + } + return; + } else if (state == IEntity.STATE_STOP) { + mEntity.setStopTime(System.currentTimeMillis()); + } else if (mEntity.isComplete()) { + mEntity.setCompleteTime(System.currentTimeMillis()); + mEntity.setCurrentProgress(mEntity.getFileSize()); + } + if (location > 0) { + mEntity.setCurrentProgress(location); + } + mTaskEntity.update(); + } } diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupTarget.java b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupTarget.java index 6a1adcf4..9a35d94b 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupTarget.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupTarget.java @@ -262,15 +262,16 @@ public class DownloadGroupTarget extends BaseGroupTarget im if (!newName.equals(entity.getFileName())) { String oldPath = mEntity.getDirPath() + "/" + entity.getFileName(); String newPath = mEntity.getDirPath() + "/" + newName; - File oldFile = new File(oldPath); - if (oldFile.exists()) { - oldFile.renameTo(new File(newPath)); - } if (DbEntity.checkDataExist(DownloadEntity.class, "downloadPath=? or isComplete='true'", newPath)) { ALog.w(TAG, String.format("更新文件名失败,路径【%s】已存在或文件已下载", newPath)); return; } + File oldFile = new File(oldPath); + if (oldFile.exists()) { + oldFile.renameTo(new File(newPath)); + } + CommonUtil.modifyTaskRecord(oldFile.getPath(), newPath); entity.setDownloadPath(newPath); taskEntity.setKey(newPath); diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadListener.java b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadListener.java deleted file mode 100644 index 78cf1d9f..00000000 --- a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadListener.java +++ /dev/null @@ -1,35 +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.core.download; - -import android.os.Handler; -import com.arialyy.aria.core.inf.IDownloadListener; - -/** - * Created by Aria.Lao on 2017/7/20. - * 普通任务下载的事件监听器 - */ -class DownloadListener extends BaseDListener - implements IDownloadListener { - DownloadListener(DownloadTask task, Handler outHandler) { - super(task, outHandler); - } - - @Override public void supportBreakpoint(boolean support) { - - } - -} 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 6e0776b1..83a3f5e2 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 @@ -37,7 +37,7 @@ public class DownloadTask extends AbsNormalTask, TASK extends AbsTask> +class BaseUListener extends BaseListener implements IUploadListener { - private WeakReference outHandler; - private int RUN_SAVE_INTERVAL = 5 * 1000; //5s保存一次下载中的进度 - private long mLastLen = 0; //上一次发送长度 - private boolean isFirst = true; - protected ENTITY mEntity; - protected TASK_ENTITY mTaskEntity; - protected TASK mTask; - private boolean isConvertSpeed = false; - private long mLastSaveTime; - private long mUpdateInterval; - BaseUListener(TASK task, Handler outHandler) { - this.outHandler = new WeakReference<>(outHandler); - this.mTask = new WeakReference<>(task).get(); - this.mEntity = this.mTask.getTaskEntity().getEntity(); - this.mTaskEntity = this.mTask.getTaskEntity(); - final AriaManager manager = AriaManager.getInstance(AriaManager.APP); - isConvertSpeed = manager.getDownloadConfig().isConvertSpeed(); - mLastLen = mEntity.getCurrentProgress(); - mLastSaveTime = System.currentTimeMillis(); + BaseUListener(UploadTask task, Handler outHandler) { + super(task, outHandler); + isConvertSpeed = manager.getUploadConfig().isConvertSpeed(); mUpdateInterval = manager.getUploadConfig().getUpdateInterval(); } - @Override public void onPre() { - saveData(IEntity.STATE_PRE, -1); - sendInState2Target(ISchedulers.PRE); - } - - @Override public void onStart(long startLocation) { - saveData(IEntity.STATE_RUNNING, startLocation); - sendInState2Target(ISchedulers.START); - } - - @Override public void onResume(long resumeLocation) { - saveData(IEntity.STATE_RUNNING, resumeLocation); - sendInState2Target(ISchedulers.RESUME); - } - - @Override public void onProgress(long currentLocation) { - mEntity.setCurrentProgress(currentLocation); - long speed = currentLocation - mLastLen; - if (isFirst) { - speed = 0; - isFirst = false; - } - handleSpeed(speed); - sendInState2Target(ISchedulers.RUNNING); - if (System.currentTimeMillis() - mLastSaveTime >= RUN_SAVE_INTERVAL) { - saveData(IEntity.STATE_RUNNING, currentLocation); - mLastSaveTime = System.currentTimeMillis(); - } - mLastLen = currentLocation; - } - - @Override public void onStop(long stopLocation) { - saveData(mTask.getSchedulerType() == TaskSchedulerType.TYPE_STOP_AND_WAIT ? IEntity.STATE_WAIT - : IEntity.STATE_STOP, stopLocation); - handleSpeed(0); - sendInState2Target(ISchedulers.STOP); - } - - @Override public void onCancel() { - saveData(IEntity.STATE_CANCEL, -1); - handleSpeed(0); - sendInState2Target(ISchedulers.CANCEL); - } - - @Override public void onComplete() { - saveData(IEntity.STATE_COMPLETE, mEntity.getFileSize()); - handleSpeed(0); - sendInState2Target(ISchedulers.COMPLETE); - } - - @Override public void onFail(boolean needRetry) { - mEntity.setFailNum(mEntity.getFailNum() + 1); - saveData(IEntity.STATE_FAIL, mEntity.getCurrentProgress()); - handleSpeed(0); - mTask.needRetry = needRetry; - sendInState2Target(ISchedulers.FAIL); - } - - private void handleSpeed(long speed) { - if (mUpdateInterval != 1000) { - speed = speed * 1000 / mUpdateInterval; - } - if (isConvertSpeed) { - mEntity.setConvertSpeed(CommonUtil.formatFileSize(speed < 0 ? 0 : speed) + "/s"); - } - mEntity.setSpeed(speed < 0 ? 0 : speed); - mEntity.setPercent((int) (mEntity.getFileSize() <= 0 ? 0 - : mEntity.getCurrentProgress() * 100 / mEntity.getFileSize())); - } - - /** - * 将任务状态发送给下载器 - * - * @param state {@link ISchedulers#START} - */ - private void sendInState2Target(int state) { - if (outHandler.get() != null) { - outHandler.get().obtainMessage(state, mTask).sendToTarget(); - } - } - - private void saveData(int state, long location) { + @Override + protected void saveData(int state, long location) { mTaskEntity.setState(state); mEntity.setState(state); mEntity.setComplete(state == IEntity.STATE_COMPLETE); @@ -147,7 +45,7 @@ class BaseUListener * diff --git a/AriaAnnotations/src/main/java/com/arialyy/annotations/DownloadGroup.java b/AriaAnnotations/src/main/java/com/arialyy/annotations/DownloadGroup.java index bb26d4f1..b36529d6 100644 --- a/AriaAnnotations/src/main/java/com/arialyy/annotations/DownloadGroup.java +++ b/AriaAnnotations/src/main/java/com/arialyy/annotations/DownloadGroup.java @@ -21,7 +21,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * Created by Aria.Lao on 2017/6/6. + * Created by lyy on 2017/6/6. * Aria下载事件被注解的方法中,参数仅能有一个,参数类型为{@link com.arialyy.aria.core.download.DownloadGroupTask} *
  *   
diff --git a/AriaCompiler/src/main/java/com/arialyy/compiler/ParamObtainUtil.java b/AriaCompiler/src/main/java/com/arialyy/compiler/ParamObtainUtil.java
index 128b361a..63a4440d 100644
--- a/AriaCompiler/src/main/java/com/arialyy/compiler/ParamObtainUtil.java
+++ b/AriaCompiler/src/main/java/com/arialyy/compiler/ParamObtainUtil.java
@@ -33,7 +33,7 @@ import javax.lang.model.element.VariableElement;
 import javax.lang.model.util.Elements;
 
 /**
- * Created by Aria.Lao on 2017/9/6.
+ * Created by lyy on 2017/9/6.
  * 构建代理文件的参数获取工具
  */
 class ParamObtainUtil {
diff --git a/AriaCompiler/src/main/java/com/arialyy/compiler/PrintLog.java b/AriaCompiler/src/main/java/com/arialyy/compiler/PrintLog.java
index 2ad5d754..3720ce6b 100644
--- a/AriaCompiler/src/main/java/com/arialyy/compiler/PrintLog.java
+++ b/AriaCompiler/src/main/java/com/arialyy/compiler/PrintLog.java
@@ -20,7 +20,7 @@ import javax.lang.model.element.Element;
 import javax.tools.Diagnostic;
 
 /**
- * Created by Aria.Lao on 2017/6/6.
+ * Created by lyy on 2017/6/6.
  */
 class PrintLog {
 
diff --git a/AriaCompiler/src/main/java/com/arialyy/compiler/ProxyClassParam.java b/AriaCompiler/src/main/java/com/arialyy/compiler/ProxyClassParam.java
index ddfaaeaf..3b9a9a88 100644
--- a/AriaCompiler/src/main/java/com/arialyy/compiler/ProxyClassParam.java
+++ b/AriaCompiler/src/main/java/com/arialyy/compiler/ProxyClassParam.java
@@ -21,7 +21,7 @@ import java.util.Map;
 import java.util.Set;
 
 /**
- * Created by Aria.Lao on 2017/6/7.
+ * Created by lyy on 2017/6/7.
  * 代理类参数
  */
 class ProxyClassParam {
diff --git a/AriaCompiler/src/main/java/com/arialyy/compiler/TaskEnum.java b/AriaCompiler/src/main/java/com/arialyy/compiler/TaskEnum.java
index ee0fb4c8..d5a65feb 100644
--- a/AriaCompiler/src/main/java/com/arialyy/compiler/TaskEnum.java
+++ b/AriaCompiler/src/main/java/com/arialyy/compiler/TaskEnum.java
@@ -16,7 +16,7 @@
 package com.arialyy.compiler;
 
 /**
- * Created by Aria.Lao on 2017/7/10.
+ * Created by lyy on 2017/7/10.
  * 任务类型枚举
  */
 enum TaskEnum {
diff --git a/DEV_LOG.md b/DEV_LOG.md
index 8813a308..e911c570 100644
--- a/DEV_LOG.md
+++ b/DEV_LOG.md
@@ -6,7 +6,9 @@
     - fix bug https://github.com/AriaLyy/Aria/issues/306
     - fix bug https://github.com/AriaLyy/Aria/issues/272  (现在,停止所有任务,未开始的任务状态将变为停止)
     - fix bug https://github.com/AriaLyy/Aria/issues/277
+    - fix bug https://github.com/AriaLyy/Aria/issues/303
     - 优化停止任务的速度
+    - 修复组合任务修改子任务文件名失败的问题
   + v_3.4.12
     - fix bug https://github.com/AriaLyy/Aria/issues/286
     - 优化线程池任务
diff --git a/README.md b/README.md
index e97d035f..f7a83467 100644
--- a/README.md
+++ b/README.md
@@ -32,8 +32,8 @@ Aria有以下特点:
 [![Download](https://api.bintray.com/packages/arialyy/maven/AriaApi/images/download.svg)](https://bintray.com/arialyy/maven/AriaApi/_latestVersion)
 [![Download](https://api.bintray.com/packages/arialyy/maven/AriaCompiler/images/download.svg)](https://bintray.com/arialyy/maven/AriaCompiler/_latestVersion)
 ```java
-compile 'com.arialyy.aria:aria-core:3.4.16'
-annotationProcessor 'com.arialyy.aria:aria-compiler:3.4.16'
+compile 'com.arialyy.aria:aria-core:3.5'
+annotationProcessor 'com.arialyy.aria:aria-compiler:3.5'
 ```
 如果出现android support,请将 `compile 'com.arialyy.aria:aria-core:'`替换为
 ```
@@ -101,9 +101,16 @@ protected void onCreate(Bundle savedInstanceState) {
 
 
 ### 版本日志
-  + v_3.4.12
-    - fix bug https://github.com/AriaLyy/Aria/issues/286
-    - 优化线程池任务
+  + v_3.5
+    - fix bug https://github.com/AriaLyy/Aria/issues/302
+    - fix bug https://github.com/AriaLyy/Aria/issues/283
+    - fix bug https://github.com/AriaLyy/Aria/issues/305
+    - fix bug https://github.com/AriaLyy/Aria/issues/306
+    - fix bug https://github.com/AriaLyy/Aria/issues/272  (现在,停止所有任务,未开始的任务状态将变为停止)
+    - fix bug https://github.com/AriaLyy/Aria/issues/277
+    - fix bug https://github.com/AriaLyy/Aria/issues/303
+    - 优化停止任务的速度
+    - 修复组合任务修改子任务文件名失败的问题
 
 [更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md)
 
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 87d72e57..b35e5470 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -35,7 +35,7 @@
     
     
     
-    
+    
     
     
     
diff --git a/app/src/main/java/com/arialyy/simple/MainActivity.java b/app/src/main/java/com/arialyy/simple/MainActivity.java
index 36142640..aa8f7d8c 100644
--- a/app/src/main/java/com/arialyy/simple/MainActivity.java
+++ b/app/src/main/java/com/arialyy/simple/MainActivity.java
@@ -31,7 +31,7 @@ import com.arialyy.simple.upload.FtpUploadActivity;
 import com.arialyy.simple.upload.HttpUploadActivity;
 
 /**
- * Created by Aria.Lao on 2017/3/1.
+ * Created by lyy on 2017/3/1.
  */
 public class MainActivity extends BaseActivity {
 
diff --git a/app/src/main/java/com/arialyy/simple/download/DownloadDialogFragment.java b/app/src/main/java/com/arialyy/simple/download/DownloadDialogFragment.java
index 91a091fb..a6be21c8 100644
--- a/app/src/main/java/com/arialyy/simple/download/DownloadDialogFragment.java
+++ b/app/src/main/java/com/arialyy/simple/download/DownloadDialogFragment.java
@@ -17,7 +17,7 @@ import com.arialyy.simple.base.BaseDialog;
 import com.arialyy.simple.databinding.DialogFragmentDownloadBinding;
 
 /**
- * Created by Aria.Lao on 2017/8/8.
+ * Created by lyy on 2017/8/8.
  */
 @SuppressLint("ValidFragment") public class DownloadDialogFragment
     extends BaseDialog {
diff --git a/app/src/main/java/com/arialyy/simple/download/FtpDownloadActivity.java b/app/src/main/java/com/arialyy/simple/download/FtpDownloadActivity.java
index 332183f6..1a13aa42 100644
--- a/app/src/main/java/com/arialyy/simple/download/FtpDownloadActivity.java
+++ b/app/src/main/java/com/arialyy/simple/download/FtpDownloadActivity.java
@@ -31,7 +31,7 @@ import com.arialyy.simple.databinding.ActivityFtpDownloadBinding;
 import java.io.File;
 
 /**
- * Created by Aria.Lao on 2017/7/25.
+ * Created by lyy on 2017/7/25.
  * Ftp下载测试
  */
 public class FtpDownloadActivity extends BaseActivity {
diff --git a/app/src/main/java/com/arialyy/simple/download/KotlinDownloadActivity.kt b/app/src/main/java/com/arialyy/simple/download/KotlinDownloadActivity.kt
index 4848e007..16c3e6e8 100644
--- a/app/src/main/java/com/arialyy/simple/download/KotlinDownloadActivity.kt
+++ b/app/src/main/java/com/arialyy/simple/download/KotlinDownloadActivity.kt
@@ -12,7 +12,7 @@ import com.arialyy.simple.R
 import com.arialyy.simple.base.BaseActivity
 
 /**
- * Created by Aria.Lao on 2017/10/23.
+ * Created by lyy on 2017/10/23.
  */
 class KotlinDownloadActivity : AppCompatActivity() {
 
diff --git a/app/src/main/java/com/arialyy/simple/download/SimpleNotification.java b/app/src/main/java/com/arialyy/simple/download/SimpleNotification.java
index 23346c15..285e066a 100644
--- a/app/src/main/java/com/arialyy/simple/download/SimpleNotification.java
+++ b/app/src/main/java/com/arialyy/simple/download/SimpleNotification.java
@@ -26,7 +26,7 @@
 //import com.arialyy.simple.R;
 //
 ///**
-// * Created by Aria.Lao on 2017/1/18.
+// * Created by lyy on 2017/1/18.
 // */
 //
 //public class SimpleNotification {
diff --git a/app/src/main/java/com/arialyy/simple/download/fragment_download/DownloadFragment.java b/app/src/main/java/com/arialyy/simple/download/fragment_download/DownloadFragment.java
index d8ba2fb4..2f27ca33 100644
--- a/app/src/main/java/com/arialyy/simple/download/fragment_download/DownloadFragment.java
+++ b/app/src/main/java/com/arialyy/simple/download/fragment_download/DownloadFragment.java
@@ -35,7 +35,7 @@ import com.arialyy.simple.databinding.FragmentDownloadBinding;
 import com.arialyy.simple.widget.HorizontalProgressBarWithNumber;
 
 /**
- * Created by Aria.Lao on 2017/1/4.
+ * Created by lyy on 2017/1/4.
  */
 public class DownloadFragment extends AbsFragment {
   @Bind(R.id.start) Button mStart;
diff --git a/app/src/main/java/com/arialyy/simple/download/fragment_download/FragmentActivity.java b/app/src/main/java/com/arialyy/simple/download/fragment_download/FragmentActivity.java
index adb2fc96..3d0c1344 100644
--- a/app/src/main/java/com/arialyy/simple/download/fragment_download/FragmentActivity.java
+++ b/app/src/main/java/com/arialyy/simple/download/fragment_download/FragmentActivity.java
@@ -23,7 +23,7 @@ import com.arialyy.simple.base.BaseActivity;
 import com.arialyy.simple.databinding.FragmentDownloadBinding;
 
 /**
- * Created by Aria.Lao on 2017/1/4.
+ * Created by lyy on 2017/1/4.
  */
 
 public class FragmentActivity extends BaseActivity {
diff --git a/app/src/main/java/com/arialyy/simple/download/group/ChildHandleDialog.java b/app/src/main/java/com/arialyy/simple/download/group/ChildHandleDialog.java
index 3de6d4f7..0b013adb 100644
--- a/app/src/main/java/com/arialyy/simple/download/group/ChildHandleDialog.java
+++ b/app/src/main/java/com/arialyy/simple/download/group/ChildHandleDialog.java
@@ -39,7 +39,7 @@ import com.arialyy.simple.widget.HorizontalProgressBarWithNumber;
 import java.util.List;
 
 /**
- * Created by Aria.Lao on 2017/9/5.
+ * Created by lyy on 2017/9/5.
  */
 @SuppressLint("ValidFragment") public class ChildHandleDialog
     extends BaseDialog {
diff --git a/app/src/main/java/com/arialyy/simple/download/group/DownloadGroupActivity.java b/app/src/main/java/com/arialyy/simple/download/group/DownloadGroupActivity.java
index 8f75bb19..d100451c 100644
--- a/app/src/main/java/com/arialyy/simple/download/group/DownloadGroupActivity.java
+++ b/app/src/main/java/com/arialyy/simple/download/group/DownloadGroupActivity.java
@@ -36,7 +36,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- * Created by Aria.Lao on 2017/7/6.
+ * Created by lyy on 2017/7/6.
  */
 public class DownloadGroupActivity extends BaseActivity {
 
diff --git a/app/src/main/java/com/arialyy/simple/download/group/FTPDirDownloadActivity.java b/app/src/main/java/com/arialyy/simple/download/group/FTPDirDownloadActivity.java
index 3d71b325..d0d26214 100644
--- a/app/src/main/java/com/arialyy/simple/download/group/FTPDirDownloadActivity.java
+++ b/app/src/main/java/com/arialyy/simple/download/group/FTPDirDownloadActivity.java
@@ -32,7 +32,7 @@ import com.arialyy.simple.databinding.ActivityDownloadGroupBinding;
 import com.arialyy.simple.widget.SubStateLinearLayout;
 
 /**
- * Created by Aria.Lao on 2017/7/6.
+ * Created by lyy on 2017/7/6.
  */
 public class FTPDirDownloadActivity extends BaseActivity {
   private static final String dir = "ftp://192.168.1.2:21/upload/测试";
diff --git a/app/src/main/java/com/arialyy/simple/download/group/GroupModule.java b/app/src/main/java/com/arialyy/simple/download/group/GroupModule.java
index 0239ad87..ad01a50a 100644
--- a/app/src/main/java/com/arialyy/simple/download/group/GroupModule.java
+++ b/app/src/main/java/com/arialyy/simple/download/group/GroupModule.java
@@ -23,7 +23,7 @@ import java.util.Collections;
 import java.util.List;
 
 /**
- * Created by Aria.Lao on 2017/7/6.
+ * Created by lyy on 2017/7/6.
  */
 public class GroupModule extends BaseModule {
   public GroupModule(Context context) {
diff --git a/app/src/main/java/com/arialyy/simple/download/multi_download/MultiEntity.java b/app/src/main/java/com/arialyy/simple/download/multi_download/MultiEntity.java
index ca3adf37..27374174 100644
--- a/app/src/main/java/com/arialyy/simple/download/multi_download/MultiEntity.java
+++ b/app/src/main/java/com/arialyy/simple/download/multi_download/MultiEntity.java
@@ -19,7 +19,7 @@ import com.arialyy.aria.core.download.DownloadEntity;
 import com.arialyy.aria.core.download.DownloadGroupEntity;
 
 /**
- * Created by Aria.Lao on 2017/7/14.
+ * Created by lyy on 2017/7/14.
  */
 public class MultiEntity {
   public static final int SIMPLE_DOWNLOAD = 0xa1;
diff --git a/app/src/main/java/com/arialyy/simple/download/multi_download/MultiModule.java b/app/src/main/java/com/arialyy/simple/download/multi_download/MultiModule.java
index de0cd46c..6b4a84a2 100644
--- a/app/src/main/java/com/arialyy/simple/download/multi_download/MultiModule.java
+++ b/app/src/main/java/com/arialyy/simple/download/multi_download/MultiModule.java
@@ -19,7 +19,7 @@ import android.content.Context;
 import com.arialyy.simple.base.BaseModule;
 
 /**
- * Created by Aria.Lao on 2017/7/14.
+ * Created by lyy on 2017/7/14.
  */
 public class MultiModule extends BaseModule{
   public MultiModule(Context context) {
diff --git a/app/src/main/java/com/arialyy/simple/download/service_download/DownloadNotification.java b/app/src/main/java/com/arialyy/simple/download/service_download/DownloadNotification.java
index 4495530f..8ab9469c 100644
--- a/app/src/main/java/com/arialyy/simple/download/service_download/DownloadNotification.java
+++ b/app/src/main/java/com/arialyy/simple/download/service_download/DownloadNotification.java
@@ -22,7 +22,7 @@ import android.support.v4.app.NotificationCompat;
 import com.arialyy.simple.R;
 
 /**
- * Created by Aria.Lao on 2017/1/18.
+ * Created by lyy on 2017/1/18.
  */
 public class DownloadNotification {
 
diff --git a/app/src/main/java/com/arialyy/simple/download/service_download/DownloadService.java b/app/src/main/java/com/arialyy/simple/download/service_download/DownloadService.java
index 4994bfaa..4d32568c 100644
--- a/app/src/main/java/com/arialyy/simple/download/service_download/DownloadService.java
+++ b/app/src/main/java/com/arialyy/simple/download/service_download/DownloadService.java
@@ -26,7 +26,7 @@ import com.arialyy.aria.core.download.DownloadTask;
 import com.arialyy.frame.util.show.T;
 
 /**
- * Created by Aria.Lao on 2017/4/5.
+ * Created by lyy on 2017/4/5.
  * 在服务中使用 Aria进行下载
  */
 public class DownloadService extends Service {
diff --git a/app/src/main/java/com/arialyy/simple/upload/FtpUploadActivity.java b/app/src/main/java/com/arialyy/simple/upload/FtpUploadActivity.java
index 21f8927c..7a3248e2 100644
--- a/app/src/main/java/com/arialyy/simple/upload/FtpUploadActivity.java
+++ b/app/src/main/java/com/arialyy/simple/upload/FtpUploadActivity.java
@@ -31,7 +31,7 @@ import com.arialyy.simple.databinding.ActivityFtpUploadBinding;
 import java.io.File;
 
 /**
- * Created by Aria.Lao on 2017/7/28.
+ * Created by lyy on 2017/7/28.
  * Ftp 文件上传demo
  */
 public class FtpUploadActivity extends BaseActivity {
diff --git a/app/src/main/java/com/arialyy/simple/upload/HttpUploadActivity.java b/app/src/main/java/com/arialyy/simple/upload/HttpUploadActivity.java
index c0b942c7..0304e8eb 100644
--- a/app/src/main/java/com/arialyy/simple/upload/HttpUploadActivity.java
+++ b/app/src/main/java/com/arialyy/simple/upload/HttpUploadActivity.java
@@ -32,7 +32,7 @@ import com.arialyy.simple.widget.HorizontalProgressBarWithNumber;
 import java.io.File;
 
 /**
- * Created by Aria.Lao on 2017/2/9.
+ * Created by lyy on 2017/2/9.
  */
 public class HttpUploadActivity extends BaseActivity {
   private static final String TAG = "HttpUploadActivity";
diff --git a/app/src/main/java/com/arialyy/simple/widget/SubStateLinearLayout.java b/app/src/main/java/com/arialyy/simple/widget/SubStateLinearLayout.java
index 7b390d39..ad89fa56 100644
--- a/app/src/main/java/com/arialyy/simple/widget/SubStateLinearLayout.java
+++ b/app/src/main/java/com/arialyy/simple/widget/SubStateLinearLayout.java
@@ -32,7 +32,7 @@ import java.util.Map;
 import java.util.WeakHashMap;
 
 /**
- * Created by Aria.Lao on 2017/7/17.
+ * Created by lyy on 2017/7/17.
  */
 public class SubStateLinearLayout extends LinearLayout implements View.OnClickListener {
   private final String TAG = "SubStateLinearLayout";
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 84b62020..a8c6d6fc 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
@@ -31,7 +31,7 @@ public class UploadTask extends AbsNormalTask {
   private UploadTask(UploadTaskEntity taskEntity, Handler outHandler) {
     mTaskEntity = taskEntity;
     mOutHandler = outHandler;
-    mListener = new BaseUListener<>(this, mOutHandler);
+    mListener = new BaseUListener(this, mOutHandler);
     mUtil = new SimpleUploadUtil(taskEntity, (IUploadListener) mListener);
   }