This commit is contained in:
laoyuyu
2019-11-20 10:17:08 +08:00
parent 1b54bfc4ac
commit 0765ab67f7
7 changed files with 27 additions and 27 deletions

View File

@@ -34,10 +34,6 @@ public abstract class AbsThreadTaskAdapter implements IThreadTaskAdapter {
* 速度限制工具
*/
protected BandwidthLimiter mSpeedBandUtil;
/**
* 当前线程的下去区间的进度
*/
private long mRangeProgress;
private ThreadRecord mThreadRecord;
private IThreadTaskObserver mObserver;
private AbsTaskWrapper mWrapper;
@@ -48,7 +44,6 @@ public abstract class AbsThreadTaskAdapter implements IThreadTaskAdapter {
mThreadRecord = config.record;
mWrapper = config.taskWrapper;
mThreadConfig = config;
mRangeProgress = mThreadRecord.startLocation;
if (getTaskConfig().getMaxSpeed() > 0) {
mSpeedBandUtil = new BandwidthLimiter(getTaskConfig().getMaxSpeed(), config.startThreadNum);
}
@@ -68,7 +63,7 @@ public abstract class AbsThreadTaskAdapter implements IThreadTaskAdapter {
* 当前线程的下去区间的进度
*/
protected long getRangeProgress() {
return mRangeProgress;
return mObserver.getThreadProgress();
}
protected ThreadRecord getThreadRecord() {

View File

@@ -53,4 +53,9 @@ public interface IThreadTaskObserver {
* @param len 新增的长度
*/
void updateProgress(long len);
/**
* 获取线程当前进度
*/
long getThreadProgress();
}

View File

@@ -318,6 +318,11 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
}
}
@Override
public long getThreadProgress() {
return mRangeProgress;
}
/**
* 取消任务
*/

View File

@@ -101,9 +101,6 @@ public class ComponentUtil {
public <T extends IUtil> T buildUtil(AbsTaskWrapper wrapper, IEventListener listener) {
int requestType = wrapper.getRequestType();
String className = null;
if (requestType == 1){
throw new IllegalArgumentException("xxxx");
}
switch (requestType) {
case ITaskWrapper.M3U8_LIVE:
className = "com.arialyy.aria.m3u8.live.M3U8LiveUtil";