Backed out changeset 03bf10b236ea (bug 970247) for robocop NPEs.

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2014-02-12 11:50:28 -05:00
parent 4258b68d16
commit 0e1e9e9832
5 changed files with 30 additions and 39 deletions

View File

@ -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,

View File

@ -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);
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) {

View File

@ -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>

View File

@ -98,8 +98,18 @@
</view>
<ViewStub android:id="@+id/toast"
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>

View File

@ -53,8 +53,18 @@
</RelativeLayout>
<ViewStub android:id="@+id/toast"
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>