summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/widget
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2010-12-15 15:51:33 -0800
committerJohn Reck <jreck@google.com>2010-12-15 16:21:58 -0800
commit023a60e37c0f3374aed57531ab11b7f20ece232b (patch)
tree309f3cd90ac7eea245dded37ff06afef3b6d1391 /src/com/android/browser/widget
parentbd018d44c193f7afe5f3c0839766ff1ab19712b9 (diff)
downloadpackages_apps_Browser-023a60e37c0f3374aed57531ab11b7f20ece232b.zip
packages_apps_Browser-023a60e37c0f3374aed57531ab11b7f20ece232b.tar.gz
packages_apps_Browser-023a60e37c0f3374aed57531ab11b7f20ece232b.tar.bz2
Use touch icon in the widget if available
Bug: 3289421 Change-Id: I45f435e2949f2749b9221e007037dedd69781cd6
Diffstat (limited to 'src/com/android/browser/widget')
-rw-r--r--src/com/android/browser/widget/BookmarkListWidgetService.java37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/com/android/browser/widget/BookmarkListWidgetService.java b/src/com/android/browser/widget/BookmarkListWidgetService.java
index 8cf63a3..30671fc 100644
--- a/src/com/android/browser/widget/BookmarkListWidgetService.java
+++ b/src/com/android/browser/widget/BookmarkListWidgetService.java
@@ -64,8 +64,14 @@ public class BookmarkListWidgetService extends RemoteViewsService {
BrowserContract.Bookmarks.URL,
BrowserContract.Bookmarks.FAVICON,
BrowserContract.Bookmarks.IS_FOLDER,
- BrowserContract.Bookmarks.PARENT,
- BrowserContract.Bookmarks.POSITION};
+ BrowserContract.Bookmarks.TOUCH_ICON,
+ BrowserContract.Bookmarks.POSITION /* needed for order by */};
+ private static final int BOOKMARK_INDEX_ID = 0;
+ private static final int BOOKMARK_INDEX_TITLE = 1;
+ private static final int BOOKMARK_INDEX_URL = 2;
+ private static final int BOOKMARK_INDEX_FAVICON = 3;
+ private static final int BOOKMARK_INDEX_IS_FOLDER = 4;
+ private static final int BOOKMARK_INDEX_TOUCH_ICON = 5;
private Map<Integer, BookmarkFactory> mFactories;
private Handler mUiHandler;
@@ -350,19 +356,24 @@ public class BookmarkListWidgetService extends RemoteViewsService {
bookmarks.add(res);
}
while (c.moveToNext()) {
- long id = c.getLong(0);
- String title = c.getString(1);
- String url = c.getString(2);
+ long id = c.getLong(BOOKMARK_INDEX_ID);
+ String title = c.getString(BOOKMARK_INDEX_TITLE);
+ String url = c.getString(BOOKMARK_INDEX_URL);
RenderResult res = new RenderResult(id, title, url);
- byte[] blob = c.getBlob(3);
- if (blob != null) {
- // RemoteViews require a valid bitmap config
- Options options = new Options();
- options.inPreferredConfig = Config.ARGB_8888;
- res.mBitmap = BitmapFactory.decodeByteArray(
- blob, 0, blob.length, options);
+ res.mIsFolder = c.getInt(BOOKMARK_INDEX_IS_FOLDER) != 0;
+ if (!res.mIsFolder) {
+ byte[] blob = c.getBlob(BOOKMARK_INDEX_TOUCH_ICON);
+ if (blob == null || blob.length == 0) {
+ blob = c.getBlob(BOOKMARK_INDEX_FAVICON);
+ }
+ if (blob != null) {
+ // RemoteViews require a valid bitmap config
+ Options options = new Options();
+ options.inPreferredConfig = Config.ARGB_8888;
+ res.mBitmap = BitmapFactory.decodeByteArray(
+ blob, 0, blob.length, options);
+ }
}
- res.mIsFolder = c.getInt(4) != 0;
bookmarks.add(res);
}
return bookmarks;