From 18df517424f9ab5d4d9d99d86cc02b11f9464416 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Wed, 12 Feb 2014 13:37:13 -0500 Subject: [PATCH] Backed out changeset 3761b11b90f0 (bug 970247) for robocop NPEs (again). CLOSED TREE --- mobile/android/base/BrowserApp.java | 2 +- mobile/android/base/GeckoApp.java | 16 +++------------- .../base/resources/layout/button_toast.xml | 19 ------------------- .../base/resources/layout/gecko_app.xml | 16 +++++++++++++--- .../android/base/resources/layout/web_app.xml | 16 +++++++++++++--- 5 files changed, 30 insertions(+), 39 deletions(-) delete mode 100644 mobile/android/base/resources/layout/button_toast.xml diff --git a/mobile/android/base/BrowserApp.java b/mobile/android/base/BrowserApp.java index 921d24dc8526..e3ee47968cc4 100644 --- a/mobile/android/base/BrowserApp.java +++ b/mobile/android/base/BrowserApp.java @@ -2257,7 +2257,7 @@ abstract public class BrowserApp extends GeckoApp item.setIcon(R.drawable.ic_menu_bookmark_add); } else { tab.addBookmark(); - getButtonToast().show(false, + mToast.show(false, getResources().getString(R.string.bookmark_added), getResources().getString(R.string.bookmark_options), null, diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index 94e69d541fe6..2ea0b6c26346 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -93,7 +93,6 @@ import android.view.SurfaceView; import android.view.TextureView; import android.view.View; import android.view.ViewGroup; -import android.view.ViewStub; import android.view.Window; import android.view.WindowManager; import android.widget.AbsoluteLayout; @@ -822,17 +821,6 @@ public abstract class GeckoApp }); } - protected ButtonToast getButtonToast() { - if (mToast != null) { - return mToast; - } - - ViewStub toastStub = (ViewStub) findViewById(R.id.toast_stub); - mToast = new ButtonToast(toastStub.inflate()); - - return mToast; - } - void showButtonToast(final String message, final String buttonText, final String buttonIcon, final String buttonId) { BitmapUtils.getDrawable(GeckoApp.this, buttonIcon, new BitmapUtils.BitmapLoader() { @@ -841,7 +829,7 @@ public abstract class GeckoApp ThreadUtils.postToUiThread(new Runnable() { @Override public void run() { - getButtonToast().show(false, message, buttonText, d, new ButtonToast.ToastListener() { + mToast.show(false, message, buttonText, d, new ButtonToast.ToastListener() { @Override public void onButtonClicked() { GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Toast:Click", buttonId)); @@ -1260,6 +1248,8 @@ public abstract class GeckoApp mGeckoLayout = (RelativeLayout) findViewById(R.id.gecko_layout); mMainLayout = (RelativeLayout) findViewById(R.id.main_layout); + mToast = new ButtonToast(findViewById(R.id.toast)); + // Determine whether we should restore tabs. mShouldRestore = getSessionRestoreState(savedInstanceState); if (mShouldRestore && savedInstanceState != null) { diff --git a/mobile/android/base/resources/layout/button_toast.xml b/mobile/android/base/resources/layout/button_toast.xml deleted file mode 100644 index 057e4d970e3b..000000000000 --- a/mobile/android/base/resources/layout/button_toast.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - -