Bug 888905: Tablet bookmarks page for new about:home. [r=lucasr]
authorSriram Ramasubramanian <sriram@mozilla.com>
Wed, 07 Aug 2013 09:39:26 -0700
changeset 156416 23affad4e7a180146a0bd3ae526c57b562e3ee1d
parent 156415 f7264772c802b90a599ded28248e0682d5a58300
child 156417 1956f7c88b6f471e8f38c6816ca2a5fae0c70161
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr
bugs888905
milestone25.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 888905: Tablet bookmarks page for new about:home. [r=lucasr]
CLOBBER
mobile/android/base/Makefile.in
mobile/android/base/home/BookmarksListAdapter.java
mobile/android/base/home/BookmarksListView.java
mobile/android/base/home/TopBookmarksView.java
mobile/android/base/resources/layout/bookmark_item_row.xml
mobile/android/base/resources/values-large-land-v11/styles.xml
mobile/android/base/resources/values-large-v11/styles.xml
mobile/android/base/resources/values-v11/themes.xml
mobile/android/base/resources/values-xlarge-land-v11/styles.xml
mobile/android/base/resources/values/attrs.xml
mobile/android/base/resources/values/styles.xml
mobile/android/base/resources/values/themes.xml
--- a/CLOBBER
+++ b/CLOBBER
@@ -12,9 +12,9 @@
 #          O               O
 #          |               |
 #          O <-- Clobber   O  <-- Clobber
 #
 # Note: The description below will be part of the error message shown to users.
 #
 # Modifying this file will now automatically clobber the buildbot machines \o/
 #
-Removal of XPIDL for bug 893117 requires a clobber to make sure interfaces aren't generated.
+Bug 888905: Tablet bookmarks layout, makefile and xml changes requires clobbering.
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -451,16 +451,17 @@ endif
 
 RES_LAYOUT = \
   $(SYNC_RES_LAYOUT) \
   res/layout/arrow_popup.xml \
   res/layout/autocomplete_list.xml \
   res/layout/autocomplete_list_item.xml \
   res/layout/bookmark_edit.xml \
   res/layout/bookmark_folder_row.xml \
+  res/layout/bookmark_item_row.xml \
   res/layout/browser_search.xml \
   res/layout/browser_toolbar.xml \
   res/layout/datetime_picker.xml \
   res/layout/doorhanger.xml \
   res/layout/doorhanger_button.xml \
   res/layout/find_in_page_content.xml \
   res/layout/font_size_preference.xml \
   res/layout/gecko_app.xml \
@@ -569,16 +570,20 @@ RES_VALUES_LARGE_LAND_V11 = \
   $(NULL)
 
 RES_VALUES_XLARGE_V11 = \
   res/values-xlarge-v11/dimens.xml \
   res/values-xlarge-v11/integers.xml \
   res/values-xlarge-v11/styles.xml \
   $(NULL)
 
+RES_VALUES_XLARGE_LAND_V11 = \
+  res/values-xlarge-land-v11/styles.xml \
+  $(NULL)
+
 RES_VALUES_V14 = \
   res/values-v14/styles.xml \
   $(NULL)
 
 RES_VALUES_V16 = \
   res/values-v16/styles.xml \
   $(NULL)
 
@@ -1121,29 +1126,31 @@ RESOURCES = \
   $(RES_VALUES) \
   $(RES_VALUES_LAND) \
   $(RES_VALUES_LAND_V14) \
   $(RES_VALUES_LARGE_LAND_V11) \
   $(RES_VALUES_LARGE_V11) \
   $(RES_VALUES_V11) \
   $(RES_VALUES_V14) \
   $(RES_VALUES_V16) \
+  $(RES_VALUES_XLARGE_LAND_V11) \
   $(RES_VALUES_XLARGE_V11) \
   $(RES_XML) \
   $(RES_XML_V11) \
   $(NULL)
 
 RES_DIRS= \
   res/layout                    \
   res/layout-large-v11          \
   res/layout-large-land-v11     \
   res/layout-xlarge-v11         \
   res/values                    \
   res/values-v11                \
   res/values-large-v11          \
+  res/values-xlarge-land-v11    \
   res/values-xlarge-v11         \
   res/values-v14                \
   res/values-v16                \
   res/xml                       \
   res/xml-v11                   \
   res/anim                      \
   res/drawable-ldpi             \
   res/drawable-mdpi             \
--- a/mobile/android/base/home/BookmarksListAdapter.java
+++ b/mobile/android/base/home/BookmarksListAdapter.java
@@ -19,17 +19,17 @@ import java.util.LinkedList;
 /**
  * Adapter to back the BookmarksListView with a list of bookmarks.
  */
 class BookmarksListAdapter extends MultiTypeCursorAdapter {
     private static final int VIEW_TYPE_ITEM = 0;
     private static final int VIEW_TYPE_FOLDER = 1;
 
     private static final int[] VIEW_TYPES = new int[] { VIEW_TYPE_ITEM, VIEW_TYPE_FOLDER };
-    private static final int[] LAYOUT_TYPES = new int[] { R.layout.home_item_row, R.layout.bookmark_folder_row };
+    private static final int[] LAYOUT_TYPES = new int[] { R.layout.bookmark_item_row, R.layout.bookmark_folder_row };
 
     // A listener that knows how to refresh the list for a given folder id.
     // This is usually implemented by the enclosing fragment/activity.
     public static interface OnRefreshFolderListener {
         // The folder id to refresh the list with.
         public void onRefreshFolder(int folderId);
     }
 
--- a/mobile/android/base/home/BookmarksListView.java
+++ b/mobile/android/base/home/BookmarksListView.java
@@ -34,17 +34,17 @@ public class BookmarksListView extends H
     // The default touch slop.
     private int mTouchSlop;
 
     public BookmarksListView(Context context) {
         this(context, null);
     }
 
     public BookmarksListView(Context context, AttributeSet attrs) {
-        this(context, attrs, R.attr.homeListViewStyle);
+        this(context, attrs, R.attr.bookmarksListViewStyle);
     }
 
     public BookmarksListView(Context context, AttributeSet attrs, int defStyle) {
         super(context, attrs, defStyle);
 
         // Scaled touch slop for this context.
         mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
     }
--- a/mobile/android/base/home/TopBookmarksView.java
+++ b/mobile/android/base/home/TopBookmarksView.java
@@ -37,17 +37,20 @@ public class TopBookmarksView extends Gr
     }
 
     // Max number of bookmarks that needs to be shown.
     private final int mMaxBookmarks;
 
     // Number of columns to show.
     private final int mNumColumns;
 
-    // Vertical spacing inbetween the rows.
+    // Horizontal spacing in between the rows.
+    private final int mHorizontalSpacing;
+
+    // Vertical spacing in between the rows.
     private final int mVerticalSpacing;
 
     // On URL open listener.
     private OnUrlOpenListener mUrlOpenListener;
 
     // Pin bookmark listener.
     private OnPinBookmarkListener mPinBookmarkListener;
 
@@ -64,16 +67,17 @@ public class TopBookmarksView extends Gr
 
     public TopBookmarksView(Context context, AttributeSet attrs, int defStyle) {
         super(context, attrs, defStyle);
         mMaxBookmarks = getResources().getInteger(R.integer.number_of_top_sites);
         mNumColumns = getResources().getInteger(R.integer.number_of_top_sites_cols);
         setNumColumns(mNumColumns);
 
         TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TopBookmarksView, defStyle, 0);
+        mHorizontalSpacing = a.getDimensionPixelOffset(R.styleable.TopBookmarksView_android_horizontalSpacing, 0x00);
         mVerticalSpacing = a.getDimensionPixelOffset(R.styleable.TopBookmarksView_android_verticalSpacing, 0x00);
         a.recycle();
     }
 
     /**
      * {@inheritDoc}
      */
     @Override
@@ -123,17 +127,18 @@ public class TopBookmarksView extends Gr
 
     /**
      * {@inheritDoc}
      */
     @Override
     public int getColumnWidth() {
         // This method will be called from onMeasure() too.
         // It's better to use getMeasuredWidth(), as it is safe in this case.
-        return (getMeasuredWidth() - getPaddingLeft() - getPaddingRight()) / mNumColumns;
+        final int totalHorizontalSpacing = mNumColumns > 0 ? (mNumColumns - 1) * mHorizontalSpacing : 0;
+        return (getMeasuredWidth() - getPaddingLeft() - getPaddingRight() - totalHorizontalSpacing) / mNumColumns;
     }
 
     /**
      * {@inheritDoc}
      */
     @Override
     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
         // Sets the padding for this view.
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/layout/bookmark_item_row.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<org.mozilla.gecko.home.TwoLinePageRow xmlns:android="http://schemas.android.com/apk/res/android"
+                                       style="@style/Widget.BookmarkItemView"
+                                       android:layout_width="fill_parent"
+                                       android:layout_height="@dimen/page_row_height"
+                                       android:minHeight="@dimen/page_row_height"/>
--- a/mobile/android/base/resources/values-large-land-v11/styles.xml
+++ b/mobile/android/base/resources/values-large-land-v11/styles.xml
@@ -4,9 +4,35 @@
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <resources>
 
     <style name="TabsList" parent="TabsListBase">
          <item name="android:orientation">vertical</item>
     </style>
 
+    <style name="Widget.BookmarkFolderView" parent="Widget.TwoLinePageRow.Title">
+        <item name="android:paddingLeft">60dip</item>
+        <item name="android:drawablePadding">10dip</item>
+        <item name="android:drawableLeft">@drawable/bookmark_folder</item>
+    </style>
+
+    <style name="Widget.BookmarkItemView" parent="Widget.TwoLinePageRow">
+        <item name="android:paddingLeft">50dp</item>
+        <item name="android:paddingRight">50dp</item>
+    </style>
+
+    <style name="Widget.BookmarksListView" parent="Widget.HomeListView">
+        <item name="android:paddingLeft">120dp</item>
+        <item name="android:paddingRight">120dp</item>
+        <item name="android:scrollbarStyle">outsideOverlay</item>
+    </style>
+
+    <style name="Widget.TopBookmarksView" parent="Widget.GridView">
+        <item name="android:paddingLeft">55dp</item>
+        <item name="android:paddingRight">55dp</item>
+        <item name="android:paddingTop">30dp</item>
+        <item name="android:paddingBottom">30dp</item>
+        <item name="android:horizontalSpacing">20dp</item>
+        <item name="android:verticalSpacing">20dp</item>
+    </style>
+
 </resources>
--- a/mobile/android/base/resources/values-large-v11/styles.xml
+++ b/mobile/android/base/resources/values-large-v11/styles.xml
@@ -35,9 +35,24 @@
     <style name="TabsItem">
          <item name="android:nextFocusDown">@+id/close</item>
     </style>
 
     <style name="TabsItemClose">
          <item name="android:nextFocusUp">@+id/info</item>
     </style>
 
+    <style name="Widget.BookmarksListView" parent="Widget.HomeListView">
+        <item name="android:paddingLeft">32dp</item>
+        <item name="android:paddingRight">32dp</item>
+        <item name="android:scrollbarStyle">outsideOverlay</item>
+    </style>
+
+    <style name="Widget.TopBookmarksView" parent="Widget.GridView">
+        <item name="android:paddingLeft">5dp</item>
+        <item name="android:paddingRight">5dp</item>
+        <item name="android:paddingTop">30dp</item>
+        <item name="android:paddingBottom">30dp</item>
+        <item name="android:horizontalSpacing">10dp</item>
+        <item name="android:verticalSpacing">10dp</item>
+    </style>
+
 </resources>
--- a/mobile/android/base/resources/values-v11/themes.xml
+++ b/mobile/android/base/resources/values-v11/themes.xml
@@ -37,15 +37,16 @@
         <item name="android:listViewStyle">@style/Widget.ListView</item>
         <item name="android:gridViewStyle">@style/Widget.GridView</item>
         <item name="android:spinnerStyle">@style/Widget.Spinner</item>
         <item name="android:spinnerItemStyle">@style/Widget.TextView.SpinnerItem</item>
         <item name="android:spinnerDropDownItemStyle">@style/Widget.DropDownItem.Spinner</item>
         <item name="menuItemActionBarStyle">@style/Widget.MenuItemActionBar</item>
         <item name="menuItemActionViewStyle">@style/Widget.MenuItemActionView</item>
         <item name="menuItemDefaultStyle">@style/Widget.MenuItemDefault</item>
+        <item name="bookmarksListViewStyle">@style/Widget.BookmarksListView</item>
         <item name="bookmarkThumbnailViewStyle">@style/Widget.BookmarkThumbnailView</item>
         <item name="topBookmarkItemViewStyle">@style/Widget.TopBookmarkItemView</item>
         <item name="topBookmarksViewStyle">@style/Widget.TopBookmarksView</item>
         <item name="homeListViewStyle">@style/Widget.HomeListView</item>
     </style>
 
 </resources>
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/values-xlarge-land-v11/styles.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<resources>
+
+    <style name="Widget.TopBookmarksView" parent="Widget.GridView">
+        <item name="android:paddingLeft">55dp</item>
+        <item name="android:paddingRight">55dp</item>
+        <item name="android:paddingTop">30dp</item>
+        <item name="android:paddingBottom">30dp</item>
+        <item name="android:horizontalSpacing">56dp</item>
+        <item name="android:verticalSpacing">20dp</item>
+    </style>
+
+</resources>
--- a/mobile/android/base/resources/values/attrs.xml
+++ b/mobile/android/base/resources/values/attrs.xml
@@ -12,16 +12,19 @@
         <attr name="menuItemActionBarStyle" format="reference"/>
 
         <!-- Style for MenuItemActionView -->
         <attr name="menuItemActionViewStyle" format="reference"/>
 
         <!-- Style for MenuItemDefault -->
         <attr name="menuItemDefaultStyle" format="reference"/>
 
+        <!-- Default style for the BookmarksListView -->
+        <attr name="bookmarksListViewStyle" format="reference" />
+
         <!-- Default style for the BookmarkThumbnailView -->
         <attr name="bookmarkThumbnailViewStyle" format="reference" />
 
         <!-- Default style for the TopBookmarkItemView -->
         <attr name="topBookmarkItemViewStyle" format="reference" />
 
         <!-- Default style for the TopBookmarksView -->
         <attr name="topBookmarksViewStyle" format="reference" />
@@ -193,13 +196,14 @@
         <attr name="url" format="string"/>
     </declare-styleable>
 
     <declare-styleable name="IconTabWidget">
         <attr name="android:layout"/>
     </declare-styleable>
 
     <declare-styleable name="TopBookmarksView">
+        <attr name="android:horizontalSpacing"/>
         <attr name="android:verticalSpacing"/>
     </declare-styleable>
 
 </resources>
 
--- a/mobile/android/base/resources/values/styles.xml
+++ b/mobile/android/base/resources/values/styles.xml
@@ -114,26 +114,31 @@
     <style name="Widget.BookmarkFolderView" parent="Widget.TwoLinePageRow.Title">
         <item name="android:paddingLeft">10dip</item>
         <item name="android:drawablePadding">10dip</item>
         <item name="android:drawableLeft">@drawable/bookmark_folder</item>
     </style>
 
     <style name="Widget.TopBookmarksView" parent="Widget.GridView">
         <item name="android:padding">7dp</item>
+        <item name="android:horizontalSpacing">0dp</item>
         <item name="android:verticalSpacing">7dp</item>
     </style>
 
     <style name="Widget.TopBookmarkItemView">
       <item name="android:layout_width">fill_parent</item>
       <item name="android:layout_height">fill_parent</item>
       <item name="android:padding">5dip</item>
       <item name="android:orientation">vertical</item>
     </style>
 
+    <style name="Widget.BookmarkItemView" parent="Widget.TwoLinePageRow"/>
+
+    <style name="Widget.BookmarksListView" parent="Widget.HomeListView"/>
+
     <style name="Widget.BookmarkThumbnailView">
       <item name="android:padding">0dip</item>
       <item name="android:scaleType">centerCrop</item>
     </style>
 
     <style name="Widget.TopBookmarkItemPin">
       <item name="android:minWidth">30dip</item>
       <item name="android:minHeight">30dip</item>
--- a/mobile/android/base/resources/values/themes.xml
+++ b/mobile/android/base/resources/values/themes.xml
@@ -72,16 +72,17 @@
     <style name="Gecko.App">
         <item name="android:windowBackground">@android:color/white</item>
         <item name="android:buttonStyle">@style/Widget.Button</item>
         <item name="android:dropDownItemStyle">@style/Widget.DropDownItem</item>
         <item name="android:editTextStyle">@style/Widget.EditText</item>
         <item name="android:gridViewStyle">@style/Widget.GridView</item>
         <item name="android:textViewStyle">@style/Widget.TextView</item>
         <item name="android:spinnerStyle">@style/Widget.Spinner</item>
+        <item name="bookmarksListViewStyle">@style/Widget.BookmarksListView</item>
         <item name="bookmarkThumbnailViewStyle">@style/Widget.BookmarkThumbnailView</item>
         <item name="topBookmarkItemViewStyle">@style/Widget.TopBookmarkItemView</item>
         <item name="topBookmarksViewStyle">@style/Widget.TopBookmarksView</item>
         <item name="homeListViewStyle">@style/Widget.HomeListView</item>
     </style>
 
     <style name="Gecko.Preferences" parent="GeckoPreferencesBase"/>