@Override public void run() { for (DownloadTask task : scheduleTaskList) { if (!isStarted()) { callbackQueueEndOnSerialLoop(task.isAutoCallbackToUIThread()); break; } task.execute(targetListener); } } });
@Override public void run() { for (DownloadTask task : completedTaskCollection) { task.getListener().taskEnd(task, EndCause.COMPLETED, null); } for (DownloadTask task : sameTaskConflictCollection) { task.getListener().taskEnd(task, EndCause.SAME_TASK_BUSY, null); } for (DownloadTask task : fileBusyCollection) { task.getListener().taskEnd(task, EndCause.FILE_BUSY, null); } } });
@Override public void run() { task.getListener().connectEnd(task, blockIndex, responseCode, requestHeaderFields); } });
public void setPriority(DownloadTask task, int priority) { final DownloadTask newTask = task.toBuilder().setPriority(priority).build(); this.context = context.toBuilder() .bindSetTask(newTask) .build(); newTask.setTags(task); TagUtil.savePriority(newTask, priority); this.taskList = Arrays.asList(this.context.getTasks()); }
void inspectTaskStart(DownloadTask task) { final DownloadMonitor monitor = OkDownload.with().getMonitor(); if (monitor != null) monitor.taskStart(task); }
public FileDownloadSerialQueue() { this(new DownloadSerialQueue(), new UnifiedListenerManager()); }
@Override public void run() { task.getListener() .connectTrialEnd(task, responseCode, headerFields); } });
@Override public void run() { task.getListener().taskStart(task); } });
@Override public void run() { task.getListener().connectTrialStart(task, headerFields); } });
@Override public void run() { task.getListener().downloadFromBeginning(task, info, cause); } });
@Override public void run() { task.getListener().downloadFromBreakpoint(task, info); } });
@Override public void run() { task.getListener().connectStart(task, blockIndex, requestHeaderFields); } });
@Override public void run() { task.getListener().fetchProgress(task, blockIndex, increaseBytes); } });
@Override public void run() { task.getListener().fetchEnd(task, blockIndex, contentLength); } });
@Override public void run() { task.getListener().fetchStart(task, blockIndex, contentLength); } });
/** * With wikipedia: https://en.wikipedia.org/wiki/Kibibyte * <p> * 1KiB = 2^10B = 1024B * 1MiB = 2^10KB = 1024KB */ public String getSpeedWithBinaryAndFlush() { return humanReadableSpeed(getInstantBytesPerSecondAndFlush(), false); }
@Override public void run() { for (DownloadTask task : errorCollection) { task.getListener().taskEnd(task, EndCause.ERROR, realCause); } } });
/** * With wikipedia: https://en.wikipedia.org/wiki/Kilobyte * <p> * 1KB = 1000B * 1MB = 1000KB */ public String getSpeedWithSIAndFlush() { return humanReadableSpeed(getInstantBytesPerSecondAndFlush(), true); }
@Override public void run() { for (DownloadTask task : canceledCollection) { task.getListener().taskEnd(task, EndCause.CANCELED, null); } } });
@Override public void run() { task.getListener().taskEnd(task, cause, realCause); } });