分组子任务多线程下载
This commit is contained in:
@@ -44,7 +44,6 @@ public abstract class AbsSubDLoadUtil implements IUtil, Runnable {
|
|||||||
private boolean needGetInfo;
|
private boolean needGetInfo;
|
||||||
private boolean isStop = false, isCancel = false;
|
private boolean isStop = false, isCancel = false;
|
||||||
private String parentKey;
|
private String parentKey;
|
||||||
private IDLoadListener mListener;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param schedulers 调度器
|
* @param schedulers 调度器
|
||||||
@@ -53,62 +52,10 @@ public abstract class AbsSubDLoadUtil implements IUtil, Runnable {
|
|||||||
protected AbsSubDLoadUtil(DTaskWrapper taskWrapper, Handler schedulers, boolean needGetInfo, String parentKey) {
|
protected AbsSubDLoadUtil(DTaskWrapper taskWrapper, Handler schedulers, boolean needGetInfo, String parentKey) {
|
||||||
mWrapper = taskWrapper;
|
mWrapper = taskWrapper;
|
||||||
mSchedulers = schedulers;
|
mSchedulers = schedulers;
|
||||||
mListener=createListener();
|
|
||||||
this.parentKey = parentKey;
|
this.parentKey = parentKey;
|
||||||
this.needGetInfo = needGetInfo;
|
this.needGetInfo = needGetInfo;
|
||||||
mDLoader = getLoader();
|
mDLoader = getLoader();
|
||||||
}
|
}
|
||||||
private IDLoadListener createListener() {
|
|
||||||
return new IDLoadListener() {
|
|
||||||
@Override
|
|
||||||
public void onPostPre(long fileSize) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void supportBreakpoint(boolean support) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPre() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStart(long startLocation) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResume(long resumeLocation) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onProgress(long currentLocation) {
|
|
||||||
Message msg =getSchedulers().obtainMessage(IThreadStateManager.STATE_RUNNING, currentLocation);
|
|
||||||
Bundle b = new Bundle();
|
|
||||||
msg.setData(b);
|
|
||||||
b.putString(IThreadStateManager.DATA_THREAD_NAME, getKey());
|
|
||||||
msg.sendToTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStop(long stopLocation) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onComplete() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCancel() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFail(boolean needRetry, AriaException e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建加载器
|
* 创建加载器
|
||||||
@@ -150,7 +97,7 @@ public abstract class AbsSubDLoadUtil implements IUtil, Runnable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
buildLoaderStructure();
|
buildLoaderStructure();
|
||||||
mDLoader.run();
|
new Thread(mDLoader).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user