Merge "change widget to use new PendingIntent API        set template on StackView        setFillInIntent for individual items"
diff --git a/src/com/android/browser/widget/BookmarkStackWidgetService.java b/src/com/android/browser/widget/BookmarkStackWidgetService.java
index f58cec1..83b07df 100644
--- a/src/com/android/browser/widget/BookmarkStackWidgetService.java
+++ b/src/com/android/browser/widget/BookmarkStackWidgetService.java
@@ -42,15 +42,12 @@
 
     private static final String LOGTAG = "browserwidget";
 
-    /** Force the bookmarks to be re-renderer. */
+    /** Force the bookmarks to be re-rendered. */
     public static final String UPDATE = "com.android.browser.widget.UPDATE";
 
     /** the adapter intent action */
     public static final String ADAPTER = "com.android.browser.widget.ADAPTER";
 
-    private static final String EXTRA_ID = "_id";
-    private static final String EXTRA_URL = "_url";
-
     private static final String[] PROJECTION = new String[] {
         BrowserContract.Bookmarks._ID,
         BrowserContract.Bookmarks.TITLE,
@@ -91,6 +88,11 @@
     private void updateWidget() {
         RemoteViews views = new RemoteViews(getPackageName(),
                 R.layout.bookmarkstackwidget);
+        Intent vi = new Intent(Intent.ACTION_VIEW);
+        vi.addCategory(Intent.CATEGORY_BROWSABLE);
+        views.setPendingIntentTemplate(R.id.stackwidget_stack,
+                PendingIntent.getActivity(BookmarkStackWidgetService.this, 0, vi,
+                        PendingIntent.FLAG_CANCEL_CURRENT));
         Intent adapter = new Intent(BookmarkStackWidgetService.ADAPTER, null,
                 this, BookmarkStackWidgetService.class);
         views.setRemoteAdapter(R.id.stackwidget_stack, adapter);
@@ -106,6 +108,8 @@
 
     RemoteViewsService.RemoteViewsFactory mViewFactory = new RemoteViewsFactory () {
 
+        Intent mFillIntent;
+        
         @Override
         public int getCount() {
             return mBookmarks.size();
@@ -126,9 +130,8 @@
             RenderResult res = mBookmarks.get(position);
             RemoteViews views = new RemoteViews(getPackageName(),
                     R.layout.bookmarkstackwidget_item);
-            views.setOnClickPendingIntent(R.id.stack_item,
-                    getOpenUrlPendingIntent(res.mUrl));
-
+            mFillIntent.setData(Uri.parse(res.mUrl));
+            views.setOnClickFillInIntent(R.id.stack_item, mFillIntent);
             // Set the title of the bookmark. Use the url as a backup.
             String displayTitle = res.mTitle;
             if (TextUtils.isEmpty(displayTitle)) {
@@ -154,6 +157,7 @@
 
         @Override
         public void onCreate() {
+            mFillIntent = new Intent();
             update();
         }
 
@@ -195,13 +199,6 @@
         }
     };
 
-    private PendingIntent getOpenUrlPendingIntent(String url) {
-        Intent vi = new Intent(Intent.ACTION_VIEW);
-        vi.setData(Uri.parse(url));
-        return PendingIntent.getActivity(this, 0, vi, PendingIntent.FLAG_CANCEL_CURRENT);
-    }
-
-
     // Class containing the rendering information for a specific bookmark.
     private static class RenderResult {
         final int mId;
@@ -217,5 +214,4 @@
 
     }
 
-
 }