修复4.4.4系统在多个dex的情况下,无法进行回调的问题;修复组合任务子任务索引问题
This commit is contained in:
@@ -22,6 +22,7 @@ import android.view.View;
|
||||
import butterknife.Bind;
|
||||
import com.arialyy.annotations.DownloadGroup;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.arialyy.aria.core.download.DownloadGroupEntity;
|
||||
import com.arialyy.aria.core.download.DownloadGroupTask;
|
||||
import com.arialyy.aria.core.download.DownloadGroupTaskEntity;
|
||||
@@ -133,14 +134,15 @@ public class DownloadGroupActivity extends BaseActivity<ActivityDownloadGroupBin
|
||||
}
|
||||
|
||||
@DownloadGroup.onTaskRunning() protected void running(DownloadGroupTask task) {
|
||||
Log.d(TAG, "group running, p = "
|
||||
+ task.getPercent()
|
||||
+ ", speed = "
|
||||
+ task.getConvertSpeed()
|
||||
+ "current_p = "
|
||||
+ task.getCurrentProgress());
|
||||
//Log.d(TAG, "group running, p = "
|
||||
// + task.getPercent()
|
||||
// + ", speed = "
|
||||
// + task.getConvertSpeed()
|
||||
// + "current_p = "
|
||||
// + task.getCurrentProgress());
|
||||
getBinding().setProgress(task.getPercent());
|
||||
getBinding().setSpeed(task.getConvertSpeed());
|
||||
//Log.d(TAG, "sub_len = " + task.getEntity().getSubEntities().size());
|
||||
mChildList.updateChildProgress(task.getEntity().getSubEntities());
|
||||
}
|
||||
|
||||
@@ -170,4 +172,54 @@ public class DownloadGroupActivity extends BaseActivity<ActivityDownloadGroupBin
|
||||
T.showShort(this, "任务组下载完成");
|
||||
L.d(TAG, "任务组下载完成");
|
||||
}
|
||||
|
||||
@DownloadGroup.onSubTaskRunning void onSubTaskRunning(DownloadGroupTask groupTask,
|
||||
DownloadEntity subEntity) {
|
||||
//ALog.d(TAG, "sub_percent = " + subEntity.getPercent());
|
||||
Log.e(TAG, "gHash = "
|
||||
+ groupTask.getEntity().getSubEntities().get(0).hashCode()
|
||||
+ "; subHash = "
|
||||
+ groupTask.getTaskEntity().getSubTaskEntities().get(0).getEntity().hashCode() +
|
||||
"; subHash = " + subEntity.hashCode());
|
||||
int percent = subEntity.getPercent();
|
||||
//如果你打开了速度单位转换配置,将可以通过以下方法获取带单位的下载速度,如:1 mb/s
|
||||
String convertSpeed = subEntity.getConvertSpeed();
|
||||
//当前下载完成的进度,长度bytes
|
||||
long completedSize = subEntity.getCurrentProgress();
|
||||
Log.d(TAG, "subTask名字:"
|
||||
+ subEntity.getFileName()
|
||||
+ ", "
|
||||
+ " speed:"
|
||||
+ convertSpeed
|
||||
+ ",percent: "
|
||||
+ percent
|
||||
+ "%, completedSize:"
|
||||
+ completedSize);
|
||||
}
|
||||
|
||||
@DownloadGroup.onSubTaskPre void onSubTaskPre(DownloadGroupTask groupTask,
|
||||
DownloadEntity subEntity) {
|
||||
}
|
||||
|
||||
@DownloadGroup.onSubTaskStop void onSubTaskStop(DownloadGroupTask groupTask,
|
||||
DownloadEntity subEntity) {
|
||||
}
|
||||
|
||||
@DownloadGroup.onSubTaskStart void onSubTaskStart(DownloadGroupTask groupTask,
|
||||
DownloadEntity subEntity) {
|
||||
}
|
||||
|
||||
//@DownloadGroup.onSubTaskCancel void onSubTaskCancel(DownloadGroupTask groupTask,
|
||||
// DownloadEntity subEntity) {
|
||||
// Log.d(TAG, "new Size: " + groupTask.getConvertFileSize());
|
||||
// mSub.setText("子任务:" + mChildName + ",状态:取消下载");
|
||||
//}
|
||||
|
||||
@DownloadGroup.onSubTaskComplete void onSubTaskComplete(DownloadGroupTask groupTask,
|
||||
DownloadEntity subEntity) {
|
||||
}
|
||||
|
||||
@DownloadGroup.onSubTaskFail void onSubTaskFail(DownloadGroupTask groupTask,
|
||||
DownloadEntity subEntity) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,8 +58,8 @@ public class GroupModule extends BaseModule {
|
||||
// taskSubFile.add("2115.mp4");
|
||||
//taskSubFile.add("2009.mp4");
|
||||
//taskSubFile.add("1893.mp4");
|
||||
//taskSubFile.add("1952.mp4");
|
||||
//taskSubFile.add("1958.mp4");
|
||||
taskSubFile.add("1952.mp4");
|
||||
taskSubFile.add("1958.mp4");
|
||||
taskSubFile.add("1994.mp4");
|
||||
//taskSubFile.add("2083.mp4");
|
||||
taskSubFile.add("2305.JPG");
|
||||
@@ -88,10 +88,10 @@ public class GroupModule extends BaseModule {
|
||||
// "http://d.quanscreen.com/k/down/resourceDownLoad?resourceId=2009&clientId=A000011106034058176");
|
||||
//downLoadUrls.add(
|
||||
// "http://d.quanscreen.com/k/down/resourceDownLoad?resourceId=1893&clientId=A000011106034058176");
|
||||
//downLoadUrls.add(
|
||||
// "http://d.quanscreen.com/k/down/resourceDownLoad?resourceId=1952&clientId=A000011106034058176");
|
||||
//downLoadUrls.add(
|
||||
// "http://d.quanscreen.com/k/down/resourceDownLoad?resourceId=1958&clientId=A000011106034058176");
|
||||
downLoadUrls.add(
|
||||
"http://d.quanscreen.com/k/down/resourceDownLoad?resourceId=1952&clientId=A000011106034058176");
|
||||
downLoadUrls.add(
|
||||
"http://d.quanscreen.com/k/down/resourceDownLoad?resourceId=1958&clientId=A000011106034058176");
|
||||
downLoadUrls.add(
|
||||
"http://d.quanscreen.com/k/down/resourceDownLoad?resourceId=1994&clientId=A000011106034058176");
|
||||
//downLoadUrls.add(
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.arialyy.simple.widget;
|
||||
import android.content.Context;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -105,6 +106,7 @@ public class SubStateLinearLayout extends LinearLayout implements View.OnClickLi
|
||||
if (position != -1) {
|
||||
TextView child = ((TextView) getChildAt(position));
|
||||
int p = getPercent(entity);
|
||||
Log.d("TAG", "p = " + p);
|
||||
child.setText(entity.getFileName() + ": " + p + "%" + " | " + entity.getConvertSpeed());
|
||||
child.invalidate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user