-
Notifications
You must be signed in to change notification settings - Fork 85
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
[FR]: bluetooth keyboard support #338
Comments
Some context first. NativeActivities are meant mostly for games. There's a native api to deal with input which covers most of the
The problem here is: if we try to call that method from our keyevent handler using JNI our main thread will be blocked until that function returns. 99% of that time will be caused by the JNI overhead. IIRC there's a way to ignore keyevents on native code just by not consuming them. They will be forwarded to other parts of the activity and, if not consumed yet, to the system. We already use that to forward media keys to the system: https://github.com/koreader/koreader-base/blob/master/ffi/input_android.lua#L123-L129 In theory, for these events, you should be able to catch them with a standard KeyEvent Listener from managed code. If we're able to do that the rest should be easy:
For a proof of concept you can try to catch the keyevents we actually ignore and just print their keycodes when they arrive. |
Here's something interesting. I've been using https://www.8bitdo.com/micro/ as remote controller for KOReader mainly just to turn pages forward and backward (you can map its keys to most normal physical keyboard keycodes) with left arrow/right arrow, which work fine (up/down arrow too). I was trying to find a way to map the Android 'back button' to a keycode to back out of menus / go back in location history, but eventually realized that the Escape key mapping probably doesn't work because Android bluetooth keyboards aren't supported yet. However, other keybindings are working: j,k,h,enter. h invokes the black crosshair cursor (which I don't know how to disable thereafter), j and k both do something to toggle hiding and showing the rendered page (but the status bar remains visible), and Enter shows the lower menu. So somehow this is already partially working? |
That's not us
That also doesn't feel like us, unless something is going very screwy somewhere.
That, at least, is probably us, as Enter is bound to toggle menus on keyboards IIRC. |
True, but does that mean controllers map regular back and enter on Android? |
Yup, bluetooth remote controllers are very well supported on android. You can remap any key even from within KOReader, following https://github.com/koreader/koreader/wiki/Android-tips-and-tricks#customize-keys What's left unimplemented is the translation of key events (with optional key modifiers) to text, like it happens on SDL targets. |
On the contrary, it's brand spanking new. ;-) |
@pazos Could you elaborate on this point? I'd like support for a bluetooth keyboard on android. Let me know if I should open a new issue for bluetooth keyboard support to talk about this.
Originally posted by @beelzebielsk in koreader/koreader#7423 (comment)
The text was updated successfully, but these errors were encountered: