Exemplo n.º 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);
   }
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 4
0
 @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);
 }
Exemplo n.º 5
0
 /** Restart input (finish composition and change EditorInfo, such as input type). */
 void restartInput() {
   mInputMethodManagerWrapper.restartInput(mViewEmbedder.getAttachedView());
   if (mInputConnection != null) mInputConnection.onRestartInput();
 }
Exemplo n.º 6
0
 @CalledByNative
 private void cancelComposition() {
   if (mInputConnection != null) {
     mInputConnection.restartInput();
   }
 }
Exemplo n.º 7
0
 public boolean isActive() {
   return mInputConnection != null && mInputConnection.isActive();
 }