Backout bug 686528, bug 780367, and bug 780481 due to bustage. a=bustage
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 13 Aug 2012 22:04:21 -0400
changeset 100495 09e2ae3132295ef8efcaec9f10b1f3d1d3e6382b
parent 100494 2de209a396f29e0fd7fe152e2f4367fcc7b88936
child 100496 7b5be4d31c684170b4a7d5596646feb806b85590
push id1271
push userryanvm@gmail.com
push dateTue, 14 Aug 2012 02:04:30 +0000
treeherdermozilla-beta@09e2ae313229 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage
bugs686528, 780367, 780481
milestone15.0
Backout bug 686528, bug 780367, and bug 780481 due to bustage. a=bustage
mobile/android/base/AboutHomeContent.java
mobile/android/base/BrowserApp.java
mobile/android/base/Makefile.in
mobile/android/base/resources/layout-xlarge-land-v11/abouthome_content.xml.in
mobile/android/base/resources/layout/abouthome_content.xml.in
mobile/android/base/resources/values-land/integers.xml
mobile/android/base/resources/values-xlarge-v11/dimens.xml
mobile/android/base/resources/values-xlarge-v11/integers.xml
mobile/android/base/resources/values/dimens.xml
mobile/android/base/resources/values/integers.xml
--- a/mobile/android/base/AboutHomeContent.java
+++ b/mobile/android/base/AboutHomeContent.java
@@ -48,32 +48,34 @@ import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
 import android.view.View;
 import android.widget.AdapterView;
 import android.widget.ArrayAdapter;
 import android.widget.FrameLayout;
 import android.widget.GridView;
 import android.widget.ImageView;
-import android.widget.LinearLayout;
 import android.widget.ListView;
 import android.widget.RelativeLayout;
 import android.widget.ScrollView;
 import android.widget.SimpleCursorAdapter;
 import android.widget.TextView;
 import android.text.TextUtils;
 
 public class AboutHomeContent extends ScrollView
        implements TabsAccessor.OnQueryTabsCompleteListener {
     private static final String LOGTAG = "GeckoAboutHome";
 
-    private static final int NUMBER_OF_REMOTE_TABS = 5;
+    private static final int NUMBER_OF_TOP_SITES_PORTRAIT = 4;
+    private static final int NUMBER_OF_TOP_SITES_LANDSCAPE = 3;
 
-    private static int mNumberOfTopSites;
-    private static int mNumberOfCols;
+    private static final int NUMBER_OF_COLS_PORTRAIT = 2;
+    private static final int NUMBER_OF_COLS_LANDSCAPE = 3;
+
+    private static final int NUMBER_OF_REMOTE_TABS = 5;
 
     static enum UpdateFlags {
         TOP_SITES,
         PREVIOUS_TABS,
         RECOMMENDED_ADDONS,
         REMOTE_TABS;
 
         public static final EnumSet<UpdateFlags> ALL = EnumSet.allOf(UpdateFlags.class);
@@ -105,17 +107,18 @@ public class AboutHomeContent extends Sc
     }
 
     public AboutHomeContent(Context context, AttributeSet attrs) {
         super(context, attrs);
     }
 
     public void init() {
         final Context context = getContext();
-        inflate();
+        mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+        mInflater.inflate(R.layout.abouthome_content, this);
 
         mAccountManager = AccountManager.get(context);
 
         // The listener will run on the background thread (see 2nd argument)
         mAccountManager.addOnAccountsUpdatedListener(mAccountListener = new OnAccountsUpdateListener() {
             public void onAccountsUpdated(Account[] accounts) {
                 final GeckoApp.StartupMode startupMode = GeckoApp.mAppContext.getStartupMode();
                 final boolean syncIsSetup = SyncAccounts.syncAccountsExist(context);
@@ -127,39 +130,16 @@ public class AboutHomeContent extends Sc
                         // to happen.
                         if (mTopSitesAdapter != null)
                             updateLayout(startupMode, syncIsSetup);
                     }
                 });
             }
         }, GeckoAppShell.getHandler(), false);
 
-        mRemoteTabClickListener = new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                String url = ((String) v.getTag());
-                JSONObject args = new JSONObject();
-                try {
-                    args.put("url", url);
-                    args.put("engine", null);
-                    args.put("userEntered", false);
-                } catch (Exception e) {
-                    Log.e(LOGTAG, "error building JSON arguments");
-                }
-    
-                Log.d(LOGTAG, "Sending message to Gecko: " + SystemClock.uptimeMillis() + " - Tab:Add");
-                GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Tab:Add", args.toString()));
-            }
-        };
-    }
-
-    private void inflate() {
-        mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-        mInflater.inflate(R.layout.abouthome_content, this);
-
         mTopSitesGrid = (GridView)findViewById(R.id.top_sites_grid);
         mTopSitesGrid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
             public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
                 Cursor c = (Cursor) parent.getItemAtPosition(position);
 
                 String spec = c.getString(c.getColumnIndex(URLColumns.URL));
                 Log.i(LOGTAG, "clicked: " + spec);
 
@@ -200,26 +180,42 @@ public class AboutHomeContent extends Sc
         // Highlight any occurrence of "Firefox Sync" in the string
         // with a bold style.
         if (styleIndex >= 0) {
             SpannableString spannableText = new SpannableString(syncText);
             spannableText.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), styleIndex, styleIndex + 12, 0);
             syncTextView.setText(spannableText, TextView.BufferType.SPANNABLE);
         }
 
-        LinearLayout syncBox = (LinearLayout) findViewById(R.id.sync_box);
+        RelativeLayout syncBox = (RelativeLayout) findViewById(R.id.sync_box);
         syncBox.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
                 Context context = v.getContext();
                 Intent intent = new Intent(context, SetupSyncActivity.class);
                 context.startActivity(intent);
             }
         });
 
-        setTopSitesConstants();
+        mRemoteTabClickListener = new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                String url = ((String) v.getTag());
+                JSONObject args = new JSONObject();
+                try {
+                    args.put("url", url);
+                    args.put("engine", null);
+                    args.put("userEntered", false);
+                } catch (Exception e) {
+                    Log.e(LOGTAG, "error building JSON arguments");
+                }
+    
+                Log.d(LOGTAG, "Sending message to Gecko: " + SystemClock.uptimeMillis() + " - Tab:Add");
+                GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Tab:Add", args.toString()));
+            }
+        };
     }
 
     public void onDestroy() {
         if (mAccountListener != null) {
             mAccountManager.removeOnAccountsUpdatedListener(mAccountListener);
             mAccountListener = null;
         }
 
@@ -242,45 +238,74 @@ public class AboutHomeContent extends Sc
         findViewById(R.id.top_sites_grid).setVisibility(visibilityWithTopSites);
         findViewById(R.id.top_sites_title).setVisibility(visibility);
         findViewById(R.id.all_top_sites_text).setVisibility(visibilityWithTopSites);
         findViewById(R.id.no_top_sites_text).setVisibility(visibilityWithoutTopSites);
     }
 
     private void setSyncVisibility(boolean visible) {
         int visibility = visible ? View.VISIBLE : View.GONE;
-        findViewById(R.id.sync_box).setVisibility(visibility);
+        findViewById(R.id.sync_box_container).setVisibility(visibility);
+    }
+
+    private void updateSyncLayout(boolean isFirstRun, boolean hasTopSites) {
+        RelativeLayout syncContainer = (RelativeLayout) findViewById(R.id.sync_box_container);
+        RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) syncContainer.getLayoutParams();
+
+        int below = R.id.all_top_sites_text;
+        if (isFirstRun && !hasTopSites)
+            below = R.id.top_sites_top;
+        else if (!hasTopSites)
+            below = R.id.no_top_sites_text;
+
+        int background = R.drawable.abouthome_bg_repeat;
+        if (isFirstRun && !hasTopSites)
+            background = 0;
+
+        params.addRule(RelativeLayout.BELOW, below);
+        syncContainer.setLayoutParams(params);
+
+        syncContainer.setBackgroundResource(background);
     }
 
     private void updateLayout(GeckoApp.StartupMode startupMode, boolean syncIsSetup) {
         // The idea here is that we only show the sync invitation
         // on the very first run. Show sync banner below the top
         // sites section in all other cases.
 
         boolean hasTopSites = mTopSitesAdapter.getCount() > 0;
         boolean isFirstRun = (startupMode == GeckoApp.StartupMode.NEW_PROFILE);
 
         setTopSitesVisibility(!isFirstRun || hasTopSites, hasTopSites);
         setSyncVisibility(!syncIsSetup);
+        updateSyncLayout(isFirstRun, hasTopSites);
+    }
+
+    private int getNumberOfTopSites() {
+        Configuration config = getContext().getResources().getConfiguration();
+        if (config.orientation == Configuration.ORIENTATION_LANDSCAPE)
+            return NUMBER_OF_TOP_SITES_LANDSCAPE;
+        else
+            return NUMBER_OF_TOP_SITES_PORTRAIT;
     }
 
     private void loadTopSites(final Activity activity) {
         // Ensure we initialize GeckoApp's startup mode in
         // background thread before we use it when updating
         // the top sites section layout in main thread.
         final GeckoApp.StartupMode startupMode = GeckoApp.mAppContext.getStartupMode();
 
         // The SyncAccounts.syncAccountsExist method should not be called on
         // UI thread as it touches disk to access a sqlite DB.
         final boolean syncIsSetup = SyncAccounts.syncAccountsExist(activity);
 
         final ContentResolver resolver = GeckoApp.mAppContext.getContentResolver();
         final Cursor oldCursor = mCursor;
         // Swap in the new cursor.
-        mCursor = BrowserDB.getTopSites(resolver, mNumberOfTopSites);
+        mCursor = BrowserDB.getTopSites(resolver, NUMBER_OF_TOP_SITES_PORTRAIT);;
 
         GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
             public void run() {
                 if (mTopSitesAdapter == null) {
                     mTopSitesAdapter = new TopSitesCursorAdapter(activity,
                                                                  R.layout.abouthome_topsite_item,
                                                                  mCursor,
                                                                  new String[] { URLColumns.TITLE,
@@ -323,32 +348,22 @@ public class AboutHomeContent extends Sc
     public void setUriLoadCallback(UriLoadCallback uriLoadCallback) {
         mUriLoadCallback = uriLoadCallback;
     }
 
     public void onActivityContentChanged(Activity activity) {
         update(activity, EnumSet.of(UpdateFlags.TOP_SITES));
     }
 
-    private void setTopSitesConstants() {
-        mNumberOfTopSites = getResources().getInteger(R.integer.number_of_top_sites);
-        mNumberOfCols = getResources().getInteger(R.integer.number_of_top_sites_cols);
-    }
-
-    /**
-     * Reinflates and updates all components of this view.
-     */
-    public void refresh() {
+    @Override
+    public void onConfigurationChanged(Configuration newConfig) {
         if (mTopSitesAdapter != null)
             mTopSitesAdapter.notifyDataSetChanged();
 
-        removeAllViews(); // We must remove the currently inflated view to allow for reinflation.
-        inflate();
-        mTopSitesGrid.setAdapter(mTopSitesAdapter); // mTopSitesGrid is a new instance (from loadTopSites()).
-        update(AboutHomeContent.UpdateFlags.ALL); // Refresh all elements.
+        super.onConfigurationChanged(newConfig);
     }
 
     @Override
     public boolean onInterceptTouchEvent(MotionEvent event) {
         if (mOnInterceptTouchListener != null && mOnInterceptTouchListener.onInterceptTouchEvent(this, event))
             return true;
         return super.onInterceptTouchEvent(event);
     }
@@ -627,54 +642,74 @@ public class AboutHomeContent extends Sc
             row.setOnClickListener(mRemoteTabClickListener);
         }
         
         mRemoteTabs.setSubtitle(client);
         mRemoteTabs.show();
     }
 
     public static class TopSitesGridView extends GridView {
+        /** From layout xml:
+         *  80dip image height 
+         * + 2dip image paddingTop
+         * + 1dip image padding (for bottom)
+         * + 3dip marginTop on the TextView
+         * +15dip TextView height
+         * + 8dip vertical spacing in the GridView
+         * ------
+         * 109dip total height per top site grid item
+         */
+        private static final int kTopSiteItemHeight = 109;
+        float mDisplayDensity ;
+
         public TopSitesGridView(Context context, AttributeSet attrs) {
             super(context, attrs);
+            mDisplayDensity = GeckoApp.mAppContext.getDisplayMetrics().density;
         }
 
         @Override
         protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
             int numRows;
 
             SimpleCursorAdapter adapter = (SimpleCursorAdapter) getAdapter();
             int nSites = Integer.MAX_VALUE;
 
             if (adapter != null) {
                 Cursor c = adapter.getCursor();
                 if (c != null)
                     nSites = c.getCount();
             }
 
-            nSites = Math.min(nSites, mNumberOfTopSites);
-            numRows = (int) Math.round((double) nSites / mNumberOfCols);
-            setNumColumns(mNumberOfCols);
-
-            int expandedHeightSpec = MeasureSpec.makeMeasureSpec(numRows * getResources().
-                    getDimensionPixelSize(R.dimen.abouthome_content_top_sites_item_height),
-                    MeasureSpec.EXACTLY);
+            Configuration config = getContext().getResources().getConfiguration();
+            if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
+                nSites = Math.min(nSites, NUMBER_OF_TOP_SITES_LANDSCAPE);
+                numRows = (int) Math.round((double) nSites / NUMBER_OF_COLS_LANDSCAPE);
+                setNumColumns(NUMBER_OF_COLS_LANDSCAPE);
+            } else {
+                nSites = Math.min(nSites, NUMBER_OF_TOP_SITES_PORTRAIT);
+                numRows = (int) Math.round((double) nSites / NUMBER_OF_COLS_PORTRAIT);
+                setNumColumns(NUMBER_OF_COLS_PORTRAIT);
+            }
+            int expandedHeightSpec = 
+                MeasureSpec.makeMeasureSpec((int)(mDisplayDensity * numRows * kTopSiteItemHeight),
+                                            MeasureSpec.EXACTLY);
 
             super.onMeasure(widthMeasureSpec, expandedHeightSpec);
         }
     }
 
     public class TopSitesCursorAdapter extends SimpleCursorAdapter {
         public TopSitesCursorAdapter(Context context, int layout, Cursor c,
                                      String[] from, int[] to) {
             super(context, layout, c, from, to);
         }
 
         @Override
         public int getCount() {
-            return Math.min(super.getCount(), mNumberOfTopSites);
+            return Math.min(super.getCount(), getNumberOfTopSites());
         }
 
         @Override
         protected void onContentChanged () {
             // Don't do anything. We don't want to regenerate every time
             // our history database is updated.
             return;
         }
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -293,19 +293,16 @@ abstract public class BrowserApp extends
             LinearLayout actionBar = (LinearLayout) getBrowserToolbar();
             mMainLayout.addView(actionBar, index);
             mBrowserToolbar.from(actionBar);
             mBrowserToolbar.refresh();
         }
 
         invalidateOptionsMenu();
         mTabsPanel.refresh();
-
-        if (mAboutHomeContent != null)
-            mAboutHomeContent.refresh();
     }
 
     @Override
     public boolean isBrowserToolbarSupported() {
         return true;
     }
 
     @Override
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -163,17 +163,16 @@ FENNEC_PP_JAVA_FILES = \
   db/FormHistoryProvider.java \
   db/TabsProvider.java \
   db/GeckoProvider.java \
   SmsManager.java \
   $(NULL)
 
 FENNEC_PP_XML_FILES = \
   res/layout/abouthome_content.xml \
-  res/layout-xlarge-land-v11/abouthome_content.xml \
   res/layout/gecko_app.xml \
   res/layout/text_selection_handles.xml \
   res/layout-xlarge-v11/gecko_app.xml \
   res/xml/preferences.xml \
   res/menu/gecko_menu.xml \
   res/menu-v11/titlebar_contextmenu.xml \
   res/menu-v11/gecko_menu.xml \
   res/menu-large-v11/gecko_menu.xml \
@@ -325,38 +324,32 @@ RES_LAYOUT_XLARGE_V11 = \
   $(NULL)
 
 RES_VALUES = \
   $(SYNC_RES_VALUES) \
   res/values/attrs.xml \
   res/values/arrays.xml \
   res/values/colors.xml \
   res/values/dimens.xml \
-  res/values/integers.xml \
   res/values/styles.xml \
   res/values/themes.xml \
   $(NULL)
 
-RES_VALUES_LAND = \
-  res/values-land/integers.xml \
-  $(NULL)
-
 RES_VALUES_V11 = \
   res/values-v11/dimens.xml \
   res/values-v11/styles.xml \
   res/values-v11/themes.xml \
   $(NULL)
 
 RES_VALUES_LARGE_V11 = \
   res/values-large-v11/dimens.xml \
   $(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_LAND_V14 = \
   res/values-land-v14/dimens.xml \
   $(NULL)
 
 RES_XML = \
@@ -944,44 +937,43 @@ MOZ_ANDROID_DRAWABLES += \
   mobile/android/base/resources/drawable/tabs_tray_default_selector.xml         \
   mobile/android/base/resources/drawable/tabs_tray_list_divider.xml             \
   mobile/android/base/resources/drawable/tabs_shadow.xml                        \
   mobile/android/base/resources/drawable/shadow.png                             \
   $(NULL)
 
 MOZ_ANDROID_DRAWABLES += $(shell if test -e $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/android-resources.mn; then cat $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/android-resources.mn | tr '\n' ' ';  fi)
 
-RESOURCES=$(RES_LAYOUT) $(RES_LAYOUT_LAND_V14) $(RES_LAYOUT_LARGE_V11) $(RES_LAYOUT_XLARGE_V11) $(RES_VALUES) $(RES_VALUES_LAND) $(RES_VALUES_V11) $(RES_VALUES_LARGE_V11) $(RES_VALUES_XLARGE_V11) $(RES_VALUES_LAND_V14) $(RES_XML) $(RES_ANIM) $(RES_DRAWABLE_NODPI) $(RES_DRAWABLE_BASE) $(RES_DRAWABLE_LDPI) $(RES_DRAWABLE_HDPI) $(RES_DRAWABLE_XHDPI) $(RES_DRAWABLE_MDPI_V11) $(RES_DRAWABLE_HDPI_V11) $(RES_DRAWABLE_XHDPI_V11) $(RES_DRAWABLE_LAND_V14) $(RES_DRAWABLE_LAND_MDPI_V14) $(RES_DRAWABLE_LAND_HDPI_V14) $(RES_DRAWABLE_LAND_XHDPI_V14) $(RES_DRAWABLE_LARGE_MDPI_V11) $(RES_DRAWABLE_LARGE_HDPI_V11) $(RES_DRAWABLE_LARGE_XHDPI_V11) $(RES_DRAWABLE_XLARGE_MDPI_V11) $(RES_DRAWABLE_XLARGE_HDPI_V11) $(RES_DRAWABLE_XLARGE_XHDPI_V11) $(RES_COLOR) $(RES_MENU)
+RESOURCES=$(RES_LAYOUT) $(RES_LAYOUT_LAND_V14) $(RES_LAYOUT_LARGE_V11) $(RES_LAYOUT_XLARGE_V11) $(RES_VALUES) $(RES_VALUES_V11) $(RES_VALUES_LARGE_V11) $(RES_VALUES_XLARGE_V11) $(RES_VALUES_LAND_V14) $(RES_XML) $(RES_ANIM) $(RES_DRAWABLE_NODPI) $(RES_DRAWABLE_BASE) $(RES_DRAWABLE_LDPI) $(RES_DRAWABLE_HDPI) $(RES_DRAWABLE_XHDPI) $(RES_DRAWABLE_MDPI_V11) $(RES_DRAWABLE_HDPI_V11) $(RES_DRAWABLE_XHDPI_V11) $(RES_DRAWABLE_LAND_V14) $(RES_DRAWABLE_LAND_MDPI_V14) $(RES_DRAWABLE_LAND_HDPI_V14) $(RES_DRAWABLE_LAND_XHDPI_V14) $(RES_DRAWABLE_LARGE_MDPI_V11) $(RES_DRAWABLE_LARGE_HDPI_V11) $(RES_DRAWABLE_LARGE_XHDPI_V11) $(RES_DRAWABLE_XLARGE_MDPI_V11) $(RES_DRAWABLE_XLARGE_HDPI_V11) $(RES_DRAWABLE_XLARGE_XHDPI_V11) $(RES_COLOR) $(RES_MENU)
 
 RES_DIRS= \
-  res/layout                    \
-  res/layout-land-v14           \
-  res/layout-large-v11          \
-  res/layout-xlarge-v11         \
-  res/layout-xlarge-land-v11    \
-  res/values                    \
-  res/values-v11                \
-  res/values-large-v11          \
-  res/values-xlarge-v11         \
-  res/values-land-v14           \
-  res/xml                       \
-  res/anim                      \
-  res/drawable-nodpi            \
-  res/drawable-ldpi             \
-  res/drawable-mdpi             \
-  res/drawable-hdpi             \
-  res/drawable-xhdpi            \
-  res/drawable                  \
-  res/drawable-mdpi-v11         \
-  res/drawable-hdpi-v11         \
-  res/drawable-xhdpi-v11        \
-  res/drawable-land-v14         \
-  res/drawable-land-mdpi-v14    \
-  res/drawable-land-hdpi-v14    \
-  res/drawable-land-xhdpi-v14   \
+  res/layout              \
+  res/layout-land-v14     \
+  res/layout-large-v11    \
+  res/layout-xlarge-v11   \
+  res/values              \
+  res/values-v11          \
+  res/values-large-v11    \
+  res/values-xlarge-v11   \
+  res/values-land-v14     \
+  res/xml                 \
+  res/anim                \
+  res/drawable-nodpi      \
+  res/drawable-ldpi       \
+  res/drawable-mdpi       \
+  res/drawable-hdpi       \
+  res/drawable-xhdpi      \
+  res/drawable            \
+  res/drawable-mdpi-v11   \
+  res/drawable-hdpi-v11   \
+  res/drawable-xhdpi-v11  \
+  res/drawable-land-v14   \
+  res/drawable-land-mdpi-v14  \
+  res/drawable-land-hdpi-v14  \
+  res/drawable-land-xhdpi-v14 \
   res/drawable-large-mdpi-v11   \
   res/drawable-large-hdpi-v11   \
   res/drawable-large-xhdpi-v11  \
   res/drawable-xlarge-mdpi-v11  \
   res/drawable-xlarge-hdpi-v11  \
   res/drawable-xlarge-xhdpi-v11 \
   res/color                     \
   res/menu                      \
deleted file mode 100644
--- a/mobile/android/base/resources/layout-xlarge-land-v11/abouthome_content.xml.in
+++ /dev/null
@@ -1,154 +0,0 @@
-#filter substitution
-<?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/. -->
-
-<merge xmlns:android="http://schemas.android.com/apk/res/android"
-       xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@">
-
-    <LinearLayout android:orientation="horizontal"
-                  android:layout_width="fill_parent"
-                  android:layout_height="fill_parent">
-
-        <LinearLayout android:orientation="vertical"
-                      android:layout_width="0dp"
-                      android:layout_height="fill_parent"
-                      android:layout_weight="0.6"
-                      android:layout_marginLeft="@dimen/abouthome_gutter_large"
-                      android:layout_marginRight="@dimen/abouthome_gutter_small">
-
-            <ImageView android:src="@drawable/abouthome_logo"
-                       android:layout_width="wrap_content"
-                       android:layout_height="24dip"
-                       android:layout_marginTop="16dip"
-                       android:layout_marginBottom="10dip"
-                       android:layout_marginLeft="12dip"/>
-
-            <TextView android:id="@+id/top_sites_title"
-                      android:text="@string/abouthome_top_sites_title"
-                      android:layout_width="fill_parent"
-                      android:layout_height="26dip"
-                      android:background="#34FFFFFF"
-                      android:paddingLeft="12dip"
-                      android:textSize="12sp"
-                      android:textColor="#000000"
-                      android:textStyle="bold"
-                      android:gravity="left|center_vertical"/>
-
-            <TextView android:id="@+id/no_top_sites_text"
-                      android:text="@string/abouthome_no_top_sites"
-                      android:layout_width="fill_parent"
-                      android:layout_height="wrap_content"
-                      android:paddingTop="47dp"
-                      android:paddingBottom="47dp"
-                      android:paddingLeft="60dp"
-                      android:paddingRight="60dp"
-                      android:gravity="center"
-                      android:textSize="12sp"
-                      android:textColor="#666666"
-                      android:visibility="gone"/>
-
-            <view class="org.mozilla.gecko.AboutHomeContent$TopSitesGridView"
-                  android:id="@+id/top_sites_grid"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:layout_marginTop="12dp"
-                  android:verticalSpacing="8dip"
-                  android:horizontalSpacing="0dip"
-                  android:isScrollContainer="false"
-                  android:gravity="center"
-                  android:listSelector="@drawable/action_bar_button"/>
-
-            <org.mozilla.gecko.LinkTextView android:id="@+id/all_top_sites_text"
-                                            android:text="@string/abouthome_top_sites_browse"
-                                            android:layout_width="fill_parent"
-                                            android:layout_height="30dip"
-                                            android:layout_marginTop="7dip"
-                                            android:textColor="#22629e"
-                                            android:textSize="12sp"
-                                            android:gravity="top|center_horizontal"/>
-
-                <LinearLayout android:id="@+id/sync_box"
-                              android:background="@drawable/abouthome_sync_box"
-                              android:orientation="horizontal"
-                              android:layout_width="fill_parent"
-                              android:layout_height="wrap_content"
-                              android:layout_marginLeft="12dp"
-                              android:layout_marginRight="12dp"
-                              android:layout_marginTop="17dp"
-                              android:layout_marginBottom="14dp"
-                              android:gravity="center"
-                              android:clickable="true"
-                              android:visibility="gone">
-
-                    <ImageView android:id="@+id/sync_logo"
-                               android:src="@drawable/abouthome_sync_logo"
-                               android:layout_width="wrap_content"
-                               android:layout_height="wrap_content"
-                               android:layout_weight="0"
-                               android:gravity="left|center_vertical"/>
-
-                    <TextView android:id="@+id/sync_text"
-                              android:text="@string/abouthome_about_sync"
-                              android:layout_width="0dp"
-                              android:layout_height="wrap_content"
-                              android:layout_weight="1"
-                              android:layout_marginLeft="7dp"
-                              android:gravity="center"
-                              android:textSize="15sp"
-                              android:textColor="#FFFFFF"/>
-
-                </LinearLayout>
-
-        </LinearLayout>
-
-        <RelativeLayout android:layout_width="0dp"
-                        android:layout_height="fill_parent"
-                        android:layout_weight="0.4"
-                        android:layout_marginLeft="@dimen/abouthome_gutter_small"
-                        android:layout_marginRight="@dimen/abouthome_gutter_large">
-
-            <ImageView android:src="@drawable/abouthome_icon"
-                       android:layout_width="wrap_content"
-                       android:layout_height="wrap_content"
-                       android:layout_marginTop="4dp"
-                       android:layout_alignParentTop="true"
-                       android:layout_alignParentRight="true"/>
-
-            <!-- marginTop is abouthome_logo height & vertical margins: 24dip + 16dip + 10dip = 50dip -->
-            <LinearLayout android:orientation="vertical"
-                          android:layout_width="fill_parent"
-                          android:layout_height="fill_parent"
-                          android:layout_alignParentTop="true"
-                          android:layout_alignParentLeft="true"
-                          android:layout_marginTop="50dip">
-
-                <org.mozilla.gecko.AboutHomeSection android:id="@+id/last_tabs"
-                                                    android:layout_width="fill_parent"
-                                                    android:layout_height="wrap_content"
-                                                    android:visibility="gone"
-                                                    gecko:title="@string/abouthome_last_tabs_title"
-                                                    gecko:more_text="@string/abouthome_last_tabs_open"/>
-
-                <org.mozilla.gecko.AboutHomeSection android:id="@+id/recommended_addons"
-                                                    android:layout_width="fill_parent"
-                                                    android:layout_height="wrap_content"
-                                                    android:visibility="gone"
-                                                    gecko:title="@string/abouthome_addons_title"
-                                                    gecko:more_text="@string/abouthome_addons_browse"/>
-
-                <org.mozilla.gecko.AboutHomeSection android:id="@+id/remote_tabs"
-                                                    android:layout_width="fill_parent"
-                                                    android:layout_height="wrap_content"
-                                                    android:visibility="gone"
-                                                    gecko:title="@string/remote_tabs"
-                                                    gecko:more_text="@string/remote_tabs_show_all"/>
-
-            </LinearLayout>
-
-        </RelativeLayout>
-
-    </LinearLayout>
-
-</merge>
--- a/mobile/android/base/resources/layout/abouthome_content.xml.in
+++ b/mobile/android/base/resources/layout/abouthome_content.xml.in
@@ -2,135 +2,155 @@
 <?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/. -->
 
 <merge xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@">
 
-    <RelativeLayout android:layout_width="fill_parent"
-                    android:layout_height="fill_parent"
-                    android:paddingLeft="@dimen/abouthome_gutter_large"
-                    android:paddingRight="@dimen/abouthome_gutter_large">
-
-        <ImageView android:src="@drawable/abouthome_icon"
-                   android:layout_width="wrap_content"
-                   android:layout_height="wrap_content"
-                   android:layout_marginTop="4dp"
-                   android:layout_alignParentTop="true"
-                   android:layout_alignParentRight="true"/>
+    <LinearLayout android:layout_width="fill_parent"
+                  android:orientation="vertical"
+                  android:layout_height="fill_parent">
 
-        <LinearLayout android:orientation="vertical"
-                      android:layout_width="fill_parent"
-                      android:layout_height="fill_parent"
-                      android:layout_alignParentTop="true"
-                      android:layout_alignParentLeft="true">
+        <RelativeLayout android:id="@+id/top_sites"
+                        android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:layout_alignParentTop="true"
+                        android:layout_alignParentLeft="true"
+                        android:isScrollContainer="false">
 
-            <ImageView android:src="@drawable/abouthome_logo"
-                       android:layout_width="wrap_content"
-                       android:layout_height="24dip"
-                       android:layout_marginTop="16dip"
-                       android:layout_marginBottom="10dip"
-                       android:layout_marginLeft="12dip"/>
+            <ImageView android:id="@+id/top_sites_top"
+                       android:layout_width="fill_parent"
+                       android:layout_height="50dip"
+                       android:gravity="fill"
+                       android:background="@drawable/abouthome_bg_repeat"/>
 
             <TextView android:id="@+id/top_sites_title"
-                      android:text="@string/abouthome_top_sites_title"
                       android:layout_width="fill_parent"
                       android:layout_height="26dip"
+                      android:layout_below="@id/top_sites_top"
                       android:background="#34FFFFFF"
                       android:paddingLeft="12dip"
                       android:textSize="12sp"
                       android:textColor="#000000"
                       android:textStyle="bold"
-                      android:gravity="left|center_vertical"/>
+                      android:gravity="left|center_vertical"
+                      android:text="@string/abouthome_top_sites_title"/>
 
             <TextView android:id="@+id/no_top_sites_text"
-                      android:text="@string/abouthome_no_top_sites"
                       android:layout_width="fill_parent"
                       android:layout_height="wrap_content"
+                      android:layout_below="@id/top_sites_title"
                       android:paddingTop="47dp"
                       android:paddingBottom="47dp"
                       android:paddingLeft="60dp"
                       android:paddingRight="60dp"
                       android:gravity="center"
                       android:textSize="12sp"
                       android:textColor="#666666"
+                      android:text="@string/abouthome_no_top_sites"
                       android:visibility="gone"/>
 
+            <ImageView android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:layout_marginTop="4dp"
+                       android:layout_alignParentTop="true"
+                       android:layout_alignParentRight="true"
+                       android:src="@drawable/abouthome_icon"/>
+
             <view class="org.mozilla.gecko.AboutHomeContent$TopSitesGridView"
                   android:id="@+id/top_sites_grid"
                   android:layout_width="fill_parent"
                   android:layout_height="wrap_content"
                   android:layout_marginTop="12dp"
+                  android:layout_below="@id/top_sites_title"
                   android:verticalSpacing="8dip"
                   android:horizontalSpacing="0dip"
                   android:isScrollContainer="false"
                   android:gravity="center"
                   android:listSelector="@drawable/action_bar_button"/>
 
             <org.mozilla.gecko.LinkTextView android:id="@+id/all_top_sites_text"
-                                            android:text="@string/abouthome_top_sites_browse"
                                             android:layout_width="fill_parent"
                                             android:layout_height="30dip"
+                                            android:layout_below="@id/top_sites_grid"
                                             android:layout_marginTop="7dip"
                                             android:textColor="#22629e"
                                             android:textSize="12sp"
-                                            android:gravity="top|center_horizontal"/>
+                                            android:gravity="top|center_horizontal"
+                                            android:text="@string/abouthome_top_sites_browse"/>
+
+            <RelativeLayout android:id="@+id/sync_box_container"
+                            android:layout_width="fill_parent"
+                            android:layout_height="wrap_content"
+                            android:layout_below="@id/all_top_sites_text"
+                            android:gravity="center"
+                            android:paddingLeft="12dp"
+                            android:paddingRight="12dp"
+                            android:paddingTop="17dp"
+                            android:paddingBottom="14dp"
+                            android:visibility="gone">
 
-            <LinearLayout android:id="@+id/sync_box"
-                          android:background="@drawable/abouthome_sync_box"
-                          android:orientation="horizontal"
-                          android:layout_width="fill_parent"
-                          android:layout_height="wrap_content"
-                          android:layout_marginLeft="12dp"
-                          android:layout_marginRight="12dp"
-                          android:layout_marginTop="17dp"
-                          android:layout_marginBottom="14dp"
-                          android:gravity="center"
-                          android:clickable="true"
-                          android:visibility="gone">
+                <RelativeLayout android:id="@+id/sync_box"
+                                android:layout_width="fill_parent"
+                                android:layout_height="wrap_content"
+                                android:gravity="center"
+                                android:clickable="true"
+                                android:background="@drawable/abouthome_sync_box">
 
-                <ImageView android:id="@+id/sync_logo"
-                           android:src="@drawable/abouthome_sync_logo"
-                           android:layout_width="wrap_content"
-                           android:layout_height="wrap_content"
-                           android:layout_weight="0"
-                           android:gravity="left|center_vertical"/>
+                    <ImageView android:id="@+id/sync_logo"
+                               android:layout_width="wrap_content"
+                               android:layout_height="wrap_content"
+                               android:layout_centerVertical="true"
+                               android:src="@drawable/abouthome_sync_logo"/>
+
+                    <TextView android:id="@+id/sync_text"
+                              android:layout_width="fill_parent"
+                              android:layout_height="wrap_content"
+                              android:layout_centerVertical="true"
+                              android:layout_toRightOf="@id/sync_logo"
+                              android:layout_marginLeft="7dp"
+                              android:gravity="center"
+                              android:textSize="15sp"
+                              android:textColor="#FFFFFF"
+                              android:text="@string/abouthome_about_sync"/>
 
-                <TextView android:id="@+id/sync_text"
-                          android:text="@string/abouthome_about_sync"
-                          android:layout_width="0dp"
-                          android:layout_height="wrap_content"
-                          android:layout_weight="1"
-                          android:layout_marginLeft="7dp"
-                          android:gravity="center"
-                          android:textSize="15sp"
-                          android:textColor="#FFFFFF"/>
+                </RelativeLayout>
+
+            </RelativeLayout>
 
-            </LinearLayout>
+            <ImageView android:id="@+id/logo"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:layout_marginTop="16dip"
+                       android:layout_marginBottom="10dip"
+                       android:layout_marginLeft="12dip"
+                       android:layout_alignParentTop="true"
+                       android:layout_alignParentLeft="true"
+                       android:src="@drawable/abouthome_logo"/>
+
+        </RelativeLayout>
 
-            <org.mozilla.gecko.AboutHomeSection android:id="@+id/last_tabs"
-                                                android:layout_width="fill_parent"
-                                                android:layout_height="wrap_content"
-                                                android:visibility="gone"
-                                                gecko:title="@string/abouthome_last_tabs_title"
-                                                gecko:more_text="@string/abouthome_last_tabs_open"/>
+        <org.mozilla.gecko.AboutHomeSection android:id="@+id/last_tabs"
+                                            android:layout_width="fill_parent"
+                                            android:layout_height="wrap_content"
+                                            android:visibility="gone"
+                                            gecko:title="@string/abouthome_last_tabs_title"
+                                            gecko:more_text="@string/abouthome_last_tabs_open"/>
 
-            <org.mozilla.gecko.AboutHomeSection android:id="@+id/recommended_addons"
-                                                android:layout_width="fill_parent"
-                                                android:layout_height="wrap_content"
-                                                android:visibility="gone"
-                                                gecko:title="@string/abouthome_addons_title"
-                                                gecko:more_text="@string/abouthome_addons_browse"/>
+        <org.mozilla.gecko.AboutHomeSection android:id="@+id/recommended_addons"
+                                            android:layout_width="fill_parent"
+                                            android:layout_height="wrap_content"
+                                            android:visibility="gone"
+                                            gecko:title="@string/abouthome_addons_title"
+                                            gecko:more_text="@string/abouthome_addons_browse"/>
 
-            <org.mozilla.gecko.AboutHomeSection android:id="@+id/remote_tabs"
-                                                android:layout_width="fill_parent"
-                                                android:layout_height="wrap_content"
-                                                android:visibility="gone"
-                                                gecko:title="@string/remote_tabs"
-                                                gecko:more_text="@string/remote_tabs_show_all"/>
+        <org.mozilla.gecko.AboutHomeSection android:id="@+id/remote_tabs"
+                                            android:layout_width="fill_parent"
+                                            android:layout_height="wrap_content"
+                                            android:visibility="gone"
+                                            gecko:title="@string/remote_tabs"
+                                            gecko:more_text="@string/remote_tabs_show_all"/>
 
-        </LinearLayout>
-
-    </RelativeLayout>
+    </LinearLayout>
 
 </merge>
deleted file mode 100644
--- a/mobile/android/base/resources/values-land/integers.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?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>
-
-    <integer name="number_of_top_sites_cols">3</integer>
-
-</resources>
--- a/mobile/android/base/resources/values-xlarge-v11/dimens.xml
+++ b/mobile/android/base/resources/values-xlarge-v11/dimens.xml
@@ -1,17 +1,15 @@
 <?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>
 
-    <dimen name="abouthome_gutter_small">20dp</dimen>
-    <dimen name="abouthome_gutter_large">40dp</dimen>
     <dimen name="awesomebar_header_row_height">24dp</dimen>
     <dimen name="awesomebar_row_height">66dp</dimen>
     <dimen name="awesomebar_suggestion_item_height">32dp</dimen>
     <dimen name="awesomebar_tab_transparency_height">46dp</dimen>
     <dimen name="browser_toolbar_height">56dp</dimen>
     <dimen name="local_tab_row_height">150dp</dimen>
     <dimen name="remote_tab_child_row_height">48dp</dimen>
     <dimen name="remote_tab_group_row_height">28dp</dimen>
deleted file mode 100644
--- a/mobile/android/base/resources/values-xlarge-v11/integers.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?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>
-
-    <integer name="number_of_top_sites">9</integer>
-    <integer name="number_of_top_sites_cols">3</integer>
-
-</resources>
--- a/mobile/android/base/resources/values/dimens.xml
+++ b/mobile/android/base/resources/values/dimens.xml
@@ -1,18 +1,15 @@
 <?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>
 
-    <dimen name="abouthome_gutter_small">0dp</dimen>
-    <dimen name="abouthome_gutter_large">0dp</dimen>
-    <dimen name="abouthome_content_top_sites_item_height">110dp</dimen>
     <dimen name="awesomebar_header_row_height">20dp</dimen>
     <dimen name="awesomebar_row_height">48dp</dimen>
     <dimen name="awesomebar_tab_transparency_height">38dp</dimen>
     <dimen name="browser_toolbar_height">48dp</dimen>
     <dimen name="flow_layout_spacing">6dp</dimen>
     <dimen name="local_tab_row_height">108dp</dimen>
     <dimen name="remote_tab_child_row_height">54dp</dimen>
     <dimen name="remote_tab_group_row_height">26dp</dimen>
deleted file mode 100644
--- a/mobile/android/base/resources/values/integers.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?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>
-
-    <integer name="number_of_top_sites">6</integer>
-    <integer name="number_of_top_sites_cols">2</integer>
-
-</resources>