diff options
author | John Reck <jreck@google.com> | 2010-12-16 11:17:54 -0800 |
---|---|---|
committer | John Reck <jreck@google.com> | 2010-12-16 11:17:54 -0800 |
commit | 8e8e71ca9a24996eedfacba2bf5a4b587149727f (patch) | |
tree | cc419b45480d588db09ab27b1f7b0c9379d33848 /src/com/android/browser/widget | |
parent | 825d7a07726d7f77f4e08d7f54c166a4b3cf9ebd (diff) | |
download | packages_apps_Browser-8e8e71ca9a24996eedfacba2bf5a4b587149727f.zip packages_apps_Browser-8e8e71ca9a24996eedfacba2bf5a4b587149727f.tar.gz packages_apps_Browser-8e8e71ca9a24996eedfacba2bf5a4b587149727f.tar.bz2 |
Bookmark widget favicon drawing cleanup
Bug: 3289421
Changes the favicon drawing for the bookmark widget to keep the favicon
at its original size and draw a mostly transparent rounded white rectangle
behind it.
Change-Id: I8267bbcc3d805d0266281f231e38393eec4d0bc2
Diffstat (limited to 'src/com/android/browser/widget')
-rw-r--r-- | src/com/android/browser/widget/BookmarkListWidgetService.java | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/com/android/browser/widget/BookmarkListWidgetService.java b/src/com/android/browser/widget/BookmarkListWidgetService.java index 30671fc..39751e6 100644 --- a/src/com/android/browser/widget/BookmarkListWidgetService.java +++ b/src/com/android/browser/widget/BookmarkListWidgetService.java @@ -16,6 +16,7 @@ package com.android.browser.widget; +import com.android.browser.BookmarkUtils; import com.android.browser.BrowserBookmarksPage; import com.android.browser.R; @@ -362,16 +363,37 @@ public class BookmarkListWidgetService extends RemoteViewsService { RenderResult res = new RenderResult(id, title, url); res.mIsFolder = c.getInt(BOOKMARK_INDEX_IS_FOLDER) != 0; if (!res.mIsFolder) { + // RemoteViews require a valid bitmap config + Options options = new Options(); + options.inPreferredConfig = Config.ARGB_8888; + Bitmap favIcon = null; + Bitmap touchIcon = null; byte[] blob = c.getBlob(BOOKMARK_INDEX_TOUCH_ICON); - if (blob == null || blob.length == 0) { + if (blob != null && blob.length > 0) { + touchIcon = BitmapFactory.decodeByteArray( + blob, 0, blob.length, options); + } else { blob = c.getBlob(BOOKMARK_INDEX_FAVICON); + if (blob != null && blob.length > 0) { + favIcon = BitmapFactory.decodeByteArray( + blob, 0, blob.length, options); + } } - 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); + + if (favIcon == null) { + favIcon = BitmapFactory.decodeResource( + mContext.getResources(), + R.drawable.app_web_browser_sm); + } + if (touchIcon != null || favIcon != null) { + res.mBitmap = BookmarkUtils.createListWidgetIcon( + mContext, touchIcon, favIcon); + } + if (touchIcon != null) { + touchIcon.recycle(); + } + if (favIcon != null) { + favIcon.recycle(); } } bookmarks.add(res); |