Bug 1229967 - Handle onKeyDown() for the menu key in GeckoMenu. r=sebastian, a=lizzard on a CLOSED TREE
authorJan Henning <jh+bugzilla@buttercookie.de>
Mon, 11 Apr 2016 12:42:21 +0200
changeset 317798 9a9fe42b023a3cca14c6f2cce900870ea14e767c
parent 317797 04c82e2f0a7e0faf5db748740e76211383f4b9c8
child 317799 eb98893ffbd4f38cec8172098d6da05e956b92b9
push id5902
push usercbook@mozilla.com
push dateMon, 18 Apr 2016 13:55:44 +0000
treeherdermozilla-beta@9a9fe42b023a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian, lizzard
bugs1229967
milestone46.0
Bug 1229967 - Handle onKeyDown() for the menu key in GeckoMenu. r=sebastian, a=lizzard on a CLOSED TREE This restores the functionality to close the menu by pressing the hardware menu key. MozReview-Commit-ID: EKCeALPvFoB
mobile/android/base/java/org/mozilla/gecko/menu/GeckoMenu.java
--- a/mobile/android/base/java/org/mozilla/gecko/menu/GeckoMenu.java
+++ b/mobile/android/base/java/org/mozilla/gecko/menu/GeckoMenu.java
@@ -457,16 +457,27 @@ public class GeckoMenu extends ListView
                 !mQuickShareActionItems.containsKey(menuItem))
                 return true;
         }
 
         return false;
     }
 
     @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        // Close the menu if it is open and the hardware menu key is pressed.
+        if (keyCode == KeyEvent.KEYCODE_MENU && isShown()) {
+            close();
+            return true;
+        }
+
+        return super.onKeyDown(keyCode, event);
+    }
+
+    @Override
     public boolean isShortcutKey(int keyCode, KeyEvent event) {
         return true;
     }
 
     @Override
     public boolean performIdentifierAction(int id, int flags) {
         return false;
     }