private static ArrayList<String> getUrlsWithoutFavicon(Cursor c) { ArrayList<String> urls = new ArrayList<String>(); if (c == null || !c.moveToFirst()) { return urls; } final Favicons favicons = Favicons.getInstance(); do { final String url = c.getString(c.getColumnIndexOrThrow(URLColumns.URL)); // We only want to load favicons from DB if they are not in the // memory cache yet. The url is null for bookmark folders. if (url == null || favicons.getFaviconFromMemCache(url) != null) { continue; } urls.add(url); } while (c.moveToNext()); return urls; }
private static void storeFaviconsInMemCache(Cursor c) { if (c == null || !c.moveToFirst()) { return; } final Favicons favicons = Favicons.getInstance(); do { final String url = c.getString(c.getColumnIndexOrThrow(URLColumns.URL)); final byte[] b = c.getBlob(c.getColumnIndexOrThrow(URLColumns.FAVICON)); if (b == null) { continue; } Bitmap favicon = BitmapUtils.decodeByteArray(b); if (favicon == null) { continue; } favicon = favicons.scaleImage(favicon); favicons.putFaviconInMemCache(url, favicon); } while (c.moveToNext()); }