Reputation: 63
I need to add keycode KEYCODE_ROTARY_KNOB
with an additional parameter like direction into AOSP
. the key event will be triggered by a tool.
I have defined the code wherever android mandates.
In my test application I have implemented onKeyDown
and here I receive my keycode but direction information is missing.
KeyCode.java obtain method does have to correct value of direction. I have added a getter method for getting direction.
This getDirection
is called from application "event.getDirection"
. The method is called but the value printed for direction is still 0 (unchanged).
I doubt some other module overwrites mDirection
defined in KeyEvent.java
.
Upvotes: 1
Views: 834
Reputation: 76799
use MIDI for rotary knobs; aka. Potentiometer.
this is the most common way; if wanting to control software, those with endless rotation are the best, because they one does not have to screw them, until they bypass the current value in the controlled software, but they use relative values (despite there won't be any physically noticeable minimal or maximum position). the idea with that KEYCODE_ROTARY_KNOB
has one huge problem: there can only be a single one knob - so how about, when you need a second one?
Upvotes: 0
Reputation: 2736
In KeyEvent.java it is written:
NOTE: If you add a new keycode here you must also add it to:
Also Android currently does not reserve code ranges for vendor-specific key codes. If you have new key codes to have, you MUST contribute a patch to the open source project to define those new codes. This is intended to maintain a consistent set of key code definitions across all Android devices.
Upvotes: 2