Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
FakeKeyEvent.java
Go to the documentation of this file.
1package io.flutter.util;
2
3import android.view.KeyEvent;
4
5// In the test environment, keyEvent.getUnicodeChar throws an exception. This
6// class works around the exception by hardcoding the returned value.
7public class FakeKeyEvent extends KeyEvent {
8 public FakeKeyEvent(int action, int keyCode) {
9 super(action, keyCode);
10 }
11
12 public FakeKeyEvent(int action, int keyCode, char character) {
13 super(action, keyCode);
14 this.character = character;
15 }
16
18 int action, int scancode, int code, int repeat, char character, int metaState) {
19 super(0, 0, action, code, repeat, metaState, 0, scancode);
20 this.character = character;
21 }
22
23 private char character = 0;
24
25 public final int getUnicodeChar() {
26 if (getKeyCode() == KeyEvent.KEYCODE_BACK) {
27 return 0;
28 }
29 return character;
30 }
31}
static unsigned repeat(SkFixed fx, int max)
FakeKeyEvent(int action, int keyCode, char character)
FakeKeyEvent(int action, int keyCode)
FakeKeyEvent(int action, int scancode, int code, int repeat, char character, int metaState)