5package io.flutter.embedding.android;
8import androidx.annotation.NonNull;
9import io.flutter.embedding.engine.systemchannels.KeyEventChannel;
18 private static final String TAG =
"KeyChannelResponder";
23 private final KeyboardManager.CharacterCombiner characterCombiner =
27 this.keyEventChannel = keyEventChannel;
33 final int action = keyEvent.getAction();
34 if (
action != KeyEvent.ACTION_DOWN &&
action != KeyEvent.ACTION_UP) {
38 onKeyEventHandledCallback.onKeyEventHandled(
false);
42 final Character complexCharacter =
43 characterCombiner.applyCombiningCharacterToBaseCharacter(keyEvent.getUnicodeChar());
44 KeyEventChannel.FlutterKeyEvent flutterEvent =
47 final boolean isKeyUp =
action != KeyEvent.ACTION_DOWN;
48 keyEventChannel.sendFlutterKeyEvent(
51 (isEventHandled) -> onKeyEventHandledCallback.onKeyEventHandled(isEventHandled));
KeyChannelResponder(@NonNull KeyEventChannel keyEventChannel)
void handleEvent( @NonNull KeyEvent keyEvent, @NonNull OnKeyEventHandledCallback onKeyEventHandledCallback)