Bug 882715 - Pack home pager in a frame layout (r=bnicholson)
authorLucas Rocha <lucasr@mozilla.com>
Mon, 08 Jul 2013 23:05:50 +0100
changeset 143389 6c702f748e20
parent 143388 81c3af05d10a
child 143390 d239a58564cb
push id25130
push userlrocha@mozilla.com
push date2013-08-21 09:41 +0000
treeherdermozilla-central@b2486721572e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson
bugs882715
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 882715 - Pack home pager in a frame layout (r=bnicholson)
mobile/android/base/BrowserApp.java
mobile/android/base/resources/layout/gecko_app.xml
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -47,16 +47,18 @@ import android.graphics.drawable.BitmapD
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.nfc.NdefMessage;
 import android.nfc.NdefRecord;
 import android.nfc.NfcAdapter;
 import android.nfc.NfcEvent;
 import android.os.Build;
 import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.InputDevice;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
@@ -101,16 +103,17 @@ abstract public class BrowserApp extends
     private static final String STATE_DYNAMIC_TOOLBAR_ENABLED = "dynamic_toolbar";
 
     private static final String BROWSER_SEARCH_TAG = "browser_search";
     private BrowserSearch mBrowserSearch;
     private View mBrowserSearchContainer;
 
     public static BrowserToolbar mBrowserToolbar;
     private HomePager mHomePager;
+    private View mHomePagerContainer;
     protected Telemetry.Timer mAboutHomeStartupTimer = null;
 
     private static final int ADDON_MENU_OFFSET = 1000;
     private class MenuItemInfo {
         public int id;
         public String label;
         public String icon;
         public boolean checkable;
@@ -424,16 +427,17 @@ abstract public class BrowserApp extends
                         mHomePager.requestFocus();
                     }
                 }
                 return false;
             }
         });
 
         mHomePager = (HomePager) findViewById(R.id.home_pager);
+        mHomePagerContainer = findViewById(R.id.home_pager_container);
 
         mBrowserSearchContainer = findViewById(R.id.search_container);
         mBrowserSearch = (BrowserSearch) getSupportFragmentManager().findFragmentByTag(BROWSER_SEARCH_TAG);
         if (mBrowserSearch == null) {
             mBrowserSearch = BrowserSearch.newInstance();
             mBrowserSearch.setUserVisibleHint(false);
         }
 
@@ -595,25 +599,25 @@ abstract public class BrowserApp extends
 
     private void setDynamicToolbarEnabled(boolean enabled) {
         if (enabled) {
             if (mLayerView != null) {
                 mLayerView.getLayerClient().setOnMetricsChangedListener(this);
             }
             setToolbarMargin(0);
             // FIXME: address this in bug 876750
-            //mHomePager.setTopPadding(mBrowserToolbar.getLayout().getHeight());
+            //mHomePagerContainer.setTopPadding(mBrowserToolbar.getLayout().getHeight());
         } else {
             // Immediately show the toolbar when disabling the dynamic
             // toolbar.
             if (mLayerView != null) {
                 mLayerView.getLayerClient().setOnMetricsChangedListener(null);
             }
             // FIXME: address this in bug 876750
-            //mHomePager.setTopPadding(0);
+            //mHomePagerContainer.setTopPadding(0);
             if (mBrowserToolbar != null) {
                 mBrowserToolbar.scrollTo(0, 0);
             }
         }
 
         refreshToolbarHeight();
     }
 
@@ -883,17 +887,17 @@ abstract public class BrowserApp extends
         if (!isDynamicToolbarEnabled() || mHomePager.isVisible()) {
             // Use aVisibleHeight here so that when the dynamic toolbar is
             // enabled, the padding will animate with the toolbar becoming
             // visible.
             if (isDynamicToolbarEnabled()) {
                 // When the dynamic toolbar is enabled, set the padding on the
                 // about:home widget directly - this is to avoid resizing the
                 // LayerView, which can cause visible artifacts.
-                mHomePager.setPadding(0, height, 0, 0);
+                mHomePagerContainer.setPadding(0, height, 0, 0);
             } else {
                 setToolbarMargin(height);
                 height = 0;
             }
         } else {
             setToolbarMargin(0);
         }
 
--- a/mobile/android/base/resources/layout/gecko_app.xml
+++ b/mobile/android/base/resources/layout/gecko_app.xml
@@ -22,31 +22,37 @@
 
         <RelativeLayout android:id="@+id/gecko_layout"
                         android:layout_width="fill_parent"
                         android:layout_height="fill_parent"
                         android:layout_above="@+id/find_in_page">
 
             <include layout="@layout/shared_ui_components"/>
 
-            <org.mozilla.gecko.home.HomePager android:id="@+id/home_pager"
-                                              android:layout_width="fill_parent"
-                                              android:layout_height="fill_parent"
-                                              android:background="@android:color/white"
-                                              android:visibility="gone">
+            <FrameLayout android:id="@+id/home_pager_container"
+                         android:layout_width="fill_parent"
+                         android:layout_height="fill_parent">
+
+                <org.mozilla.gecko.home.HomePager android:id="@+id/home_pager"
+                                                  android:layout_width="fill_parent"
+                                                  android:layout_height="fill_parent"
+                                                  android:background="@android:color/white"
+                                                  android:visibility="gone">
 
-                <org.mozilla.gecko.home.HomePagerTabStrip android:layout_width="fill_parent"
-                                                          android:layout_height="32dip"
-                                                          android:layout_gravity="top"
-                                                          android:gravity="bottom"
-                                                          android:background="@color/background_light"
-                                                          gecko:tabIndicatorColor="@color/text_color_highlight"
-                                                          android:textAppearance="@style/TextAppearance.Widget.HomePagerTabStrip"/>
+                    <org.mozilla.gecko.home.HomePagerTabStrip android:layout_width="fill_parent"
+                                                              android:layout_height="32dip"
+                                                              android:layout_gravity="top"
+                                                              android:gravity="bottom"
+                                                              android:background="@color/background_light"
+                                                              gecko:tabIndicatorColor="@color/text_color_highlight"
+                                                              android:textAppearance="@style/TextAppearance.Widget.HomePagerTabStrip"/>
 
-            </org.mozilla.gecko.home.HomePager>
+                </org.mozilla.gecko.home.HomePager>
+
+            </FrameLayout>
 
         </RelativeLayout>
 
         <org.mozilla.gecko.FindInPageBar android:id="@+id/find_in_page"
                                          android:layout_width="fill_parent"
                                          android:layout_height="wrap_content"
                                          android:layout_alignParentBottom="true"
                                          style="@style/FindBar"