feat: map mode and translate mode receive side
This commit is contained in:
parent
22165ec1a5
commit
b3e2ab0f3b
4 changed files with 61 additions and 12 deletions
|
|
@ -307,7 +307,7 @@ class InputService : AccessibilityService() {
|
|||
|
||||
} else {
|
||||
KeyEventConverter.toAndroidKeyEvent(keyEvent).let { event ->
|
||||
Log.d(logTag, "event $event text $text start $textSelectionStar end $textSelectionEnd")
|
||||
Log.d(logTag, "event $event text $text start $textSelectionStart end $textSelectionEnd")
|
||||
if (isShowingHint) {
|
||||
this.fakeEditTextForTextStateCalculation?.setText(null)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package hbb;
|
||||
import android.view.KeyEvent
|
||||
import android.view.KeyCharacterMap
|
||||
import hbb.MessageOuterClass.KeyboardMode
|
||||
import hbb.MessageOuterClass.ControlKey
|
||||
|
||||
object KeyEventConverter {
|
||||
|
|
@ -10,12 +11,14 @@ object KeyEventConverter {
|
|||
|
||||
android.util.Log.d(tag, "proto: $keyEventProto")
|
||||
|
||||
if (keyEventProto.hasUnicode()) {
|
||||
chrValue =
|
||||
}
|
||||
val keyboardMode = keyEventProto.getMode()
|
||||
|
||||
if (keyEventProto.hasChr()) {
|
||||
chrValue = convertUnicodeToKeyCode(keyEventProto.getChr() as Int)
|
||||
if (keyboardMode == KeyboardMode.Map || keyboardMode == KeyboardMode.Translate) {
|
||||
chrValue = keyEventProto.getChr()
|
||||
} else {
|
||||
chrValue = convertUnicodeToKeyCode(keyEventProto.getChr() as Int)
|
||||
}
|
||||
} else if (keyEventProto.hasControlKey()) {
|
||||
chrValue = convertControlKeyToKeyCode(keyEventProto.getControlKey())
|
||||
}
|
||||
|
|
@ -29,6 +32,8 @@ object KeyEventConverter {
|
|||
}
|
||||
}
|
||||
|
||||
android.util.Log.d(tag, "modifiers: $modifiersList")
|
||||
|
||||
var action = 0
|
||||
if (keyEventProto.getDown()) {
|
||||
action = KeyEvent.ACTION_DOWN
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue