コード例 #1
0
 /** 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);
   }
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 /**
  * 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);
 }
コード例 #4
0
ファイル: ImeTest.java プロジェクト: kjthegod/chromium
 @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);
 }
コード例 #5
0
 /** Restart input (finish composition and change EditorInfo, such as input type). */
 void restartInput() {
   mInputMethodManagerWrapper.restartInput(mViewEmbedder.getAttachedView());
   if (mInputConnection != null) mInputConnection.onRestartInput();
 }
コード例 #6
0
 @CalledByNative
 private void cancelComposition() {
   if (mInputConnection != null) {
     mInputConnection.restartInput();
   }
 }
コード例 #7
0
 public boolean isActive() {
   return mInputConnection != null && mInputConnection.isActive();
 }