diff options
Diffstat (limited to 'src/com/android/browser/BookmarkUtils.java')
| -rw-r--r-- | src/com/android/browser/BookmarkUtils.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/com/android/browser/BookmarkUtils.java b/src/com/android/browser/BookmarkUtils.java index 491c16c17..23765f4d3 100644 --- a/src/com/android/browser/BookmarkUtils.java +++ b/src/com/android/browser/BookmarkUtils.java @@ -115,10 +115,7 @@ public class BookmarkUtils { static Intent createAddToHomeIntent(Context context, String url, String title, Bitmap touchIcon, Bitmap favicon) { Intent i = new Intent(INSTALL_SHORTCUT); - Intent shortcutIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); - long urlHash = url.hashCode(); - long uniqueId = (urlHash << 32) | shortcutIntent.hashCode(); - shortcutIntent.putExtra(Browser.EXTRA_APPLICATION_ID, Long.toString(uniqueId)); + Intent shortcutIntent = createShortcutIntent(url); i.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); i.putExtra(Intent.EXTRA_SHORTCUT_NAME, title); i.putExtra(Intent.EXTRA_SHORTCUT_ICON, createIcon(context, touchIcon, favicon, @@ -129,6 +126,14 @@ public class BookmarkUtils { return i; } + static Intent createShortcutIntent(String url) { + Intent shortcutIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); + long urlHash = url.hashCode(); + long uniqueId = (urlHash << 32) | shortcutIntent.hashCode(); + shortcutIntent.putExtra(Browser.EXTRA_APPLICATION_ID, Long.toString(uniqueId)); + return shortcutIntent; + } + private static Bitmap getIconBackground(Context context, BookmarkIconType type, int density) { if (type == BookmarkIconType.ICON_HOME_SHORTCUT) { // Want to create a shortcut icon on the homescreen, so the icon |
