com.liulishuo.filedownloader.FileDownloadListener Java Examples

The following examples show how to use com.liulishuo.filedownloader.FileDownloadListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HybridTestActivity.java    From FileDownloader with Apache License 2.0 6 votes vote down vote up
/**
 * Start multiple download tasks parallel
 * <p>
 * 启动并行多任务下载
 *
 * @param view
 */
public void onClickMultiParallel(final View view) {
    updateDisplay(getString(R.string.hybrid_test_start_multiple_tasks_parallel, Constant.URLS.length));

    // 以相同的listener作为target,将不同的下载任务绑定起来
    final FileDownloadListener parallelTarget = createListener();
    final List<BaseDownloadTask> taskList = new ArrayList<>();
    int i = 0;
    for (String url : Constant.URLS) {
        taskList.add(FileDownloader.getImpl().create(url)
                .setTag(++i));
    }
    totalCounts += taskList.size();

    new FileDownloadQueueSet(parallelTarget)
            .setCallbackProgressTimes(1)
            .downloadTogether(taskList)
            .start();
}
 
Example #2
Source File: HybridTestActivity.java    From FileDownloader with Apache License 2.0 6 votes vote down vote up
/**
 * Start multiple download tasks serial
 * <p>
 * 启动串行多任务下载
 *
 * @param view
 */
public void onClickMultiSerial(final View view) {
    updateDisplay(getString(R.string.hybrid_test_start_multiple_tasks_serial, Constant.URLS.length));

    // 以相同的listener作为target,将不同的下载任务绑定起来
    final List<BaseDownloadTask> taskList = new ArrayList<>();
    final FileDownloadListener serialTarget = createListener();
    int i = 0;
    for (String url : Constant.URLS) {
        taskList.add(FileDownloader.getImpl().create(url)
                .setTag(++i));
    }
    totalCounts += taskList.size();

    new FileDownloadQueueSet(serialTarget)
            .setCallbackProgressTimes(1)
            .downloadSequentially(taskList)
            .start();
}
 
Example #3
Source File: UpdateFragment.java    From YCUpdateApp with Apache License 2.0 5 votes vote down vote up
private BaseDownloadTask downApk(String apkUrl, String saveApkPath, FileDownloadListener listener) {
    BaseDownloadTask baseDownloadTask = FileDownloader
            .getImpl()
            .create(apkUrl)
            .setPath(saveApkPath)
            .setListener(listener);
    baseDownloadTask.start();
    return baseDownloadTask;
}
 
Example #4
Source File: GlobalMonitor.java    From FileDownloader with Apache License 2.0 4 votes vote down vote up
@Override
public void onRequestStart(int count, boolean serial, FileDownloadListener lis) {
    markStart = 0;
    markOver = 0;
    Log.d(TAG, String.format("on request start %d %B", count, serial));
}