Search in sources :

Example 1 with UploadTask

use of com.lzy.okserver.upload.UploadTask in project okhttp-OkGo by jeasonlzy.

the class OkUpload method restore.

/**
 * 从数据库中恢复任务
 */
public static List<UploadTask<?>> restore(List<Progress> progressList) {
    Map<String, UploadTask<?>> taskMap = OkUpload.getInstance().getTaskMap();
    List<UploadTask<?>> tasks = new ArrayList<>();
    for (Progress progress : progressList) {
        UploadTask<?> task = taskMap.get(progress.tag);
        if (task == null) {
            task = new UploadTask<>(progress);
            taskMap.put(progress.tag, task);
        }
        tasks.add(task);
    }
    return tasks;
}
Also used : UploadTask(com.lzy.okserver.upload.UploadTask) Progress(com.lzy.okgo.model.Progress) ArrayList(java.util.ArrayList)

Aggregations

Progress (com.lzy.okgo.model.Progress)1 UploadTask (com.lzy.okserver.upload.UploadTask)1 ArrayList (java.util.ArrayList)1