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


Java OfflinePageItemWrapper类代码示例

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


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

示例1: filterOfflinePageItems

import org.chromium.chrome.browser.download.ui.DownloadHistoryItemWrapper.OfflinePageItemWrapper; //导入依赖的package包/类
/**
 * Filters the offline pages based on the current filter and search text.
 * If there are suggested pages, they are filtered based on whether or not the subsection for
 * that date is expanded. Also a TimedItem is added to each subsection to represent the header
 * for the suggested pages.
 * @param filteredTimedItems List for appending items that match the filter.
 */
private void filterOfflinePageItems(List<TimedItem> filteredTimedItems) {
    Map<Date, List<DownloadHistoryItemWrapper>> suggestedPageMap = new HashMap<>();

    List<TimedItem> filteredOfflinePageItems = new ArrayList<>();
    mOfflinePageItems.filter(mFilter, mSearchQuery, filteredOfflinePageItems);

    for (TimedItem item : filteredOfflinePageItems) {
        OfflinePageItemWrapper offlineItem = (OfflinePageItemWrapper) item;

        // Add the suggested pages to the adapter only if the section is expanded for that date.
        if (offlineItem.isSuggested()) {
            addItemToSuggestedPagesMap(offlineItem, suggestedPageMap);
            if (!isSubsectionExpanded(
                        DownloadUtils.getDateAtMidnight(offlineItem.getTimestamp()))) {
                continue;
            }
        }
        filteredTimedItems.add(offlineItem);
    }

    generateSubsectionHeaders(filteredTimedItems, suggestedPageMap);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:30,代码来源:DownloadHistoryAdapter.java

示例2: initializeOfflinePageBridge

import org.chromium.chrome.browser.download.ui.DownloadHistoryItemWrapper.OfflinePageItemWrapper; //导入依赖的package包/类
private void initializeOfflinePageBridge() {
    mOfflinePageObserver = new OfflinePageDownloadBridge.Observer() {
        @Override
        public void onItemsLoaded() {
            onAllOfflinePagesRetrieved(getOfflinePageBridge().getAllItems());
        }

        @Override
        public void onItemAdded(OfflinePageDownloadItem item) {
            addDownloadHistoryItemWrapper(createOfflinePageItemWrapper(item));
            updateDisplayedItems();
        }

        @Override
        public void onItemDeleted(String guid) {
            if (mOfflinePageItems.removeItem(guid) != null) updateDisplayedItems();
        }

        @Override
        public void onItemUpdated(OfflinePageDownloadItem item) {
            int index = mOfflinePageItems.findItemIndex(item.getGuid());
            if (index != BackendItems.INVALID_INDEX) {
                OfflinePageItemWrapper wrapper = createOfflinePageItemWrapper(item);
                mOfflinePageItems.set(index, wrapper);
                mFilePathsToItemsMap.replaceItem(wrapper);
                updateDisplayedItems();
            }
        }

        /** Re-filter the items if needed. */
        private void updateDisplayedItems() {
            if (mFilter == DownloadFilter.FILTER_ALL || mFilter == DownloadFilter.FILTER_PAGE) {
                filter(mFilter);
            }
        }
    };
    getOfflinePageBridge().addObserver(mOfflinePageObserver);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:39,代码来源:DownloadHistoryAdapter.java

示例3: addItemToSuggestedPagesMap

import org.chromium.chrome.browser.download.ui.DownloadHistoryItemWrapper.OfflinePageItemWrapper; //导入依赖的package包/类
private void addItemToSuggestedPagesMap(OfflinePageItemWrapper offlineItem,
        Map<Date, List<DownloadHistoryItemWrapper>> suggestedPageMap) {
    Date date = DownloadUtils.getDateAtMidnight(offlineItem.getTimestamp());

    if (!suggestedPageMap.containsKey(date)) {
        suggestedPageMap.put(date, new ArrayList<DownloadHistoryItemWrapper>());
    }

    suggestedPageMap.get(date).add(offlineItem);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:11,代码来源:DownloadHistoryAdapter.java

示例4: isSuggestedOfflinePage

import org.chromium.chrome.browser.download.ui.DownloadHistoryItemWrapper.OfflinePageItemWrapper; //导入依赖的package包/类
private boolean isSuggestedOfflinePage(TimedItem timedItem) {
    if (timedItem instanceof OfflinePageItemWrapper) {
        return ((OfflinePageItemWrapper) timedItem).isSuggested();
    }

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

示例5: createOfflinePageItemWrapper

import org.chromium.chrome.browser.download.ui.DownloadHistoryItemWrapper.OfflinePageItemWrapper; //导入依赖的package包/类
private OfflinePageItemWrapper createOfflinePageItemWrapper(OfflinePageDownloadItem item) {
    return new OfflinePageItemWrapper(item, mBackendProvider, mParentComponent);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:4,代码来源:DownloadHistoryAdapter.java


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