bug 711184 - make sure we don't do any work creating about:home if we're not showing about:home r=dougt
☠☠ backed out by 8cf696f741cd ☠ ☠
authorBrad Lassey <blassey@mozilla.com>
Fri, 16 Dec 2011 16:17:57 -0500
changeset 84475 434e5060c706c3349b3be4c342d6d7b499ee663a
parent 84474 7d11de2fdbc25454770b953201fde661e6c2f28f
child 84476 67eb3827b7eb3a14771d3033759da2d6c1bce1aa
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdougt
bugs711184
milestone11.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 711184 - make sure we don't do any work creating about:home if we're not showing about:home r=dougt
mobile/android/base/AboutHomeContent.java
mobile/android/base/GeckoApp.java
mobile/android/base/resources/layout/gecko_app.xml
--- a/mobile/android/base/AboutHomeContent.java
+++ b/mobile/android/base/AboutHomeContent.java
@@ -57,16 +57,17 @@ import android.content.Context;
 import android.content.res.Configuration;
 import android.database.Cursor;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.text.SpannableString;
 import android.text.style.UnderlineSpan;
 import android.util.AttributeSet;
 import android.util.Log;
+import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.AdapterView;
 import android.widget.ArrayAdapter;
 import android.widget.GridView;
 import android.widget.ImageView;
 import android.widget.ListView;
 import android.widget.ScrollView;
 import android.widget.SimpleCursorAdapter;
@@ -156,16 +157,20 @@ public class AboutHomeContent extends Sc
         Configuration config = getContext().getResources().getConfiguration();
         if (config.orientation == Configuration.ORIENTATION_LANDSCAPE)
             return NUMBER_OF_COLS_LANDSCAPE;
         else
             return NUMBER_OF_COLS_PORTRAIT;
     }
 
     void init(final Activity activity) {
+        LayoutInflater inflater =
+            (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+        
+        inflater.inflate(R.layout.abouthome_content, this);
         GeckoAppShell.getHandler().post(new Runnable() {
             public void run() {
                 if (mCursor != null)
                     activity.stopManagingCursor(mCursor);
 
                 ContentResolver resolver = GeckoApp.mAppContext.getContentResolver();
                 mCursor = BrowserDB.filter(resolver, "", NUMBER_OF_TOP_SITES_PORTRAIT);
                 activity.startManagingCursor(mCursor);
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -995,27 +995,29 @@ abstract public class GeckoApp
     public class AboutHomeRunnable implements Runnable {
         boolean mShow;
         AboutHomeRunnable(boolean show) {
             mShow = show;
         }
 
         public void run() {
             mAutoCompletePopup.hide();
-            if (mAboutHomeContent == null) {
-                mAboutHomeContent = (AboutHomeContent) findViewById(R.id.abouthome_content);
+            if (mAboutHomeContent == null && mShow) {
+                mAboutHomeContent = new AboutHomeContent(GeckoApp.mAppContext, null);
                 mAboutHomeContent.init(GeckoApp.mAppContext);
                 mAboutHomeContent.setUriLoadCallback(new AboutHomeContent.UriLoadCallback() {
                     public void callback(String url) {
                         mBrowserToolbar.setProgressVisibility(true);
                         loadUrl(url, AwesomeBar.Type.EDIT);
                     }
                 });
+                mGeckoLayout.addView(mAboutHomeContent);
             }
-            mAboutHomeContent.setVisibility(mShow ? View.VISIBLE : View.GONE);
+            if (mAboutHomeContent != null)
+                mAboutHomeContent.setVisibility(mShow ? View.VISIBLE : View.GONE);
         }
     }
 
     void updateAgentModeMenuItem(final Tab tab, final Tab.AgentMode agentMode) {
         if (sMenu == null)
             return;
 
         mMainHandler.post(new Runnable() {
--- a/mobile/android/base/resources/layout/gecko_app.xml
+++ b/mobile/android/base/resources/layout/gecko_app.xml
@@ -15,28 +15,16 @@
                     android:layout_height="fill_parent"
                     android:layout_weight="1">
 
         <AbsoluteLayout android:id="@+id/plugin_container"
                         android:background="@android:color/transparent"
                         android:layout_width="fill_parent"
                         android:layout_height="fill_parent"/>
 
-        <org.mozilla.gecko.AboutHomeContent android:id="@+id/abouthome_content"
-                                            android:orientation="vertical"
-                                            android:layout_width="fill_parent"
-                                            android:layout_height="fill_parent"
-                                            android:background="#ffffff"
-                                            android:isScrollContainer="true"
-                                            android:visibility="gone">
-
-            <include layout="@layout/abouthome_content"/>
-
-        </org.mozilla.gecko.AboutHomeContent>
-
         <org.mozilla.gecko.AutoCompletePopup android:id="@+id/autocomplete_popup"
                                              style="@android:style/Widget.ListView.White"
                                              android:layout_width="fill_parent"
                                              android:layout_height="100dip"
                                              android:background="@drawable/autocomplete_list_bg"
                                              android:cacheColorHint="#ffffff"
                                              android:listSelector="@android:drawable/list_selector_background"
                                              android:visibility="gone"/>