Backed out changeset 3761b11b90f0 (bug 970247) for robocop NPEs (again).
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 12 Feb 2014 13:37:13 -0500
changeset 168363 926feb30decc8fd0ac3306bd11de19ad90f3fc52
parent 168362 79bc2b2768e4876b20e4589ff84f00d4cd45dfb6
child 168364 881a08901c0db0ef5fd05bd47ace0d35f0b6ee9b
push id5036
push userryanvm@gmail.com
push dateWed, 12 Feb 2014 18:37:13 +0000
treeherderfx-team@926feb30decc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs970247
milestone30.0a1
backs out3761b11b90f059a05ca54d978d4cb00733e6628f
Backed out changeset 3761b11b90f0 (bug 970247) for robocop NPEs (again). CLOSED TREE
mobile/android/base/BrowserApp.java
mobile/android/base/GeckoApp.java
mobile/android/base/resources/layout/button_toast.xml
mobile/android/base/resources/layout/gecko_app.xml
mobile/android/base/resources/layout/web_app.xml
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -2252,17 +2252,17 @@ abstract public class BrowserApp extends
             tab = Tabs.getInstance().getSelectedTab();
             if (tab != null) {
                 if (item.isChecked()) {
                     tab.removeBookmark();
                     Toast.makeText(this, R.string.bookmark_removed, Toast.LENGTH_SHORT).show();
                     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,
                         new ButtonToast.ToastListener() {
                             @Override
                             public void onButtonClicked() {
                                 showBookmarkDialog();
                             }
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -88,17 +88,16 @@ import android.view.MenuInflater;
 import android.view.MenuItem;
 import android.view.MotionEvent;
 import android.view.OrientationEventListener;
 import android.view.SurfaceHolder;
 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;
 import android.widget.FrameLayout;
 import android.widget.ListView;
 import android.widget.RelativeLayout;
 import android.widget.SimpleAdapter;
 import android.widget.TextView;
@@ -817,36 +816,25 @@ public abstract class GeckoApp
                 } else {
                     toast = Toast.makeText(GeckoApp.this, message, Toast.LENGTH_SHORT);
                 }
                 toast.show();
             }
         });
     }
 
-    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() {
             public void onBitmapFound(final Drawable d) {
 
                 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));
                             }
 
                             @Override
                             public void onToastHidden(ButtonToast.ReasonHidden reason) {
                                 if (reason == ButtonToast.ReasonHidden.TIMEOUT) {
@@ -1255,16 +1243,18 @@ public abstract class GeckoApp
         mOrientation = getResources().getConfiguration().orientation;
 
         setContentView(getLayout());
 
         // Set up Gecko layout.
         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) {
             boolean wasInBackground =
                 savedInstanceState.getBoolean(SAVED_STATE_IN_BACKGROUND, false);
 
             // Don't log OOM-kills if only one activity was destroyed. (For example
             // from "Don't keep activities" on ICS)
deleted file mode 100644
--- a/mobile/android/base/resources/layout/button_toast.xml
+++ /dev/null
@@ -1,19 +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/. -->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/toast"
-              style="@style/Toast">
-
-    <TextView android:id="@+id/toast_message"
-              style="@style/ToastMessage" />
-
-    <ImageView android:id="@+id/toast_divider"
-               style="@style/ToastDivider" />
-
-    <Button android:id="@+id/toast_button"
-            style="@style/ToastButton" />
-
-</LinearLayout>
--- a/mobile/android/base/resources/layout/gecko_app.xml
+++ b/mobile/android/base/resources/layout/gecko_app.xml
@@ -93,13 +93,23 @@
                                                     android:layout_height="fill_parent"
                                                     android:layout_width="fill_parent"
                                                     style="@style/GeckoActionBar"/>
 
         </org.mozilla.gecko.widget.GeckoViewFlipper>
 
     </view>
 
-    <ViewStub android:id="@+id/toast_stub"
-              android:layout="@layout/button_toast"
-              style="@style/Toast"/>
+    <LinearLayout android:id="@+id/toast"
+                  style="@style/Toast">
+
+        <TextView android:id="@+id/toast_message"
+                  style="@style/ToastMessage" />
+
+        <ImageView android:id="@+id/toast_divider"
+                   style="@style/ToastDivider" />
+
+        <Button android:id="@+id/toast_button"
+                style="@style/ToastButton" />
+
+    </LinearLayout>
 
 </RelativeLayout>
--- a/mobile/android/base/resources/layout/web_app.xml
+++ b/mobile/android/base/resources/layout/web_app.xml
@@ -48,13 +48,23 @@
                          android:layout_alignParentBottom="true"
                          android:paddingBottom="30dip"
                          android:visibility="gone"/>
 
         </RelativeLayout>
 
     </RelativeLayout>
 
-    <ViewStub android:id="@+id/toast_stub"
-              android:layout="@layout/button_toast"
-              style="@style/Toast"/>
+    <LinearLayout android:id="@+id/toast"
+                  style="@style/Toast">
+
+        <TextView android:id="@+id/toast_message"
+                  style="@style/ToastMessage" />
+
+        <ImageView android:id="@+id/toast_divider"
+                   style="@style/ToastDivider" />
+
+        <Button android:id="@+id/toast_button"
+                style="@style/ToastButton" />
+
+    </LinearLayout>
 
 </RelativeLayout>