mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 970247 - Stub the ButtonToast view (r=wesj)
This commit is contained in:
parent
2a3abe1675
commit
98beb621ee
@ -2257,7 +2257,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
item.setIcon(R.drawable.ic_menu_bookmark_add);
|
||||
} else {
|
||||
tab.addBookmark();
|
||||
mToast.show(false,
|
||||
getButtonToast().show(false,
|
||||
getResources().getString(R.string.bookmark_added),
|
||||
getResources().getString(R.string.bookmark_options),
|
||||
null,
|
||||
|
@ -93,6 +93,7 @@ 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;
|
||||
@ -821,6 +822,17 @@ 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() {
|
||||
@ -829,7 +841,7 @@ public abstract class GeckoApp
|
||||
ThreadUtils.postToUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mToast.show(false, message, buttonText, d, new ButtonToast.ToastListener() {
|
||||
getButtonToast().show(false, message, buttonText, d, new ButtonToast.ToastListener() {
|
||||
@Override
|
||||
public void onButtonClicked() {
|
||||
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Toast:Click", buttonId));
|
||||
@ -1248,8 +1260,6 @@ 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) {
|
||||
|
19
mobile/android/base/resources/layout/button_toast.xml
Normal file
19
mobile/android/base/resources/layout/button_toast.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?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>
|
@ -98,18 +98,8 @@
|
||||
|
||||
</view>
|
||||
|
||||
<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>
|
||||
<ViewStub android:id="@+id/toast_stub"
|
||||
android:layout="@layout/button_toast"
|
||||
style="@style/Toast"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
@ -53,18 +53,8 @@
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<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>
|
||||
<ViewStub android:id="@+id/toast_stub"
|
||||
android:layout="@layout/button_toast"
|
||||
style="@style/Toast"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user