当前位置: 首页>>代码示例>>Java>>正文


Java BaseDownloadTask类代码示例

本文整理汇总了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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:HybridTestActivity.java

示例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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:FileDownloadSerialQueue.java

示例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();
}
 
开发者ID:Zweihui,项目名称:Aurora,代码行数:20,代码来源:DownloadSerialQueue.java

示例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();
}
 
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:26,代码来源:HybridTestActivity.java

示例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());
        }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:SingleTaskTestActivity.java

示例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);
    }
}
 
开发者ID:zhuangzaiku,项目名称:AndroidCollection,代码行数:9,代码来源:LCFileDownloader.java

示例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);
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:12,代码来源:FileDownloadNotificationListener.java

示例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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:NotificationMinSetActivity.java

示例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);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:NotificationSampleActivity.java

示例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;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:NotificationSampleActivity.java

示例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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:NotificationSampleActivity.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:NotificationSampleActivity.java

示例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);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:NotificationSampleActivity.java

示例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);
//        }
    }
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:10,代码来源:FileDownloadNotificationListener.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:TasksManagerDemoActivity.java


注:本文中的com.liulishuo.filedownloader.BaseDownloadTask类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。