Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Hardware Keyboard/Back Button Support #869

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

skylersaleh
Copy link

@skylersaleh skylersaleh commented Aug 15, 2023

These changes allow Android apps to receive an event for a back button press and respond to it themselves (including consuming it for their navigation purposes and exiting the application) and allows Android HW keyboards to function just like the Windows/macOS/Linux keyboards.

Overview of the changes:

  • Add SAPP keycode for the Android Back Button
  • Implement KEY_DOWN/KEY_UP/CHAR events with repeat support
  • Implemented quit_requested/quit_ordered so that sapp_request_quit() works

- Add SAPP keycode for the Android Back Button
- Implement KEY_DOWN/KEY_UP/CHAR events with repeat support
- Implemented quit_requested/quit_ordered so that sapp_request_quit() works

These changes allows Android app to recieve an action for a back button press and respond to it themselves (including navigation and exiting the application) and allows Android HW keyboards to function just like the Windows/macOS/Linux keyboards.
@skylersaleh skylersaleh marked this pull request as draft August 15, 2023 04:52
@skylersaleh skylersaleh marked this pull request as ready for review August 15, 2023 05:06
@floooh
Copy link
Owner

floooh commented Aug 15, 2023

I have a couple of nitpicks, but first, do you know if I can test the hardware keyboard support somehow with my Android phone (e.g. can I attach a USB keyboard for testing?)

Copy link
Owner

@floooh floooh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of formatting things to take care of.

Please also check the errors CI (sign-conversion warning - yes the CI pipeline settings are very picky), and SOKOL_LOG has been replaced, but I guess you can just remove all logs unless they are actual warnings and errors.

sokol_app.h Outdated Show resolved Hide resolved
sokol_app.h Outdated Show resolved Hide resolved
sokol_app.h Outdated Show resolved Hide resolved
sokol_app.h Outdated Show resolved Hide resolved
sokol_app.h Outdated Show resolved Hide resolved
sokol_app.h Outdated Show resolved Hide resolved
sokol_app.h Outdated Show resolved Hide resolved
sokol_app.h Outdated Show resolved Hide resolved
sokol_app.h Outdated Show resolved Hide resolved
sokol_app.h Show resolved Hide resolved
@skylersaleh
Copy link
Author

I have a couple of nitpicks, but first, do you know if I can test the hardware keyboard support somehow with my Android phone (e.g. can I attach a USB keyboard for testing?)

Not sure, but the Android Emulator in Android Studio relays the computer keyboard input as Android hardware keyboard events.

I'll also work through those recommended changes later tonight.

@skylersaleh
Copy link
Author

skylersaleh commented Aug 15, 2023

I was also wondering, do you want me to wire up all the android specific keycodes to new sokol scan codes (tv remotes, gamepad keys, etc), or just keep to the minimal set here.

@floooh
Copy link
Owner

floooh commented Aug 16, 2023

do you want me to wire up all the android specific keycodes to new sokol scan codes

If it's just a handful or so and you think it's a good idea to do so, feel free to add those as SAPP_KEYCODE_ANDROID_* (thinking about it, it's probably also a good idea to rename the new keycode to SAPP_KEYCODE_ANDROID_BACK).

@floooh
Copy link
Owner

floooh commented Aug 16, 2023

Also please have a look at the 'new' errors in CI, there's some problem when compiling as C++, those JNI calls may need some #ifdef __cplusplus wrapper magic like I did for D3D11 calls in sokol_gfx.h:

sokol/sokol_gfx.h

Lines 8376 to 8390 in 47d92ff

static inline HRESULT _sg_d3d11_CheckFormatSupport(ID3D11Device* self, DXGI_FORMAT Format, UINT* pFormatSupport) {
#if defined(__cplusplus)
return self->CheckFormatSupport(Format, pFormatSupport);
#else
return self->lpVtbl->CheckFormatSupport(self, Format, pFormatSupport);
#endif
}
static inline void _sg_d3d11_OMSetRenderTargets(ID3D11DeviceContext* self, UINT NumViews, ID3D11RenderTargetView* const* ppRenderTargetViews, ID3D11DepthStencilView *pDepthStencilView) {
#if defined(__cplusplus)
self->OMSetRenderTargets(NumViews, ppRenderTargetViews, pDepthStencilView);
#else
self->lpVtbl->OMSetRenderTargets(self, NumViews, ppRenderTargetViews, pDepthStencilView);
#endif
}

PS: I mean the errors in here:

https://github.com/floooh/sokol/actions/runs/5876724894/job/15942332488?pr=869

...ignore the Odin-related issue in that other CI job, don't know yet what's up with that, but it's definitely not related to your PR.

@skylersaleh
Copy link
Author

skylersaleh commented Aug 16, 2023

do you want me to wire up all the android specific keycodes to new sokol scan codes

If it's just a handful or so and you think it's a good idea to do so, feel free to add those as SAPP_KEYCODE_ANDROID_* (thinking about it, it's probably also a good idea to rename the new keycode to SAPP_KEYCODE_ANDROID_BACK).

Its going to be quite a few if we want to cover the complete android keyset, take a look at this switch statement below to see what the full list looks like.

const char* se_android_key_to_name(int key){
  switch(key){
    case AKEYCODE_UNKNOWN:                        return "UNKNOWN";
    case AKEYCODE_SOFT_LEFT:                      return "SOFT_LEFT";
    case AKEYCODE_SOFT_RIGHT:                     return "SOFT_RIGHT";
    case AKEYCODE_HOME:                           return "HOME";
    case AKEYCODE_BACK:                           return "BACK";
    case AKEYCODE_CALL:                           return "CALL";
    case AKEYCODE_ENDCALL:                        return "ENDCALL";
    case AKEYCODE_0:                              return "0";
    case AKEYCODE_1:                              return "1";
    case AKEYCODE_2:                              return "2";
    case AKEYCODE_3:                              return "3";
    case AKEYCODE_4:                              return "4";
    case AKEYCODE_5:                              return "5";
    case AKEYCODE_6:                              return "6";
    case AKEYCODE_7:                              return "7";
    case AKEYCODE_8:                              return "8";
    case AKEYCODE_9:                              return "9";
    case AKEYCODE_STAR:                           return "STAR";
    case AKEYCODE_POUND:                          return "POUND";
    case AKEYCODE_DPAD_UP:                        return "DPAD_UP";
    case AKEYCODE_DPAD_DOWN:                      return "DPAD_DOWN";
    case AKEYCODE_DPAD_LEFT:                      return "DPAD_LEFT";
    case AKEYCODE_DPAD_RIGHT:                     return "DPAD_RIGHT";
    case AKEYCODE_DPAD_CENTER:                    return "DPAD_CENTER";
    case AKEYCODE_VOLUME_UP:                      return "VOLUME_UP";
    case AKEYCODE_VOLUME_DOWN:                    return "VOLUME_DOWN";
    case AKEYCODE_POWER:                          return "POWER";
    case AKEYCODE_CAMERA:                         return "CAMERA";
    case AKEYCODE_CLEAR:                          return "CLEAR";
    case AKEYCODE_A:                              return "A";
    case AKEYCODE_B:                              return "B";
    case AKEYCODE_C:                              return "C";
    case AKEYCODE_D:                              return "D";
    case AKEYCODE_E:                              return "E";
    case AKEYCODE_F:                              return "F";
    case AKEYCODE_G:                              return "G";
    case AKEYCODE_H:                              return "H";
    case AKEYCODE_I:                              return "I";
    case AKEYCODE_J:                              return "J";
    case AKEYCODE_K:                              return "K";
    case AKEYCODE_L:                              return "L";
    case AKEYCODE_M:                              return "M";
    case AKEYCODE_N:                              return "N";
    case AKEYCODE_O:                              return "O";
    case AKEYCODE_P:                              return "P";
    case AKEYCODE_Q:                              return "Q";
    case AKEYCODE_R:                              return "R";
    case AKEYCODE_S:                              return "S";
    case AKEYCODE_T:                              return "T";
    case AKEYCODE_U:                              return "U";
    case AKEYCODE_V:                              return "V";
    case AKEYCODE_W:                              return "W";
    case AKEYCODE_X:                              return "X";
    case AKEYCODE_Y:                              return "Y";
    case AKEYCODE_Z:                              return "Z";
    case AKEYCODE_COMMA:                          return "COMMA";
    case AKEYCODE_PERIOD:                         return "PERIOD";
    case AKEYCODE_ALT_LEFT:                       return "ALT_LEFT";
    case AKEYCODE_ALT_RIGHT:                      return "ALT_RIGHT";
    case AKEYCODE_SHIFT_LEFT:                     return "SHIFT_LEFT";
    case AKEYCODE_SHIFT_RIGHT:                    return "SHIFT_RIGHT";
    case AKEYCODE_TAB:                            return "TAB";
    case AKEYCODE_SPACE:                          return "SPACE";
    case AKEYCODE_SYM:                            return "SYM";
    case AKEYCODE_EXPLORER:                       return "EXPLORER";
    case AKEYCODE_ENVELOPE:                       return "ENVELOPE";
    case AKEYCODE_ENTER:                          return "ENTER";
    case AKEYCODE_DEL:                            return "DEL";
    case AKEYCODE_GRAVE:                          return "GRAVE";
    case AKEYCODE_MINUS:                          return "MINUS";
    case AKEYCODE_EQUALS:                         return "EQUALS";
    case AKEYCODE_LEFT_BRACKET:                   return "LEFT_BRACKET";
    case AKEYCODE_RIGHT_BRACKET:                  return "RIGHT_BRACKET";
    case AKEYCODE_BACKSLASH:                      return "BACKSLASH";
    case AKEYCODE_SEMICOLON:                      return "SEMICOLON";
    case AKEYCODE_APOSTROPHE:                     return "APOSTROPHE";
    case AKEYCODE_SLASH:                          return "SLASH";
    case AKEYCODE_AT:                             return "AT";
    case AKEYCODE_NUM:                            return "NUM";
    case AKEYCODE_HEADSETHOOK:                    return "HEADSETHOOK";
    case AKEYCODE_FOCUS:                          return "FOCUS";
    case AKEYCODE_PLUS:                           return "PLUS";
    case AKEYCODE_MENU:                           return "MENU";
    case AKEYCODE_NOTIFICATION:                   return "NOTIFICATION";
    case AKEYCODE_SEARCH:                         return "SEARCH";
    case AKEYCODE_MEDIA_PLAY_PAUSE:               return "MEDIA_PLAY_PAUSE";
    case AKEYCODE_MEDIA_STOP:                     return "MEDIA_STOP";
    case AKEYCODE_MEDIA_NEXT:                     return "MEDIA_NEXT";
    case AKEYCODE_MEDIA_PREVIOUS:                 return "MEDIA_PREVIOUS";
    case AKEYCODE_MEDIA_REWIND:                   return "MEDIA_REWIND";
    case AKEYCODE_MEDIA_FAST_FORWARD:             return "MEDIA_FAST_FORWARD";
    case AKEYCODE_MUTE:                           return "MUTE";
    case AKEYCODE_PAGE_UP:                        return "PAGE_UP";
    case AKEYCODE_PAGE_DOWN:                      return "PAGE_DOWN";
    case AKEYCODE_PICTSYMBOLS:                    return "PICTSYMBOLS";
    case AKEYCODE_SWITCH_CHARSET:                 return "SWITCH_CHARSET";
    case AKEYCODE_BUTTON_A:                       return "BUTTON_A";
    case AKEYCODE_BUTTON_B:                       return "BUTTON_B";
    case AKEYCODE_BUTTON_C:                       return "BUTTON_C";
    case AKEYCODE_BUTTON_X:                       return "BUTTON_X";
    case AKEYCODE_BUTTON_Y:                       return "BUTTON_Y";
    case AKEYCODE_BUTTON_Z:                       return "BUTTON_Z";
    case AKEYCODE_BUTTON_L1:                      return "BUTTON_L1";
    case AKEYCODE_BUTTON_R1:                      return "BUTTON_R1";
    case AKEYCODE_BUTTON_L2:                      return "BUTTON_L2";
    case AKEYCODE_BUTTON_R2:                      return "BUTTON_R2";
    case AKEYCODE_BUTTON_THUMBL:                  return "BUTTON_THUMBL";
    case AKEYCODE_BUTTON_THUMBR:                  return "BUTTON_THUMBR";
    case AKEYCODE_BUTTON_START:                   return "BUTTON_START";
    case AKEYCODE_BUTTON_SELECT:                  return "BUTTON_SELECT";
    case AKEYCODE_BUTTON_MODE:                    return "BUTTON_MODE";
    case AKEYCODE_ESCAPE:                         return "ESCAPE";
    case AKEYCODE_FORWARD_DEL:                    return "FORWARD_DEL";
    case AKEYCODE_CTRL_LEFT:                      return "CTRL_LEFT";
    case AKEYCODE_CTRL_RIGHT:                     return "CTRL_RIGHT";
    case AKEYCODE_CAPS_LOCK:                      return "CAPS_LOCK";
    case AKEYCODE_SCROLL_LOCK:                    return "SCROLL_LOCK";
    case AKEYCODE_META_LEFT:                      return "META_LEFT";
    case AKEYCODE_META_RIGHT:                     return "META_RIGHT";
    case AKEYCODE_FUNCTION:                       return "FUNCTION";
    case AKEYCODE_SYSRQ:                          return "SYSRQ";
    case AKEYCODE_BREAK:                          return "BREAK";
    case AKEYCODE_MOVE_HOME:                      return "MOVE_HOME";
    case AKEYCODE_MOVE_END:                       return "MOVE_END";
    case AKEYCODE_INSERT:                         return "INSERT";
    case AKEYCODE_FORWARD:                        return "FORWARD";
    case AKEYCODE_MEDIA_PLAY:                     return "MEDIA_PLAY";
    case AKEYCODE_MEDIA_PAUSE:                    return "MEDIA_PAUSE";
    case AKEYCODE_MEDIA_CLOSE:                    return "MEDIA_CLOSE";
    case AKEYCODE_MEDIA_EJECT:                    return "MEDIA_EJECT";
    case AKEYCODE_MEDIA_RECORD:                   return "MEDIA_RECORD";
    case AKEYCODE_F1:                             return "F1";
    case AKEYCODE_F2:                             return "F2";
    case AKEYCODE_F3:                             return "F3";
    case AKEYCODE_F4:                             return "F4";
    case AKEYCODE_F5:                             return "F5";
    case AKEYCODE_F6:                             return "F6";
    case AKEYCODE_F7:                             return "F7";
    case AKEYCODE_F8:                             return "F8";
    case AKEYCODE_F9:                             return "F9";
    case AKEYCODE_F10:                            return "F10";
    case AKEYCODE_F11:                            return "F11";
    case AKEYCODE_F12:                            return "F12";
    case AKEYCODE_NUM_LOCK:                       return "NUM_LOCK";
    case AKEYCODE_NUMPAD_0:                       return "NUMPAD_0";
    case AKEYCODE_NUMPAD_1:                       return "NUMPAD_1";
    case AKEYCODE_NUMPAD_2:                       return "NUMPAD_2";
    case AKEYCODE_NUMPAD_3:                       return "NUMPAD_3";
    case AKEYCODE_NUMPAD_4:                       return "NUMPAD_4";
    case AKEYCODE_NUMPAD_5:                       return "NUMPAD_5";
    case AKEYCODE_NUMPAD_6:                       return "NUMPAD_6";
    case AKEYCODE_NUMPAD_7:                       return "NUMPAD_7";
    case AKEYCODE_NUMPAD_8:                       return "NUMPAD_8";
    case AKEYCODE_NUMPAD_9:                       return "NUMPAD_9";
    case AKEYCODE_NUMPAD_DIVIDE:                  return "NUMPAD_DIVIDE";
    case AKEYCODE_NUMPAD_MULTIPLY:                return "NUMPAD_MULTIPLY";
    case AKEYCODE_NUMPAD_SUBTRACT:                return "NUMPAD_SUBTRACT";
    case AKEYCODE_NUMPAD_ADD:                     return "NUMPAD_ADD";
    case AKEYCODE_NUMPAD_DOT:                     return "NUMPAD_DOT";
    case AKEYCODE_NUMPAD_COMMA:                   return "NUMPAD_COMMA";
    case AKEYCODE_NUMPAD_ENTER:                   return "NUMPAD_ENTER";
    case AKEYCODE_NUMPAD_EQUALS:                  return "NUMPAD_EQUALS";
    case AKEYCODE_NUMPAD_LEFT_PAREN:              return "NUMPAD_LEFT_PAREN";
    case AKEYCODE_NUMPAD_RIGHT_PAREN:             return "NUMPAD_RIGHT_PAREN";
    case AKEYCODE_VOLUME_MUTE:                    return "VOLUME_MUTE";
    case AKEYCODE_INFO:                           return "INFO";
    case AKEYCODE_CHANNEL_UP:                     return "CHANNEL_UP";
    case AKEYCODE_CHANNEL_DOWN:                   return "CHANNEL_DOWN";
    case AKEYCODE_ZOOM_IN:                        return "ZOOM_IN";
    case AKEYCODE_ZOOM_OUT:                       return "ZOOM_OUT";
    case AKEYCODE_TV:                             return "TV";
    case AKEYCODE_WINDOW:                         return "WINDOW";
    case AKEYCODE_GUIDE:                          return "GUIDE";
    case AKEYCODE_DVR:                            return "DVR";
    case AKEYCODE_BOOKMARK:                       return "BOOKMARK";
    case AKEYCODE_CAPTIONS:                       return "CAPTIONS";
    case AKEYCODE_SETTINGS:                       return "SETTINGS";
    case AKEYCODE_TV_POWER:                       return "TV_POWER";
    case AKEYCODE_TV_INPUT:                       return "TV_INPUT";
    case AKEYCODE_STB_POWER:                      return "STB_POWER";
    case AKEYCODE_STB_INPUT:                      return "STB_INPUT";
    case AKEYCODE_AVR_POWER:                      return "AVR_POWER";
    case AKEYCODE_AVR_INPUT:                      return "AVR_INPUT";
    case AKEYCODE_PROG_RED:                       return "PROG_RED";
    case AKEYCODE_PROG_GREEN:                     return "PROG_GREEN";
    case AKEYCODE_PROG_YELLOW:                    return "PROG_YELLOW";
    case AKEYCODE_PROG_BLUE:                      return "PROG_BLUE";
    case AKEYCODE_APP_SWITCH:                     return "APP_SWITCH";
    case AKEYCODE_BUTTON_1:                       return "BUTTON_1";
    case AKEYCODE_BUTTON_2:                       return "BUTTON_2";
    case AKEYCODE_BUTTON_3:                       return "BUTTON_3";
    case AKEYCODE_BUTTON_4:                       return "BUTTON_4";
    case AKEYCODE_BUTTON_5:                       return "BUTTON_5";
    case AKEYCODE_BUTTON_6:                       return "BUTTON_6";
    case AKEYCODE_BUTTON_7:                       return "BUTTON_7";
    case AKEYCODE_BUTTON_8:                       return "BUTTON_8";
    case AKEYCODE_BUTTON_9:                       return "BUTTON_9";
    case AKEYCODE_BUTTON_10:                      return "BUTTON_10";
    case AKEYCODE_BUTTON_11:                      return "BUTTON_11";
    case AKEYCODE_BUTTON_12:                      return "BUTTON_12";
    case AKEYCODE_BUTTON_13:                      return "BUTTON_13";
    case AKEYCODE_BUTTON_14:                      return "BUTTON_14";
    case AKEYCODE_BUTTON_15:                      return "BUTTON_15";
    case AKEYCODE_BUTTON_16:                      return "BUTTON_16";
    case AKEYCODE_LANGUAGE_SWITCH:                return "LANGUAGE_SWITCH";
    case AKEYCODE_MANNER_MODE:                    return "MANNER_MODE";
    case AKEYCODE_3D_MODE:                        return "3D_MODE";
    case AKEYCODE_CONTACTS:                       return "CONTACTS";
    case AKEYCODE_CALENDAR:                       return "CALENDAR";
    case AKEYCODE_MUSIC:                          return "MUSIC";
    case AKEYCODE_CALCULATOR:                     return "CALCULATOR";
    case AKEYCODE_ZENKAKU_HANKAKU:                return "ZENKAKU_HANKAKU";
    case AKEYCODE_EISU:                           return "EISU";
    case AKEYCODE_MUHENKAN:                       return "MUHENKAN";
    case AKEYCODE_HENKAN:                         return "HENKAN";
    case AKEYCODE_KATAKANA_HIRAGANA:              return "KATAKANA_HIRAGANA";
    case AKEYCODE_YEN:                            return "YEN";
    case AKEYCODE_RO:                             return "RO";
    case AKEYCODE_KANA:                           return "KANA";
    case AKEYCODE_ASSIST:                         return "ASSIST";
    case AKEYCODE_BRIGHTNESS_DOWN:                return "BRIGHTNESS_DOWN";
    case AKEYCODE_BRIGHTNESS_UP:                  return "BRIGHTNESS_UP";
    case AKEYCODE_MEDIA_AUDIO_TRACK:              return "MEDIA_AUDIO_TRACK";
    case AKEYCODE_SLEEP:                          return "SLEEP";
    case AKEYCODE_WAKEUP:                         return "WAKEUP";
    case AKEYCODE_PAIRING:                        return "PAIRING";
    case AKEYCODE_MEDIA_TOP_MENU:                 return "MEDIA_TOP_MENU";
    case AKEYCODE_11:                             return "11";
    case AKEYCODE_12:                             return "12";
    case AKEYCODE_LAST_CHANNEL:                   return "LAST_CHANNEL";
    case AKEYCODE_TV_DATA_SERVICE:                return "TV_DATA_SERVICE";
    case AKEYCODE_VOICE_ASSIST:                   return "VOICE_ASSIST";
    case AKEYCODE_TV_RADIO_SERVICE:               return "TV_RADIO_SERVICE";
    case AKEYCODE_TV_TELETEXT:                    return "TV_TELETEXT";
    case AKEYCODE_TV_NUMBER_ENTRY:                return "TV_NUMBER_ENTRY";
    case AKEYCODE_TV_TERRESTRIAL_ANALOG:          return "TV_TERRESTRIAL_ANALOG";
    case AKEYCODE_TV_TERRESTRIAL_DIGITAL:         return "TV_TERRESTRIAL_DIGITAL";
    case AKEYCODE_TV_SATELLITE:                   return "TV_SATELLITE";
    case AKEYCODE_TV_SATELLITE_BS:                return "TV_SATELLITE_BS";
    case AKEYCODE_TV_SATELLITE_CS:                return "TV_SATELLITE_CS";
    case AKEYCODE_TV_SATELLITE_SERVICE:           return "TV_SATELLITE_SERVICE";
    case AKEYCODE_TV_NETWORK:                     return "TV_NETWORK";
    case AKEYCODE_TV_ANTENNA_CABLE:               return "TV_ANTENNA_CABLE";
    case AKEYCODE_TV_INPUT_HDMI_1:                return "TV_INPUT_HDMI_1";
    case AKEYCODE_TV_INPUT_HDMI_2:                return "TV_INPUT_HDMI_2";
    case AKEYCODE_TV_INPUT_HDMI_3:                return "TV_INPUT_HDMI_3";
    case AKEYCODE_TV_INPUT_HDMI_4:                return "TV_INPUT_HDMI_4";
    case AKEYCODE_TV_INPUT_COMPOSITE_1:           return "TV_INPUT_COMPOSITE_1";
    case AKEYCODE_TV_INPUT_COMPOSITE_2:           return "TV_INPUT_COMPOSITE_2";
    case AKEYCODE_TV_INPUT_COMPONENT_1:           return "TV_INPUT_COMPONENT_1";
    case AKEYCODE_TV_INPUT_COMPONENT_2:           return "TV_INPUT_COMPONENT_2";
    case AKEYCODE_TV_INPUT_VGA_1:                 return "TV_INPUT_VGA_1";
    case AKEYCODE_TV_AUDIO_DESCRIPTION:           return "TV_AUDIO_DESCRIPTION";
    case AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP:    return "TV_AUDIO_DESCRIPTION_MIX_UP";
    case AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN:  return "TV_AUDIO_DESCRIPTION_MIX_DOWN";
    case AKEYCODE_TV_ZOOM_MODE:                   return "TV_ZOOM_MODE";
    case AKEYCODE_TV_CONTENTS_MENU:               return "TV_CONTENTS_MENU";
    case AKEYCODE_TV_MEDIA_CONTEXT_MENU:          return "TV_MEDIA_CONTEXT_MENU";
    case AKEYCODE_TV_TIMER_PROGRAMMING:           return "TV_TIMER_PROGRAMMING";
    case AKEYCODE_HELP:                           return "HELP";
    case AKEYCODE_NAVIGATE_PREVIOUS:              return "NAVIGATE_PREVIOUS";
    case AKEYCODE_NAVIGATE_NEXT:                  return "NAVIGATE_NEXT";
    case AKEYCODE_NAVIGATE_IN:                    return "NAVIGATE_IN";
    case AKEYCODE_NAVIGATE_OUT:                   return "NAVIGATE_OUT";
    case AKEYCODE_STEM_PRIMARY:                   return "STEM_PRIMARY";
    case AKEYCODE_STEM_1:                         return "STEM_1";
    case AKEYCODE_STEM_2:                         return "STEM_2";
    case AKEYCODE_STEM_3:                         return "STEM_3";
    case AKEYCODE_DPAD_UP_LEFT:                   return "DPAD_UP_LEFT";
    case AKEYCODE_DPAD_DOWN_LEFT:                 return "DPAD_DOWN_LEFT";
    case AKEYCODE_DPAD_UP_RIGHT:                  return "DPAD_UP_RIGHT";
    case AKEYCODE_DPAD_DOWN_RIGHT:                return "DPAD_DOWN_RIGHT";
    case AKEYCODE_MEDIA_SKIP_FORWARD:             return "MEDIA_SKIP_FORWARD";
    case AKEYCODE_MEDIA_SKIP_BACKWARD:            return "MEDIA_SKIP_BACKWARD";
    case AKEYCODE_MEDIA_STEP_FORWARD:             return "MEDIA_STEP_FORWARD";
    case AKEYCODE_MEDIA_STEP_BACKWARD:            return "MEDIA_STEP_BACKWARD";
    case AKEYCODE_SOFT_SLEEP:                     return "SOFT_SLEEP";
    case AKEYCODE_CUT:                            return "CUT";
    case AKEYCODE_COPY:                           return "COPY";
    case AKEYCODE_PASTE:                          return "PASTE";
    case AKEYCODE_SYSTEM_NAVIGATION_UP:           return "SYSTEM_NAVIGATION_UP";
    case AKEYCODE_SYSTEM_NAVIGATION_DOWN:         return "SYSTEM_NAVIGATION_DOWN";
    case AKEYCODE_SYSTEM_NAVIGATION_LEFT:         return "SYSTEM_NAVIGATION_LEFT";
    case AKEYCODE_SYSTEM_NAVIGATION_RIGHT:        return "SYSTEM_NAVIGATION_RIGHT";
    case AKEYCODE_ALL_APPS:                       return "ALL_APPS";
    case AKEYCODE_REFRESH:                        return "REFRESH";
    case AKEYCODE_THUMBS_UP:                      return "THUMBS_UP";
    case AKEYCODE_THUMBS_DOWN:                    return "THUMBS_DOWN";
    case AKEYCODE_PROFILE_SWITCH:                 return "PROFILE_SWITCH";
  }
  return NULL;
}

@floooh
Copy link
Owner

floooh commented Aug 17, 2023

Oh hmm ok, that's a lot more than I was hoping. Are there any other important keys that would make sense to support except the Back button? I was thinking up to 10 or so Android-specific keys would be ok (or we can just go with the just the Back button for now and add more on demand later).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants