|
|
@@ -54,8 +54,17 @@ class InputMethodUtil private constructor() {
|
|
|
|
|
|
/**
|
|
|
* 自定义键盘,点击输入法的按键,输入指定的文本
|
|
|
+ *
|
|
|
+ * @param isNeedClear 是否需要清空原有的内容
|
|
|
*/
|
|
|
- fun inputText(currentInputConnection: InputConnection, text: String) {
|
|
|
+ fun inputText(
|
|
|
+ currentInputConnection: InputConnection,
|
|
|
+ text: String,
|
|
|
+ isNeedClear: Boolean = true
|
|
|
+ ) {
|
|
|
+ if (isNeedClear) {
|
|
|
+ clearInput(currentInputConnection)
|
|
|
+ }
|
|
|
currentInputConnection.commitText(text, 1)
|
|
|
}
|
|
|
|