From a3df32511704396697051cf0b6ca000323ee2500 Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Fri, 16 Dec 2011 16:17:57 -0500 Subject: [PATCH] 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 | 5 +++++ mobile/android/base/GeckoApp.java | 8 +++++--- mobile/android/base/resources/layout/gecko_app.xml | 12 ------------ 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/mobile/android/base/AboutHomeContent.java b/mobile/android/base/AboutHomeContent.java index f064d1ebd371..f58138cf7f7d 100644 --- a/mobile/android/base/AboutHomeContent.java +++ b/mobile/android/base/AboutHomeContent.java @@ -62,6 +62,7 @@ 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; @@ -161,6 +162,10 @@ public class AboutHomeContent extends ScrollView { } 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) diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index a708353f5f7a..9a1bab44112b 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -1000,8 +1000,8 @@ abstract public class GeckoApp 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) { @@ -1009,8 +1009,10 @@ abstract public class GeckoApp 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); } } diff --git a/mobile/android/base/resources/layout/gecko_app.xml b/mobile/android/base/resources/layout/gecko_app.xml index 7099b473f98e..e97314498fc3 100644 --- a/mobile/android/base/resources/layout/gecko_app.xml +++ b/mobile/android/base/resources/layout/gecko_app.xml @@ -20,18 +20,6 @@ android:layout_width="fill_parent" android:layout_height="fill_parent"/> - - - - - -