Bug 882365: Add TopBookmarksView as a header to BookmarksListView. [r=lucasr]
authorSriram Ramasubramanian <sriram@mozilla.com>
Mon, 24 Jun 2013 11:03:28 -0700
changeset 143430 3cedae0f17c374badb9325c4e5b7dd2478c68aaf
parent 143429 a91d74641b227f18dc4f3c365349d589a65c2bf9
child 143431 c150a39332d69d1d6248adffb71a63c997b40420
push id32723
push useremorley@mozilla.com
push dateWed, 21 Aug 2013 12:10:14 +0000
treeherdermozilla-inbound@ab6bc4d9e4c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr
bugs882365
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 882365: Add TopBookmarksView as a header to BookmarksListView. [r=lucasr]
mobile/android/base/home/BookmarksPage.java
--- a/mobile/android/base/home/BookmarksPage.java
+++ b/mobile/android/base/home/BookmarksPage.java
@@ -16,22 +16,30 @@ import android.view.View;
 import android.view.ViewGroup;
 
 /**
  * A page in about:home that displays a ListView of bookmarks.
  */
 public class BookmarksPage extends HomeFragment {
     public static final String LOGTAG = "GeckoBookmarksPage";
 
-    // The view shown by the fragment.
+    // List of bookmarks.
     private BookmarksListView mList;
 
+    // Grid of top bookmarks.
+    private TopBookmarksView mTopBookmarks;
+
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
-        return inflater.inflate(R.layout.home_bookmarks_page, null);
+        BookmarksListView list = (BookmarksListView) inflater.inflate(R.layout.home_bookmarks_page, container, false);
+
+        mTopBookmarks = new TopBookmarksView(getActivity());
+        list.addHeaderView(mTopBookmarks);
+
+        return list;
     }
 
     @Override
     public void onViewCreated(View view, Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
 
         OnUrlOpenListener listener = null;
         try {
@@ -40,16 +48,18 @@ public class BookmarksPage extends HomeF
             throw new ClassCastException(getActivity().toString()
                     + " must implement HomePager.OnUrlOpenListener");
         }
 
         mList = (BookmarksListView) view.findViewById(R.id.bookmarks_list);
         mList.setOnUrlOpenListener(listener);
 
         registerForContextMenu(mList);
+
+        mTopBookmarks.setOnUrlOpenListener(listener);
     }
 
     @Override
     public void onDestroyView() {
         mList = null;
         super.onDestroyView();
     }