I'm not sure it makes sense to maps these values to 'key' or 'char'.
The documentation states:
"Key codes typically correspond one-to-one with individual keys on an input device. Many keys and key combinations serve quite different functions on different input devices so care must be taken when interpreting them. Always use the KeyCharacterMap associated with the input device when mapping keys to characters."
This sounds more like a 'code' value and some of the names (like KEYCODE_ZENKAKU_HANKAKU and KEYCODE_KATAKANA_HIRAGANA) are consistent with this interpretation.
Copied from W3C Bugzilla: https://www.w3.org/Bugs/Public/show_bug.cgi?id=21083
Masayuki Nakano 2013-02-22 09:23:52 UTC
I'm trying to implement KeyboardEvent.key value for non-printable keys on Android. Then, following native keys cannot be mapped to the key names in the list (http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#key-values-list):
And for game pad:
KEYCODE_BUTTON_A: KEYCODE_BUTTON_B: KEYCODE_BUTTON_C: KEYCODE_BUTTON_X: KEYCODE_BUTTON_Y: KEYCODE_BUTTON_Z: KEYCODE_BUTTON_L1: KEYCODE_BUTTON_R1: KEYCODE_BUTTON_L2: KEYCODE_BUTTON_R2: KEYCODE_THUMBL: KEYCODE_THUMBR: KEYCODE_BUTTON_START: KEYCODE_BUTTON_SELECT: KEYCODE_BUTTON_MODE:
KEYCODE_BUTTON_1: KEYCODE_BUTTON_2: KEYCODE_BUTTON_3: KEYCODE_BUTTON_4: KEYCODE_BUTTON_5: KEYCODE_BUTTON_6: KEYCODE_BUTTON_7: KEYCODE_BUTTON_8: KEYCODE_BUTTON_9: KEYCODE_BUTTON_10: KEYCODE_BUTTON_11: KEYCODE_BUTTON_12: KEYCODE_BUTTON_13: KEYCODE_BUTTON_14: KEYCODE_BUTTON_15: KEYCODE_BUTTON_16:
'GamePadButtonA'..., 'GamePadThumbLeft', 'GamePadThumbRight', 'GamePadButton1"?
Comment 1 Masayuki Nakano 2013-02-22 09:24:37 UTC
Oops, the document of Android is here: http://developer.android.com/reference/android/view/KeyEvent.html
Comment 2 Masayuki Nakano 2013-02-23 02:21:53 UTC
(In reply to comment #0)
They are:
KEYCODE_BUTTON_THUMBL: KEYCODE_BUTTON_THUMBR:
Then, the names are:
I'm not sure it makes sense to maps these values to 'key' or 'char'.
The documentation states: "Key codes typically correspond one-to-one with individual keys on an input device. Many keys and key combinations serve quite different functions on different input devices so care must be taken when interpreting them. Always use the KeyCharacterMap associated with the input device when mapping keys to characters."
This sounds more like a 'code' value and some of the names (like KEYCODE_ZENKAKU_HANKAKU and KEYCODE_KATAKANA_HIRAGANA) are consistent with this interpretation.
To get a key/char, it looks like you'd need to pass the code value to the KeyCharacterMap (http://developer.android.com/reference/android/view/KeyCharacterMap.html) rather than using these codes directly.
Comment 4 Masayuki Nakano 2013-02-26 05:59:17 UTC
Gary:
I'm talking about non-printable keys. Looks like getDisplayLabel() returns null if the key is non-printable. http://developer.android.com/reference/android/view/KeyCharacterMap.html#getDisplayLabel%28int%29
Comment 5 Masayuki Nakano 2013-02-27 02:36:57 UTC
I separated following key definition to bug 21121:
I separated following key definition to bug 21120:
I separated following key definition to bug 21119:
I separated following key definition to bug 21135:
I separated following key definition to bug 21134:
I separated the game pad related keys definition to bug 21137.
Comment 8 Masayuki Nakano 2013-02-27 06:47:59 UTC
I filed bug 21139 for
And I filed bug 21083 for
Then, remaining issues here are: