コード例 #1
0
 /**
  * This method tests if a key is one of the described in:
  * https://bugzilla.mozilla.org/show_bug.cgi?id=756504#c0
  *
  * @param keyCode int with the key code (Android key constant from KeyEvent)
  * @return true if the key is one of the listed above, false otherwise.
  */
 private static boolean isJoystickButton(int keyCode) {
   switch (keyCode) {
     case KeyEvent.KEYCODE_DPAD_CENTER:
     case KeyEvent.KEYCODE_DPAD_LEFT:
     case KeyEvent.KEYCODE_DPAD_RIGHT:
     case KeyEvent.KEYCODE_DPAD_DOWN:
     case KeyEvent.KEYCODE_DPAD_UP:
       return true;
     default:
       if (Build.VERSION.SDK_INT >= 12) {
         return KeyEvent.isGamepadButton(keyCode);
       }
       return GeckoEvent.isGamepadButton(keyCode);
   }
 }