Bug 1229967 - Handle onKeyDown() for the menu key in GeckoMenu. r=sebastian, a=lizzard
authorJan Henning <jh+bugzilla@buttercookie.de>
Mon, 11 Apr 2016 12:42:21 +0200
changeset 325876 d6d1d04e3dbdecaefc54b3623f28226133aef722
parent 325875 133c7279577b12d9814cbebdd09d529f7c75a0f6
child 325877 c0d6effecccbae1a3105e231428947d5c0d23ded
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian, lizzard
bugs1229967
milestone47.0a2
Bug 1229967 - Handle onKeyDown() for the menu key in GeckoMenu. r=sebastian, a=lizzard 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;
     }