new String[] { Browser.BookmarkColumns.URL, Browser.BookmarkColumns.TITLE,
Browser.BookmarkColumns.FAVICON }, "bookmark = 1", null, null);
<<<<<<< HEAD
if ((c != null) && c.moveToFirst()) {
int urlIndex = c.getColumnIndex(Browser.BookmarkColumns.URL);
int titleIndex = c.getColumnIndex(Browser.BookmarkColumns.TITLE);
int faviconIndex = c.getColumnIndex(Browser.BookmarkColumns.FAVICON);
do {
String url = c.getString(urlIndex);
String host = Uri.parse(url).getHost();
if (hosts.containsKey(host)) {
String title = c.getString(titleIndex);
Bitmap bmp = null;
byte[] data = c.getBlob(faviconIndex);
if (data != null) {
bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
}
Set matchingSites = (Set) hosts.get(host);
Iterator sitesIter = matchingSites.iterator();
while (sitesIter.hasNext()) {
Site site = sitesIter.next();
// We should only set the title if the bookmark is for the root
// (i.e. www.google.com), as website settings act on the origin
// as a whole rather than a single page under that origin. If the
// user has bookmarked a page under the root but *not* the root,
// then we risk displaying the title of that page which may or
// may not have any relevance to the origin.
if (url.equals(site.getOrigin()) ||
(new String(site.getOrigin()+"/")).equals(url)) {
site.setTitle(title);
}
if (bmp != null) {
site.setIcon(bmp);
=======
if (c != null) {
if(c.moveToFirst()) {
int urlIndex = c.getColumnIndex(Browser.BookmarkColumns.URL);
int titleIndex = c.getColumnIndex(Browser.BookmarkColumns.TITLE);
int faviconIndex = c.getColumnIndex(Browser.BookmarkColumns.FAVICON);
do {
String url = c.getString(urlIndex);
String host = Uri.parse(url).getHost();
if (hosts.containsKey(host)) {
String title = c.getString(titleIndex);
Bitmap bmp = null;
byte[] data = c.getBlob(faviconIndex);
if (data != null) {
bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
}
Set matchingSites = (Set)hosts.get(host);
Iterator sitesIter = matchingSites.iterator();
while (sitesIter.hasNext()) {
Site site = sitesIter.next();
site.setTitle(title);
if (bmp != null) {
site.setIcon(bmp);
}
>>>>>>> 2ceb570ad3b37fca2169ea9f453984cebf8c372c
}
}
} while (c.moveToNext()); |