diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/AbsNormalCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/AbsNormalCmd.java index 675a918a..6e56f850 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/AbsNormalCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/AbsNormalCmd.java @@ -19,12 +19,13 @@ package com.arialyy.aria.core.command.normal; import com.arialyy.aria.core.command.AbsCmd; import com.arialyy.aria.core.download.DownloadGroupTaskEntity; import com.arialyy.aria.core.download.DownloadTaskEntity; +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.queue.DownloadGroupTaskQueue; import com.arialyy.aria.core.queue.DownloadTaskQueue; import com.arialyy.aria.core.queue.UploadTaskQueue; import com.arialyy.aria.core.upload.UploadTaskEntity; -import com.arialyy.aria.util.CheckUtil; import com.arialyy.aria.util.CommonUtil; /** @@ -32,12 +33,13 @@ import com.arialyy.aria.util.CommonUtil; * 下载命令 */ public abstract class AbsNormalCmd extends AbsCmd { - /** * 能否执行命令 */ boolean canExeCmd = true; + private AbsTask tempTask = null; + /** * @param targetName 产生任务的对象名 */ @@ -58,4 +60,90 @@ public abstract class AbsNormalCmd extends AbsCmd { isDownloadCmd = true; } } + + /** + * 删除所有任务 + */ + void removeAll() { + mQueue.removeAllTask(); + } + + /** + * 停止所有任务 + */ + void stopAll() { + mQueue.stopAllTask(); + } + + /** + * 停止任务 + */ + void stopTask() { + if (tempTask == null) createTask(); + mQueue.stopTask(tempTask); + } + + /** + * 删除任务 + */ + void removeTask() { + if (tempTask == null) createTask(); + mQueue.removeTask(tempTask); + } + + /** + * 启动任务 + */ + void startTask() { + mQueue.startTask(tempTask); + } + + /** + * 启动指定任务 + * + * @param task 指定任务 + */ + void startTask(AbsTask task) { + mQueue.startTask(task); + } + + /** + * 从队列中获取任务 + * + * @return 执行任务 + */ + AbsTask getTask() { + tempTask = mQueue.getTask(mTaskEntity.getEntity()); + return tempTask; + } + + /** + * 从队列中获取任务 + * + * @return 执行任务 + */ + AbsTask getTask(AbsEntity entity) { + tempTask = mQueue.getTask(entity); + return tempTask; + } + + /** + * 创建任务 + * + * @return 创建的任务 + */ + AbsTask createTask() { + tempTask = mQueue.createTask(mTargetName, mTaskEntity); + return tempTask; + } + + /** + * 创建指定实体的任务 + * + * @param taskEntity 特定的任务实体 + * @return 创建的任务 + */ + AbsTask createTask(AbsTaskEntity taskEntity) { + return mQueue.createTask(mTargetName, taskEntity); + } } \ No newline at end of file diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/AddCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/AddCmd.java index e848813b..8d2ccc39 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/AddCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/AddCmd.java @@ -33,10 +33,10 @@ class AddCmd extends AbsNormalCmd { @Override public void executeCmd() { if (!canExeCmd) return; - AbsTask task = mQueue.getTask(mTaskEntity.getEntity()); + AbsTask task = getTask(); if (task == null) { mTaskEntity.getEntity().setState(IEntity.STATE_WAIT); - mQueue.createTask(mTargetName, mTaskEntity); + createTask(); } else { Log.w(TAG, "添加命令执行失败,【该任务已经存在】"); } diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/CancelAllCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/CancelAllCmd.java index 9d37a0d5..9126a3e0 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/CancelAllCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/CancelAllCmd.java @@ -36,7 +36,7 @@ final class CancelAllCmd extends AbsNormalCmd { } @Override public void executeCmd() { - mQueue.removeAllTask(); + removeAll(); if (mTaskEntity instanceof DownloadTaskEntity) { handleDownloadRemove(); } else if (mTaskEntity instanceof UploadTaskEntity){ diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/CancelCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/CancelCmd.java index ff859066..ff959b2d 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/CancelCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/CancelCmd.java @@ -17,7 +17,6 @@ package com.arialyy.aria.core.command.normal; import android.text.TextUtils; -import com.arialyy.aria.core.inf.AbsNormalTask; import com.arialyy.aria.core.inf.AbsTask; import com.arialyy.aria.core.inf.AbsTaskEntity; @@ -32,15 +31,15 @@ class CancelCmd extends AbsNormalCmd { @Override public void executeCmd() { if (!canExeCmd) return; - AbsTask task = mQueue.getTask(mTaskEntity.getEntity()); + AbsTask task = getTask(); if (task == null) { - task = mQueue.createTask(mTargetName, mTaskEntity); + task = createTask(); } if (task != null) { if (!TextUtils.isEmpty(mTargetName)) { task.setTargetName(mTargetName); } - mQueue.removeTask(task); + removeTask(); } } } \ No newline at end of file diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/HighestPriorityCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/HighestPriorityCmd.java index e0efa2f7..836b37df 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/HighestPriorityCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/HighestPriorityCmd.java @@ -43,9 +43,9 @@ final class HighestPriorityCmd extends AbsNormalCmd @Override public void executeCmd() { if (!canExeCmd) return; - DownloadTask task = (DownloadTask) mQueue.getTask(mTaskEntity.getEntity()); + DownloadTask task = (DownloadTask) getTask(); if (task == null) { - task = (DownloadTask) mQueue.createTask(mTargetName, mTaskEntity); + task = (DownloadTask) createTask(); } if (task != null) { if (!TextUtils.isEmpty(mTargetName)) { diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/ResumeAllCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/ResumeAllCmd.java index 1233ebe1..412a0ff3 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/ResumeAllCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/ResumeAllCmd.java @@ -1,11 +1,13 @@ package com.arialyy.aria.core.command.normal; -import android.util.Log; -import com.arialyy.aria.core.download.DownloadEntity; +import com.arialyy.aria.core.download.DownloadGroupTaskEntity; import com.arialyy.aria.core.download.DownloadTaskEntity; -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.queue.DownloadGroupTaskQueue; +import com.arialyy.aria.core.queue.DownloadTaskQueue; +import com.arialyy.aria.core.queue.UploadTaskQueue; +import com.arialyy.aria.core.upload.UploadTaskEntity; import com.arialyy.aria.orm.DbEntity; import java.util.List; @@ -24,29 +26,65 @@ final class ResumeAllCmd extends AbsNormalCmd { } @Override public void executeCmd() { - List allEntity = - DbEntity.findDatas(DownloadEntity.class, "state=?", IEntity.STATE_STOP + ""); - for (DownloadEntity entity : allEntity) { - int exeNum = mQueue.getCurrentExePoolNum(); - if (exeNum == 0 || exeNum < mQueue.getMaxTaskNum()) { - AbsTask task = createTask(entity); - mQueue.startTask(task); - } else { - entity.setState(IEntity.STATE_WAIT); - createTask(entity); - } + if (isDownloadCmd) { + resumeDownload(); + } else { + resumeUpload(); + } + } + + /** + * 恢复下载,包括普通任务和任务组 + */ + private void resumeDownload() { + List dTaskEntity = + DbEntity.findDatas(DownloadTaskEntity.class, "isGroupTask=?", "false"); + for (DownloadTaskEntity te : dTaskEntity) { + int state = te.getState(); + if (state == IEntity.STATE_COMPLETE || state == IEntity.STATE_FAIL) continue; + resumeEntity(te); + } + + List groupTask = DbEntity.findAllData(DownloadGroupTaskEntity.class); + for (DownloadGroupTaskEntity te : groupTask) { + int state = te.getState(); + if (state == IEntity.STATE_COMPLETE || state == IEntity.STATE_FAIL) continue; + resumeEntity(te); } } - private AbsTask createTask(DownloadEntity entity) { - AbsTask task = mQueue.getTask(entity); - if (task == null) { - DownloadTaskEntity taskEntity = new DownloadTaskEntity(); - taskEntity.entity = entity; - task = mQueue.createTask(mTargetName, taskEntity); + /** + * 恢复上传,包括普通任务和任务组 + */ + private void resumeUpload() { + List dTaskEntity = + DbEntity.findDatas(UploadTaskEntity.class, "isGroupTask=?", "false"); + for (UploadTaskEntity te : dTaskEntity) { + int state = te.getState(); + if (state == IEntity.STATE_COMPLETE || state == IEntity.STATE_FAIL) continue; + resumeEntity(te); + } + } + + /** + * 恢复实体任务 + * + * @param te 任务实体 + */ + private void resumeEntity(AbsTaskEntity te) { + if (te instanceof DownloadTaskEntity) { + mQueue = DownloadTaskQueue.getInstance(); + } else if (te instanceof UploadTaskEntity) { + mQueue = UploadTaskQueue.getInstance(); + } else if (te instanceof DownloadGroupTaskEntity) { + mQueue = DownloadGroupTaskQueue.getInstance(); + } + int exeNum = mQueue.getCurrentExePoolNum(); + if (exeNum == 0 || exeNum < mQueue.getMaxTaskNum()) { + startTask(createTask(te)); } else { - Log.w(TAG, "添加命令执行失败,【该任务已经存在】"); + te.getEntity().setState(IEntity.STATE_WAIT); + createTask(te); } - return task; } } diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/StartCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/StartCmd.java index c61b31da..bacc7658 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/StartCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/StartCmd.java @@ -47,26 +47,26 @@ class StartCmd extends AbsNormalCmd { maxTaskNum = manager.getUploadConfig().getMaxTaskNum(); } - AbsTask task = mQueue.getTask(mTaskEntity.getEntity()); + AbsTask task = getTask(); if (task == null) { - task = mQueue.createTask(mTargetName, mTaskEntity); + task = createTask(); if (!TextUtils.isEmpty(mTargetName)) { task.setTargetName(mTargetName); } // 任务不存在时,根据配置不同,对任务执行操作 if (mod.equals(QueueMod.NOW.getTag())) { - mQueue.startTask(task); + startTask(); } else if (mod.equals(QueueMod.WAIT.getTag())) { if (mQueue.getCurrentExePoolNum() < maxTaskNum || task.getState() == IEntity.STATE_STOP || task.getState() == IEntity.STATE_COMPLETE) { - mQueue.startTask(task); + startTask(); } } } else { // 任务不存在时,根据配置不同,对任务执行操作 if (!task.isRunning()) { - mQueue.startTask(task); + startTask(); } } } diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/StopAllCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/StopAllCmd.java index 431adfdd..a21483c3 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/StopAllCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/StopAllCmd.java @@ -15,6 +15,6 @@ final class StopAllCmd extends AbsNormalCmd { } @Override public void executeCmd() { - mQueue.stopAllTask(); + stopAll(); } } diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/StopCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/StopCmd.java index 9d0b0811..a631f9ab 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/StopCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/StopCmd.java @@ -34,11 +34,10 @@ class StopCmd extends AbsNormalCmd { @Override public void executeCmd() { if (!canExeCmd) return; - AbsTask task = mQueue.getTask(mTaskEntity.getEntity()); + AbsTask task = getTask(); if (task == null) { if (mTaskEntity.getEntity().getState() == IEntity.STATE_RUNNING) { - task = mQueue.createTask(mTargetName, mTaskEntity); - mQueue.stopTask(task); + stopTask(); } else { Log.w(TAG, "停止命令执行失败,【调度器中没有该任务】"); } @@ -46,7 +45,7 @@ class StopCmd extends AbsNormalCmd { if (!TextUtils.isEmpty(mTargetName)) { task.setTargetName(mTargetName); } - mQueue.stopTask(task); + stopTask(); } } } \ No newline at end of file diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTarget.java b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTarget.java index 16978e96..27aea5dc 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTarget.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTarget.java @@ -33,13 +33,19 @@ public class DownloadTarget protected String url; DownloadTarget(DownloadEntity entity, String targetName) { - this(entity.getUrl(), targetName); + this.url = entity.getUrl(); + mTargetName = targetName; + initTask(entity); } DownloadTarget(String url, String targetName) { this.url = url; mTargetName = targetName; DownloadEntity entity = getEntity(url); + initTask(entity); + } + + private void initTask(DownloadEntity entity) { mTaskEntity = DbEntity.findFirst(DownloadTaskEntity.class, "key=? and isGroupTask='false'", entity.getDownloadPath()); if (mTaskEntity == null) { diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/downloader/AbsGroupUtil.java b/Aria/src/main/java/com/arialyy/aria/core/download/downloader/AbsGroupUtil.java index 21a10b8b..5c698a12 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/downloader/AbsGroupUtil.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/downloader/AbsGroupUtil.java @@ -44,10 +44,10 @@ abstract class AbsGroupUtil implements IUtil { * 任务组所有任务总大小 */ long mTotalSize = 0; - private long mCurrentLocation = 0; + protected long mCurrentLocation = 0; private ExecutorService mExePool; protected IDownloadGroupListener mListener; - DownloadGroupTaskEntity mTaskEntity; + protected DownloadGroupTaskEntity mTaskEntity; private boolean isRunning = true; private Timer mTimer; /** diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/downloader/DownloadGroupUtil.java b/Aria/src/main/java/com/arialyy/aria/core/download/downloader/DownloadGroupUtil.java index 5b3abfbf..490b45cc 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/downloader/DownloadGroupUtil.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/downloader/DownloadGroupUtil.java @@ -72,7 +72,10 @@ public class DownloadGroupUtil extends AbsGroupUtil implements IUtil { } } } - if (i == mExeMap.size()) startRunningFlow(); + if (i != 0 && i == mExeMap.size()) startRunningFlow(); + if (mCurrentLocation == mTotalSize) { + mListener.onComplete(); + } } /** diff --git a/Aria/src/main/java/com/arialyy/aria/core/queue/QueueControl.java b/Aria/src/main/java/com/arialyy/aria/core/queue/QueueControl.java new file mode 100644 index 00000000..dd7bbd8d --- /dev/null +++ b/Aria/src/main/java/com/arialyy/aria/core/queue/QueueControl.java @@ -0,0 +1,119 @@ +/* + * 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.queue; + +import android.os.Handler; +import android.os.Message; +import android.util.SparseArray; +import com.arialyy.aria.core.inf.AbsEntity; +import com.arialyy.aria.core.inf.AbsTask; +import com.arialyy.aria.core.inf.AbsTaskEntity; + +/** + * Created by Aria.Lao on 2017/8/3. + * 队列控制器,用于处理各种命令 + */ +public class QueueControl implements Handler.Callback { + /** + * 获取任务命令 + */ + public static final int CMD_GET_TASK = 0xa1; + /** + * 创建任务命令 + */ + public static final int CMD_CREATE_TASK = 0xa2; + /** + * 启动任务命令 + */ + public static final int CMD_START_TASK = 0xa3; + /** + * 停止任务命令 + */ + public static final int CMD_STOP_TASK = 0xa4; + /** + * 删除任务命令 + */ + public static final int CMD_CANCEL_TASK = 0xa5; + /** + * 停止所有任务命令 + */ + public static final int CMD_STOP_ALL_TASK = 0xa6; + /** + * 删除所有任务命令 + */ + public static final int CMD_CANCEL_ALL_TASK = 0xa7; + + /** + * 队列类型为单文件下载队列 + */ + public static final int TYPE_SIMPLE_DOWNLOAD_QUEUE = 0xc1; + /** + * 队列类型为任务组下载队列 + */ + public static final int TYPE_SIMPLE_DOWNLOAD_GROUP_QUEUE = 0xc2; + /** + * 队列类型为单文件上传队列 + */ + public static final int TYPE_SIMPLE_UPLOAD_QUEUE = 0xc3; + + private Handler outHandler; + private AbsTaskQueue queue; + + public QueueControl(Handler.Callback callback, int type) { + outHandler = new Handler(callback); + switch (type) { + case TYPE_SIMPLE_DOWNLOAD_QUEUE: + queue = DownloadTaskQueue.getInstance(); + break; + case TYPE_SIMPLE_DOWNLOAD_GROUP_QUEUE: + queue = DownloadGroupTaskQueue.getInstance(); + break; + case TYPE_SIMPLE_UPLOAD_QUEUE: + queue = UploadTaskQueue.getInstance(); + break; + } + } + + @Override public boolean handleMessage(Message msg) { + switch (msg.what) { + case CMD_GET_TASK: + outHandler.obtainMessage(CMD_GET_TASK, queue.getTask((AbsEntity) msg.obj)).sendToTarget(); + break; + case CMD_CREATE_TASK: + SparseArray params = (SparseArray) msg.obj; + outHandler.obtainMessage(CMD_CREATE_TASK, + queue.createTask(String.valueOf(params.get(1)), (AbsTaskEntity) params.get(2))) + .sendToTarget(); + break; + case CMD_START_TASK: + queue.startTask((AbsTask) msg.obj); + break; + case CMD_STOP_TASK: + queue.stopTask((AbsTask) msg.obj); + break; + case CMD_CANCEL_TASK: + queue.removeTask((AbsTask) msg.obj); + break; + case CMD_STOP_ALL_TASK: + queue.stopAllTask(); + break; + case CMD_CANCEL_ALL_TASK: + queue.removeAllTask(); + break; + } + return true; + } +} 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 2f4fb2b4..21745edb 100644 --- a/Aria/src/main/java/com/arialyy/aria/util/CommonUtil.java +++ b/Aria/src/main/java/com/arialyy/aria/util/CommonUtil.java @@ -575,6 +575,10 @@ public class CommonUtil { * 如果文件存在,先删除原文件,然后重新创建一个新文件 */ public static void createFile(String path) { + if (TextUtils.isEmpty(path)) { + Log.e(TAG, "文件路径不能为null"); + return; + } File file = new File(path); if (!file.getParentFile().exists()) { Log.d(TAG, "目标文件所在路径不存在,准备创建……"); 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 20e22607..a1bf4f89 100644 --- a/app/src/main/java/com/arialyy/simple/download/FtpDownloadActivity.java +++ b/app/src/main/java/com/arialyy/simple/download/FtpDownloadActivity.java @@ -37,7 +37,7 @@ import java.io.File; public class FtpDownloadActivity extends BaseActivity { //private final String URL = "ftp://172.18.104.129:21/haha/large.rar"; //private final String URL = "ftp://172.18.104.129:21/haha/large.rar"; - private final String URL = "ftp://172.18.104.129:21/haha/很大的文件_v100.rar"; + private final String URL = "ftp://172.18.104.66:21/haha/成都.mp3"; @Override protected void init(Bundle savedInstanceState) { super.init(savedInstanceState); @@ -113,7 +113,7 @@ public class FtpDownloadActivity extends BaseActivity " + CommonUtil.getFileMD5(new File(task.getDownloadPath()))); - T.showShort(this, "FTP下载完成"); + T.showShort(this, "文件:" + task.getEntity().getFileName() + ",下载完成"); } @Override protected int setLayoutId() { 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 73cb28c4..6b699651 100644 --- a/app/src/main/java/com/arialyy/simple/download/HighestPriorityActivity.java +++ b/app/src/main/java/com/arialyy/simple/download/HighestPriorityActivity.java @@ -25,6 +25,7 @@ import android.view.View; import android.widget.Button; import android.widget.TextView; import butterknife.Bind; +import com.arialyy.annotations.Download; import com.arialyy.aria.core.Aria; import com.arialyy.aria.core.download.DownloadEntity; import com.arialyy.aria.core.download.DownloadTarget; @@ -71,6 +72,7 @@ public class HighestPriorityActivity extends BaseActivity { - private final String FILE_PATH = "/mnt/sdcard/gggg.apk"; - private final String URL = "ftp://172.18.104.79:21/upload/"; + private final String FILE_PATH = "/mnt/sdcard/Download/group_test_3/战斗吧剑灵.apk"; + private final String URL = "ftp://172.18.104.66:21/upload/"; @Override protected void init(Bundle savedInstanceState) { setTile("FTP 文件上传"); @@ -99,6 +99,6 @@ public class FtpUploadActivity extends BaseActivity { @Upload.onTaskComplete public void taskComplete(UploadTask task) { getBinding().setProgress(100); getBinding().setSpeed(""); - T.showShort(this, "上传完成"); + T.showShort(this, "文件:" + task.getEntity().getFileName() + ",上传完成"); } }