Bug 1229967 - Handle onKeyDown() for the menu key in GeckoMenu. r=sebastian
This restores the functionality to close the menu by pressing the hardware menu key.
MozReview-Commit-ID: EKCeALPvFoB
--- 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;
}