public class TInputConnection
extends android.view.inputmethod.InputConnectionWrapper
| Modifier and Type | Class and Description |
|---|---|
static interface |
TInputConnection.BackspaceListener |
| Constructor and Description |
|---|
TInputConnection(android.view.inputmethod.InputConnection target,
boolean mutable)
Initializes a wrapper.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
deleteSurroundingText(int beforeLength,
int afterLength)
当软键盘删除文本之前,会调用这个方法通知输入框,我们可以重写这个方法并判断是否要拦截这个删除事件。
在谷歌输入法上,点击退格键的时候不会调用
sendKeyEvent(KeyEvent event),
而是直接回调这个方法,所以也要在这个方法上做拦截; |
boolean |
sendKeyEvent(android.view.KeyEvent event)
当在软件盘上点击某些按钮(比如退格键,数字键,回车键等),该方法可能会被触发(取决于输入法的开发者),
所以也可以重写该方法并拦截这些事件,这些事件就不会被分发到输入框了
|
void |
setBackspaceListener(TInputConnection.BackspaceListener backspaceListener) |
beginBatchEdit, clearMetaKeyStates, closeConnection, commitCompletion, commitContent, commitCorrection, commitText, deleteSurroundingTextInCodePoints, endBatchEdit, finishComposingText, getCursorCapsMode, getExtractedText, getHandler, getSelectedText, getTextAfterCursor, getTextBeforeCursor, performContextMenuAction, performEditorAction, performPrivateCommand, reportFullscreenMode, requestCursorUpdates, setComposingRegion, setComposingText, setSelection, setTargetpublic TInputConnection(android.view.inputmethod.InputConnection target,
boolean mutable)
Caveat: Although the system can accept (InputConnection) null in some
places, you cannot emulate such a behavior by non-null InputConnectionWrapper that
has null in target.
target - the InputConnection to be proxied.mutable - set true to protect this object from being reconfigured to target
another InputConnection. Note that this is ignored while the target is null.public boolean deleteSurroundingText(int beforeLength,
int afterLength)
sendKeyEvent(KeyEvent event),
而是直接回调这个方法,所以也要在这个方法上做拦截;deleteSurroundingText in interface android.view.inputmethod.InputConnectiondeleteSurroundingText in class android.view.inputmethod.InputConnectionWrapperpublic void setBackspaceListener(TInputConnection.BackspaceListener backspaceListener)
public boolean sendKeyEvent(android.view.KeyEvent event)
sendKeyEvent in interface android.view.inputmethod.InputConnectionsendKeyEvent in class android.view.inputmethod.InputConnectionWrapper