Refactor Bookmark fragment, fixes NPE

 Bug: 2926451
 This change refactors the BrowserBookmarkPage fragment for better
 encapsulation, and updates the CombinedBookmarkHistoryView and
 ShortcutActivity. ShortcutActivity now supports folder navigation
 as well as toggling list or thumbnail view.

Change-Id: Ie8168467e793d60d75c15746f81318cfa7e9f003
diff --git a/res/layout/bookmarks.xml b/res/layout/bookmarks.xml
index 66a78e8..7a0aa23 100644
--- a/res/layout/bookmarks.xml
+++ b/res/layout/bookmarks.xml
@@ -14,36 +14,49 @@
      limitations under the License.
 -->
 
-<FrameLayout
+<LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
-    <GridView
-        android:id="@+id/grid"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <FrameLayout
+        android:id="@+id/header_container"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:horizontalSpacing="16dip"
-        android:verticalSpacing="16dip"
-        android:stretchMode="spacingWidth"
-        android:scrollbarStyle="insideInset"
-        android:listSelector="@android:drawable/gallery_thumb"
-        android:drawSelectorOnTop="true"
-        android:focusable="true"
-        android:focusableInTouchMode="true"
-        android:numColumns="auto_fit" />
-    <ListView
-        android:id="@+id/list"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:focusable="true"
-        android:focusableInTouchMode="true"
-        android:visibility="gone"/>
-    <TextView
-        android:id="@android:id/empty"
-        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_gravity="center"
-        android:textAppearance="?android:attr/textAppearanceLarge"
-        android:text="@string/empty_bookmarks_folder"
         android:visibility="gone" />
-</FrameLayout>
+
+    <FrameLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+        <GridView
+            android:id="@+id/grid"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:horizontalSpacing="16dip"
+            android:verticalSpacing="16dip"
+            android:stretchMode="spacingWidth"
+            android:scrollbarStyle="insideInset"
+            android:listSelector="@android:drawable/gallery_thumb"
+            android:drawSelectorOnTop="true"
+            android:focusable="true"
+            android:focusableInTouchMode="true"
+            android:numColumns="auto_fit" />
+        <ListView
+            android:id="@+id/list"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:focusable="true"
+            android:focusableInTouchMode="true"
+            android:visibility="gone"/>
+        <TextView
+            android:id="@android:id/empty"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:textAppearance="?android:attr/textAppearanceLarge"
+            android:text="@string/empty_bookmarks_folder"
+            android:visibility="gone" />
+    </FrameLayout>
+
+</LinearLayout>