本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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;
}
示例5: createOfflinePageItemWrapper
import org.chromium.chrome.browser.download.ui.DownloadHistoryItemWrapper.OfflinePageItemWrapper; //导入依赖的package包/类
private OfflinePageItemWrapper createOfflinePageItemWrapper(OfflinePageDownloadItem item) {
return new OfflinePageItemWrapper(item, mBackendProvider, mParentComponent);
}