Skip to content

Commit a98441b

Browse files
committed
update fastinput_ime to adbKeyboard
1 parent 0c4780c commit a98441b

File tree

6 files changed

+186
-149
lines changed

6 files changed

+186
-149
lines changed

README.md

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,41 +62,67 @@ Clipboard, Thanks to @fplust
6262
- https://github.com/appium/io.appium.settings/blob/5d3bc99ff35f3b816b4342395aba1bdea82ad48f/app/src/main/java/io/appium/settings/receivers/ClipboardReceiver.java
6363

6464
# The buildin input method
65-
**Fast input method**
65+
**com.github.uiautomator/.AdbKeyboard**
6666

6767
Encode the text into UTF-8 and then Base64
6868

6969
For example:
7070

7171
"Hello 你好" -> (UTF-8 && Base64) = SGVsbG8g5L2g5aW9
7272

73-
Send to FastInputIME with broadcast
73+
Send to AdbKeyboard with broadcast
7474

75+
> Broadcast completed: result=-1 means success
7576
```bash
77+
# show ime list
78+
$ adb shell ime list -s -a
79+
com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME
80+
com.google.android.tts/com.google.android.apps.speech.tts.googletts.settings.asr.voiceime.VoiceInputMethodService
81+
com.github.uiautomator/.AdbKeyboard
82+
83+
# enable and set ime
84+
$ adb shell ime enable com.github.uiautomator/.AdbKeyboard
85+
$ adb shell settings put secure default_input_method com.github.uiautomator/.AdbKeyboard
86+
7687
# Append text to input field
77-
$ adb shell am broadcast -a ADB_INPUT_TEXT --es text SGVsbG8g5L2g5aW9
88+
$ adb shell am broadcast -a ADB_KEYBOARD_INPUT_TEXT --es text SGVsbG8g5L2g5aW9
89+
Broadcasting: Intent { act=ADB_KEYBOARD_INPUT_TEXT flg=0x400000 (has extras) }
90+
Broadcast completed: result=-1
7891

7992
# Clear text
80-
$ adb shell am broadcast -a ADB_CLEAR_TEXT
93+
$ adb shell am broadcast -a ADB_KEYBOARD_CLEAR_TEXT
94+
Broadcasting: Intent { act=ADB_KEYBOARD_CLEAR_TEXT flg=0x400000 }
95+
Broadcast completed: result=-1
8196

8297
# Clear text before append text
83-
$ adb shell am broadcast -a ADB_SET_TEXT --es text SGVsbG8g5L2g5aW9
98+
$ adb shell am broadcast -a ADB_KEYBOARD_SET_TEXT --es text SGVsbG8g5L2g5aW9
99+
Broadcasting: Intent { act=ADB_KEYBOARD_SET_TEXT flg=0x400000 (has extras) }
100+
Broadcast completed: result=-1
84101

85-
# Send keycode, eg: ENTER
86-
$ adb shell am broadcast -a ADB_INPUT_KEYCODE --ei code 66
102+
# Send Keycode or Editor code according to the InputEditor requires
103+
$ adb shell am broadcast -a ADB_KEYBOARD_SMART_ENTER
104+
Broadcasting: Intent { act=ADB_KEYBOARD_SMART_ENTER flg=0x400000 }
105+
Broadcast completed: result=-1
87106

88-
# Send Editor code
89-
$ adb shell am broadcast -a ADB_EDITOR_CODE --ei code 2 # IME_ACTION_GO
107+
# Send keycode, eg: ENTER
108+
$ adb shell am broadcast -a ADB_KEYBOARD_INPUT_KEYCODE --ei code 66
109+
# Send Editor code, eg: 2
110+
$ adb shell am broadcast -a ADB_KEYBOARD_EDITOR_CODE --ei code 2 # IME_ACTION_GO
90111

91112
# Get clipboard (without data)
92-
$ adb shell am broadcast -a ADB_GET_CLIPBOARD
113+
$ adb shell am broadcast -a ADB_KEYBOARD_GET_CLIPBOARD
93114
Broadcasting: Intent { act=ADB_GET_CLIPBOARD flg=0x400000 }
94115
Broadcast completed: result=0
95116

96117
# Get clipboard (with data, base64 encoded)
97-
$ adb shell am broadcast -a ADB_GET_CLIPBOARD
118+
$ adb shell am broadcast -a ADB_GET_KEYBOARD_CLIPBOARD
98119
Broadcasting: Intent { act=ADB_GET_CLIPBOARD flg=0x400000 }
99120
Broadcast completed: result=-1, data="5LqG6Kej5Lyg57uf5paH5YyW"
121+
122+
# show keyboard
123+
$ adb shell am broadcast -a ADB_KEYBOARD_HIDE
124+
# hide keyboard
125+
$ adb shell am broadcast -a ADB_KEYBOARD_SHOW
100126
```
101127
102128
- [Editor Code](https://developer.android.com/reference/android/view/inputmethod/EditorInfo)

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@
9191
</service>
9292

9393
<service
94-
android:name=".FastInputIME"
94+
android:name=".AdbKeyboard"
9595
android:exported="true"
96-
android:label="@string/fast_input_label"
96+
android:label="@string/adb_keyboard_label"
9797
android:permission="android.permission.BIND_INPUT_METHOD">
9898
<intent-filter>
9999
<action android:name="android.view.InputMethod" />

0 commit comments

Comments
 (0)