/** Move cursor to the end of the current selection. */ public void moveCursorToSelectionEnd() { Log.d(TAG, "movecursorToEnd"); if (mInputConnection != null) { int selectionEnd = Selection.getSelectionEnd(mEditable); mInputConnection.setSelection(selectionEnd, selectionEnd); } }
public boolean dispatchKeyEvent(KeyEvent event) { Log.d( TAG, "dispatchKeyEvent: action [%d], keycode [%d]", event.getAction(), event.getKeyCode()); if (mInputConnection != null) { return mInputConnection.sendKeyEvent(event); } return sendKeyEvent(event); }
/** * Updates internal representation of the text being edited and its selection and composition * properties. * * @param text The String contents of the field being edited. * @param selectionStart The character offset of the selection start, or the caret position if * there is no selection. * @param selectionEnd The character offset of the selection end, or the caret position if there * is no selection. * @param compositionStart The character offset of the composition start, or -1 if there is no * composition. * @param compositionEnd The character offset of the composition end, or -1 if there is no * selection. * @param isNonImeChange True when the update was caused by non-IME (e.g. Javascript). */ public void updateState( String text, int selectionStart, int selectionEnd, int compositionStart, int compositionEnd, boolean isNonImeChange) { if (mInputConnection == null) return; mInputConnection.updateState( text, selectionStart, selectionEnd, compositionStart, compositionEnd, isNonImeChange); }
@Override public void updateState( String text, int selectionStart, int selectionEnd, int compositionStart, int compositionEnd, boolean requiredAck) { mImeUpdateQueue.add( new TestImeState(text, selectionStart, selectionEnd, compositionStart, compositionEnd)); super.updateState( text, selectionStart, selectionEnd, compositionStart, compositionEnd, requiredAck); }
/** Restart input (finish composition and change EditorInfo, such as input type). */ void restartInput() { mInputMethodManagerWrapper.restartInput(mViewEmbedder.getAttachedView()); if (mInputConnection != null) mInputConnection.onRestartInput(); }
@CalledByNative private void cancelComposition() { if (mInputConnection != null) { mInputConnection.restartInput(); } }
public boolean isActive() { return mInputConnection != null && mInputConnection.isActive(); }