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


Java DownloadInfo类代码示例

本文整理汇总了Java中org.chromium.chrome.browser.download.DownloadInfo的典型用法代码示例。如果您正苦于以下问题:Java DownloadInfo类的具体用法?Java DownloadInfo怎么用?Java DownloadInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DownloadInfo类属于org.chromium.chrome.browser.download包,在下文中一共展示了DownloadInfo类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: notifyDownloadSuccessful

import org.chromium.chrome.browser.download.DownloadInfo; //导入依赖的package包/类
/**
* Update download notification to success.
* @param context Context to show notifications.
* @param guid GUID of a request to download a page related to the notification.
* @param url URL of the page to download.
* @param displayName Name to be displayed on notification.
*/
@CalledByNative
public static void notifyDownloadSuccessful(Context context, String guid, String url,
        String displayName) {
    DownloadNotifier notifier = getDownloadNotifier(context);
    if (notifier == null) return;

    DownloadInfo downloadInfo = new DownloadInfo.Builder()
                                        .setIsOfflinePage(true)
                                        .setDownloadGuid(guid)
                                        .setFileName(displayName)
                                        .setIsResumable(false)
                                        .setIsOffTheRecord(false)
                                        .build();

    notifier.notifyDownloadSuccessful(downloadInfo, -1, false, true);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:24,代码来源:OfflinePageNotificationBridge.java

示例2: notifyDownloadProgress

import org.chromium.chrome.browser.download.DownloadInfo; //导入依赖的package包/类
/**
 * Called by offline page backend to notify the user of download progress.
 * @param context Context to show notifications.
 * @param guid GUID of a request to download a page related to the notification.
 * @param url URL of the page to download.
 * @param startTime Time of the request.
 * @param displayName Name to be displayed on notification.
 */
@CalledByNative
public static void notifyDownloadProgress(
        Context context, String guid, String url, long startTime, String displayName) {
    DownloadNotifier notifier = getDownloadNotifier(context);
    if (notifier == null) return;

    // Use -1 percentage for interdeterminate progress bar (until we have better value).
    // TODO(qinmin): get the download percentage from native code,
    int percentage = -1;
    DownloadInfo downloadInfo = new DownloadInfo.Builder()
                                        .setIsOfflinePage(true)
                                        .setDownloadGuid(guid)
                                        .setFileName(displayName)
                                        .setFilePath(url)
                                        .setPercentCompleted(percentage)
                                        .setIsOffTheRecord(false)
                                        .setIsResumable(true)
                                        .setTimeRemainingInMillis(0)
                                        .build();

    notifier.notifyDownloadProgress(downloadInfo, startTime, false);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:31,代码来源:OfflinePageNotificationBridge.java

示例3: notifyDownloadSuccessful

import org.chromium.chrome.browser.download.DownloadInfo; //导入依赖的package包/类
/**
 * Update download notification to success.
 *
 * @param guid        GUID of a request to download a page related to the notification.
 * @param url         URL of the page to download.
 * @param displayName Name to be displayed on notification.
 */
@CalledByNative
public static void notifyDownloadSuccessful(String guid, String url, String displayName) {
    DownloadNotifier notifier = getDownloadNotifier();
    if (notifier == null) return;

    DownloadInfo downloadInfo = new DownloadInfo.Builder()
                                        .setIsOfflinePage(true)
                                        .setDownloadGuid(guid)
                                        .setFileName(displayName)
                                        .setIsResumable(false)
                                        .setIsOffTheRecord(false)
                                        .build();

    notifier.notifyDownloadSuccessful(downloadInfo, -1, false, true);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:23,代码来源:OfflinePageNotificationBridge.java

示例4: notifyDownloadProgress

import org.chromium.chrome.browser.download.DownloadInfo; //导入依赖的package包/类
/**
 * Called by offline page backend to notify the user of download progress.
 *
 * @param guid        GUID of a request to download a page related to the notification.
 * @param url         URL of the page to download.
 * @param startTime   Time of the request.
 * @param displayName Name to be displayed on notification.
 */
@CalledByNative
public static void notifyDownloadProgress(
        String guid, String url, long startTime, long bytesReceived, String displayName) {
    DownloadNotifier notifier = getDownloadNotifier();
    if (notifier == null) return;

    DownloadInfo downloadInfo = new DownloadInfo.Builder()
                                        .setIsOfflinePage(true)
                                        .setDownloadGuid(guid)
                                        .setFileName(displayName)
                                        .setFilePath(url)
                                        .setBytesReceived(bytesReceived)
                                        .setIsOffTheRecord(false)
                                        .setIsResumable(true)
                                        .setTimeRemainingInMillis(0)
                                        .build();

    notifier.notifyDownloadProgress(downloadInfo, startTime, false);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:28,代码来源:OfflinePageNotificationBridge.java

示例5: notifyDownloadFailed

import org.chromium.chrome.browser.download.DownloadInfo; //导入依赖的package包/类
/**
 * Update download notification to failure.
 * @param context Context to show notifications.
 * @param guid GUID of a request to download a page related to the notification.
 * @param url URL of the page to download.
 * @param displayName Name to be displayed on notification.
 */
@CalledByNative
public static void notifyDownloadFailed(Context context, String guid, String url,
        String displayName) {
    DownloadNotifier notifier = getDownloadNotifier(context);
    if (notifier == null) return;

    DownloadInfo downloadInfo = new DownloadInfo.Builder()
            .setIsOfflinePage(true).setDownloadGuid(guid).setFileName(displayName).build();

    notifier.notifyDownloadFailed(downloadInfo);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:19,代码来源:OfflinePageNotificationBridge.java

示例6: notifyDownloadPaused

import org.chromium.chrome.browser.download.DownloadInfo; //导入依赖的package包/类
/**
 * Update download notification to paused.
 * @param context Context to show notifications.
 * @param guid GUID of a request to download a page related to the notification.
 * @param displayName Name to be displayed on notification.
 */
@CalledByNative
public static void notifyDownloadPaused(Context context, String guid, String displayName) {
    DownloadNotifier notifier = getDownloadNotifier(context);
    if (notifier == null) return;

    DownloadInfo downloadInfo = new DownloadInfo.Builder()
            .setIsOfflinePage(true).setDownloadGuid(guid).setFileName(displayName).build();

    notifier.notifyDownloadPaused(downloadInfo);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:17,代码来源:OfflinePageNotificationBridge.java

示例7: notifyDownloadInterrupted

import org.chromium.chrome.browser.download.DownloadInfo; //导入依赖的package包/类
/**
 * Update download notification to interrupted.
 * @param context Context to show notifications.
 * @param guid GUID of a request to download a page related to the notification.
 * @param displayName Name to be displayed on notification.
 */
@CalledByNative
public static void notifyDownloadInterrupted(Context context, String guid, String displayName) {
    DownloadNotifier notifier = getDownloadNotifier(context);
    if (notifier == null) return;

    DownloadInfo downloadInfo = new DownloadInfo.Builder()
                                        .setIsOfflinePage(true)
                                        .setDownloadGuid(guid)
                                        .setFileName(displayName)
                                        .setIsResumable(true)
                                        .build();

    notifier.notifyDownloadInterrupted(downloadInfo, true);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:21,代码来源:OfflinePageNotificationBridge.java

示例8: notifyDownloadFailed

import org.chromium.chrome.browser.download.DownloadInfo; //导入依赖的package包/类
/**
 * Update download notification to failure.
 *
 * @param guid        GUID of a request to download a page related to the notification.
 * @param url         URL of the page to download.
 * @param displayName Name to be displayed on notification.
 */
@CalledByNative
public static void notifyDownloadFailed(String guid, String url, String displayName) {
    DownloadNotifier notifier = getDownloadNotifier();
    if (notifier == null) return;

    DownloadInfo downloadInfo = new DownloadInfo.Builder()
            .setIsOfflinePage(true).setDownloadGuid(guid).setFileName(displayName).build();

    notifier.notifyDownloadFailed(downloadInfo);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:18,代码来源:OfflinePageNotificationBridge.java

示例9: notifyDownloadPaused

import org.chromium.chrome.browser.download.DownloadInfo; //导入依赖的package包/类
/**
 * Update download notification to paused.
 *
 * @param guid        GUID of a request to download a page related to the notification.
 * @param displayName Name to be displayed on notification.
 */
@CalledByNative
public static void notifyDownloadPaused(String guid, String displayName) {
    DownloadNotifier notifier = getDownloadNotifier();
    if (notifier == null) return;

    DownloadInfo downloadInfo = new DownloadInfo.Builder()
            .setIsOfflinePage(true).setDownloadGuid(guid).setFileName(displayName).build();

    notifier.notifyDownloadPaused(downloadInfo);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:17,代码来源:OfflinePageNotificationBridge.java

示例10: notifyDownloadInterrupted

import org.chromium.chrome.browser.download.DownloadInfo; //导入依赖的package包/类
/**
 * Update download notification to interrupted.
 *
 * @param guid        GUID of a request to download a page related to the notification.
 * @param displayName Name to be displayed on notification.
 */
@CalledByNative
public static void notifyDownloadInterrupted(String guid, String displayName) {
    DownloadNotifier notifier = getDownloadNotifier();
    if (notifier == null) return;

    DownloadInfo downloadInfo = new DownloadInfo.Builder()
                                        .setIsOfflinePage(true)
                                        .setDownloadGuid(guid)
                                        .setFileName(displayName)
                                        .setIsResumable(true)
                                        .build();

    notifier.notifyDownloadInterrupted(downloadInfo, true);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:21,代码来源:OfflinePageNotificationBridge.java

示例11: isNewItemVisiblyDifferent

import org.chromium.chrome.browser.download.DownloadInfo; //导入依赖的package包/类
/** @return whether the given DownloadItem is visibly different from the current one. */
private boolean isNewItemVisiblyDifferent(DownloadItem newItem) {
    DownloadInfo oldInfo = mItem.getDownloadInfo();
    DownloadInfo newInfo = newItem.getDownloadInfo();

    if (oldInfo.getProgress().equals(newInfo.getProgress())) return true;
    if (oldInfo.getBytesReceived() != newInfo.getBytesReceived()) return true;
    if (oldInfo.state() != newInfo.state()) return true;
    if (oldInfo.isPaused() != newInfo.isPaused()) return true;
    if (!TextUtils.equals(oldInfo.getFilePath(), newInfo.getFilePath())) return true;

    return false;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:14,代码来源:DownloadHistoryItemWrapper.java


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