Bug 1134015 - Fixes broken button toasts. r=margaret
authorAndy Pusch <drag@black-pixel.net>
Tue, 17 Feb 2015 15:42:05 -0800
changeset 229590 15edc0cdbae7f203c0919736922ddd9c6746520f
parent 229589 a288bf86a785ac92b0527ab3f2379a12af8cfa12
child 229591 6500f3e51d7860e955811f28232b95d2eeb9eb12
push id28293
push userryanvm@gmail.com
push dateThu, 19 Feb 2015 01:13:26 +0000
treeherdermozilla-central@551febba68bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1134015
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1134015 - Fixes broken button toasts. r=margaret
mobile/android/base/GeckoApp.java
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -387,17 +387,17 @@ public abstract class GeckoApp
         if (Versions.feature11Plus && featureId == Window.FEATURE_OPTIONS_PANEL) {
             if (mMenuPanel == null) {
                 mMenuPanel = new MenuPanel(this, null);
             } else {
                 // Prepare the panel every time before showing the menu.
                 onPreparePanel(featureId, mMenuPanel, mMenu);
             }
 
-            return mMenuPanel; 
+            return mMenuPanel;
         }
 
         return super.onCreatePanelView(featureId);
     }
 
     @Override
     public boolean onCreatePanelMenu(int featureId, Menu menu) {
         if (Versions.feature11Plus && featureId == Window.FEATURE_OPTIONS_PANEL) {
@@ -500,17 +500,17 @@ public abstract class GeckoApp
 
     @Override
     public void onOptionsMenuClosed(Menu menu) {
         if (Versions.feature11Plus) {
             mMenuPanel.removeAllViews();
             mMenuPanel.addView((GeckoMenu) mMenu);
         }
     }
- 
+
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
         // Handle hardware menu key presses separately so that we can show a custom menu in some cases.
         if (keyCode == KeyEvent.KEYCODE_MENU) {
             openOptionsMenu();
             return true;
         }
 
@@ -834,17 +834,21 @@ public abstract class GeckoApp
                 getButtonToast().show(false, message, toastDuration ,buttonText, d, new ButtonToast.ToastListener() {
                     @Override
                     public void onButtonClicked() {
                         GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Toast:Click", buttonId));
                     }
 
                     @Override
                     public void onToastHidden(ButtonToast.ReasonHidden reason) {
-                        GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Toast:Hidden", buttonId));
+                        if (reason == ButtonToast.ReasonHidden.TIMEOUT ||
+                            reason == ButtonToast.ReasonHidden.TOUCH_OUTSIDE ||
+                            reason == ButtonToast.ReasonHidden.REPLACED) {
+                            GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Toast:Hidden", buttonId));
+                        }
                     }
                 });
             }
         });
     }
 
     private void addFullScreenPluginView(View view) {
         if (mFullScreenPluginView != null) {
@@ -1054,17 +1058,17 @@ public abstract class GeckoApp
         LayerView layerView = mLayerView;
         layerView.addLayer(layer);
         layerView.requestRender();
     }
 
     public void requestRender() {
         mLayerView.requestRender();
     }
-    
+
     public void hidePlugins(Tab tab) {
         for (Layer layer : tab.getPluginLayers()) {
             if (layer instanceof PluginLayer) {
                 ((PluginLayer) layer).setVisible(false);
             }
 
             hidePluginLayer(layer);
         }