本文整理汇总了Java中com.liulishuo.filedownloader.BaseDownloadTask类的典型用法代码示例。如果您正苦于以下问题:Java BaseDownloadTask类的具体用法?Java BaseDownloadTask怎么用?Java BaseDownloadTask使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BaseDownloadTask类属于com.liulishuo.filedownloader包,在下文中一共展示了BaseDownloadTask类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onClickMultiParallel
import com.liulishuo.filedownloader.BaseDownloadTask; //导入依赖的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: over
import com.liulishuo.filedownloader.BaseDownloadTask; //导入依赖的package包/类
@Override
public synchronized void over(BaseDownloadTask task) {
task.removeFinishListener(this);
if (mQueueWeakReference == null) {
return;
}
final FileDownloadSerialQueue queue = mQueueWeakReference.get();
if (queue == null) {
return;
}
queue.workingTask = null;
if (queue.paused) {
return;
}
queue.sendNext();
}
示例3: over
import com.liulishuo.filedownloader.BaseDownloadTask; //导入依赖的package包/类
@Override
public synchronized void over(BaseDownloadTask task) {
task.removeFinishListener(this);
if (mQueueWeakReference == null) {
return;
}
final DownloadSerialQueue queue = mQueueWeakReference.get();
if (queue == null) {
return;
}
queue.workingTask = null;
if (queue.paused) {
return;
}
queue.sendNext();
}
示例4: onClickMultiSerial
import com.liulishuo.filedownloader.BaseDownloadTask; //导入依赖的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();
}
示例5: updateCompleted
import com.liulishuo.filedownloader.BaseDownloadTask; //导入依赖的package包/类
public void updateCompleted(final BaseDownloadTask task) {
toast(String.format("completed %d %s", position, task.getTargetFilePath()));
if (detailTv != null) {
detailTv.setText(String.format("sofar: %d total: %d",
task.getSmallFileSoFarBytes(), task.getSmallFileTotalBytes()));
}
updateSpeed(task.getSpeed());
pb.setIndeterminate(false);
pb.setMax(task.getSmallFileTotalBytes());
pb.setProgress(task.getSmallFileSoFarBytes());
}
示例6: connected
import com.liulishuo.filedownloader.BaseDownloadTask; //导入依赖的package包/类
@Override
protected void connected(BaseDownloadTask task, String etag, boolean isContinue, int soFarBytes, int totalBytes) {
DownloadTask downloadTask = new DownloadTask(task.getDownloadId() , task.getUrl() , task.getPath() ,
task.getLargeFileTotalBytes() , task.getLargeFileSoFarBytes() , System.currentTimeMillis());
if(mDownloadChangedListener != null){
mDownloadChangedListener.update(downloadTask);
}
}
示例7: addNotificationItem
import com.liulishuo.filedownloader.BaseDownloadTask; //导入依赖的package包/类
public void addNotificationItem(BaseDownloadTask task) {
if (disableNotification(task)) {
return;
}
final BaseNotificationItem n = create(task);
if (n != null) {
//noinspection unchecked
this.helper.add(n);
}
}
示例8: destroyNotification
import com.liulishuo.filedownloader.BaseDownloadTask; //导入依赖的package包/类
@Override
public void destroyNotification(BaseDownloadTask task) {
super.destroyNotification(task);
Toast.makeText(NotificationMinSetActivity.this, "destroyNotification() called with: status "
+ task.getStatus(), Toast.LENGTH_LONG).show();
downloadId = 0;
}
示例9: addNotificationItem
import com.liulishuo.filedownloader.BaseDownloadTask; //导入依赖的package包/类
@Override
public void addNotificationItem(BaseDownloadTask task) {
super.addNotificationItem(task);
if (wActivity.get() != null) {
wActivity.get().showNotificationCb.setEnabled(false);
}
}
示例10: destroyNotification
import com.liulishuo.filedownloader.BaseDownloadTask; //导入依赖的package包/类
@Override
public void destroyNotification(BaseDownloadTask task) {
super.destroyNotification(task);
if (wActivity.get() != null) {
wActivity.get().showNotificationCb.setEnabled(true);
wActivity.get().downloadId = 0;
}
}
示例11: interceptCancel
import com.liulishuo.filedownloader.BaseDownloadTask; //导入依赖的package包/类
@Override
protected boolean interceptCancel(BaseDownloadTask task,
BaseNotificationItem n) {
// in this demo, I don't want to cancel the notification, just show for the test
// so return true
return true;
}
示例12: disableNotification
import com.liulishuo.filedownloader.BaseDownloadTask; //导入依赖的package包/类
@Override
protected boolean disableNotification(BaseDownloadTask task) {
if (wActivity.get() != null) {
return !wActivity.get().showNotificationCb.isChecked();
}
return super.disableNotification(task);
}
示例13: pending
import com.liulishuo.filedownloader.BaseDownloadTask; //导入依赖的package包/类
@Override
protected void pending(BaseDownloadTask task, int soFarBytes, int totalBytes) {
super.pending(task, soFarBytes, totalBytes);
if (wActivity.get() != null) {
wActivity.get().progressBar.setIndeterminate(true);
}
}
示例14: warn
import com.liulishuo.filedownloader.BaseDownloadTask; //导入依赖的package包/类
@Override
protected void warn(BaseDownloadTask task) {
// ignore
// do not handle the case of the same URL and path task(the same download id), which
// will share the same notification item
// if (!disableNotification(task)) {
// destroyNotification(task);
// }
}
示例15: pending
import com.liulishuo.filedownloader.BaseDownloadTask; //导入依赖的package包/类
@Override
protected void pending(BaseDownloadTask task, int soFarBytes, int totalBytes) {
super.pending(task, soFarBytes, totalBytes);
final TaskItemViewHolder tag = checkCurrentHolder(task);
if (tag == null) {
return;
}
tag.updateDownloading(FileDownloadStatus.pending, soFarBytes
, totalBytes);
tag.taskStatusTv.setText(R.string.tasks_manager_demo_status_pending);
}