本文整理汇总了Java中com.liulishuo.filedownloader.FileDownloadListener类的典型用法代码示例。如果您正苦于以下问题:Java FileDownloadListener类的具体用法?Java FileDownloadListener怎么用?Java FileDownloadListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileDownloadListener类属于com.liulishuo.filedownloader包,在下文中一共展示了FileDownloadListener类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onClickMultiParallel
import com.liulishuo.filedownloader.FileDownloadListener; //导入依赖的package包/类
/**
* 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();
}
示例2: onClickMultiSerial
import com.liulishuo.filedownloader.FileDownloadListener; //导入依赖的package包/类
/**
* 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();
}
示例3: setListener
import com.liulishuo.filedownloader.FileDownloadListener; //导入依赖的package包/类
/**
* 状态监听
*/
public Tasker setListener(FileDownloadListener listener) {
this.listener = listener;
downloadTask.setListener(listener);
return this;
}
示例4: onRequestStart
import com.liulishuo.filedownloader.FileDownloadListener; //导入依赖的package包/类
@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));
}
示例5: getListener
import com.liulishuo.filedownloader.FileDownloadListener; //导入依赖的package包/类
public FileDownloadListener getListener() {
return listener;
}