Bug 1063896 - Loop over all url list, not just ones with metadata. r=lucasr

This commit is contained in:
Wes Johnston 2014-09-16 17:16:42 -07:00
parent 0dbf84857e
commit a2bc4495f8

View File

@ -675,6 +675,10 @@ public class TopSitesPanel extends HomeFragment {
} }
public static ThumbnailInfo fromMetadata(final Map<String, Object> data) { public static ThumbnailInfo fromMetadata(final Map<String, Object> data) {
if (data == null) {
return null;
}
final String imageUrl = (String) data.get(TILE_IMAGE_URL_COLUMN); final String imageUrl = (String) data.get(TILE_IMAGE_URL_COLUMN);
if (imageUrl == null) { if (imageUrl == null) {
return null; return null;
@ -721,22 +725,16 @@ public class TopSitesPanel extends HomeFragment {
final Map<String, Map<String, Object>> metadata = URLMetadata.getForUrls(cr, mUrls, COLUMNS); final Map<String, Map<String, Object>> metadata = URLMetadata.getForUrls(cr, mUrls, COLUMNS);
// Keep a list of urls that don't have tiles images. We'll use thumbnails for them instead. // Keep a list of urls that don't have tiles images. We'll use thumbnails for them instead.
final List<String> thumbnailUrls; final List<String> thumbnailUrls = new ArrayList<String>();
if (metadata != null) { for (String url : mUrls) {
thumbnailUrls = new ArrayList<String>(); ThumbnailInfo info = ThumbnailInfo.fromMetadata(metadata.get(url));
if (info == null) {
for (String url : metadata.keySet()) { // If we didn't find metadata, we'll look for a thumbnail for this url.
ThumbnailInfo info = ThumbnailInfo.fromMetadata(metadata.get(url)); thumbnailUrls.add(url);
if (info == null) { continue;
// If we didn't find metadata, we'll look for a thumbnail for this url.
thumbnailUrls.add(url);
continue;
}
thumbnails.put(url, info);
} }
} else {
thumbnailUrls = new ArrayList<String>(mUrls); thumbnails.put(url, info);
} }
if (thumbnailUrls.size() == 0) { if (thumbnailUrls.size() == 0) {