зеркало из https://github.com/mozilla/gecko-dev.git
Bug 785945 - Add API to get multiple thumbnails at once from DB (r=mfinkle)
This commit is contained in:
Родитель
11b3da07ff
Коммит
8865e62aa9
|
@ -83,6 +83,8 @@ public class BrowserDB {
|
|||
|
||||
public byte[] getThumbnailForUrl(ContentResolver cr, String uri);
|
||||
|
||||
public Cursor getThumbnailsForUrls(ContentResolver cr, List<String> urls);
|
||||
|
||||
public void removeThumbnails(ContentResolver cr);
|
||||
|
||||
public void registerBookmarkObserver(ContentResolver cr, ContentObserver observer);
|
||||
|
@ -206,6 +208,10 @@ public class BrowserDB {
|
|||
return sDb.getThumbnailForUrl(cr, uri);
|
||||
}
|
||||
|
||||
public static Cursor getThumbnailsForUrls(ContentResolver cr, List<String> urls) {
|
||||
return sDb.getThumbnailsForUrls(cr, urls);
|
||||
}
|
||||
|
||||
public static void removeThumbnails(ContentResolver cr) {
|
||||
sDb.removeThumbnails(cr);
|
||||
}
|
||||
|
|
|
@ -708,6 +708,27 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
|||
return b;
|
||||
}
|
||||
|
||||
public Cursor getThumbnailsForUrls(ContentResolver cr, List<String> urls) {
|
||||
StringBuffer selection = new StringBuffer();
|
||||
String[] selectionArgs = new String[urls.size()];
|
||||
|
||||
for (int i = 0; i < urls.size(); i++) {
|
||||
final String url = urls.get(i);
|
||||
|
||||
if (i > 0)
|
||||
selection.append(" OR ");
|
||||
|
||||
selection.append(Images.URL + " = ?");
|
||||
selectionArgs[i] = url;
|
||||
}
|
||||
|
||||
return cr.query(mImagesUriWithProfile,
|
||||
new String[] { Images.URL, Images.THUMBNAIL },
|
||||
selection.toString(),
|
||||
selectionArgs,
|
||||
null);
|
||||
}
|
||||
|
||||
public void removeThumbnails(ContentResolver cr) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.putNull(Images.THUMBNAIL);
|
||||
|
|
Загрузка…
Ссылка в новой задаче