@Override
 public void onText(@Nullable CharSequence text) {
   final InputConnection ic = getCurrentInputConnection();
   ic.beginBatchEdit();
   commitTyped();
   commitText(ic, text, 0);
   ic.endBatchEdit();
 }
Esempio n. 2
0
 @Override
 public void onText(CharSequence text) {
   InputConnection ic = mService.getCurrentInputConnection();
   if (ic == null) return;
   ic.beginBatchEdit();
   ic.commitText(text, 1);
   ic.endBatchEdit();
 }
Esempio n. 3
0
 public void onText(CharSequence text) {
   InputConnection ic = getCurrentInputConnection();
   if (ic == null) return;
   ic.beginBatchEdit();
   if (mComposing.length() > 0) {
     commitTyped(ic);
   }
   ic.commitText(text, 0);
   ic.endBatchEdit();
   updateShiftKeyState(getCurrentInputEditorInfo());
 }
 boolean setText(String text) {
   // FIXME: need feedback if the input was lost
   InputConnection conn = getCurrentInputConnection();
   if (conn == null) {
     //      Debug.d("connection closed");
     return false;
   }
   conn.beginBatchEdit();
   // FIXME: hack
   conn.deleteSurroundingText(100000, 100000);
   conn.commitText(text, text.length());
   conn.endBatchEdit();
   return true;
 }
Esempio n. 5
0
 /** Commits the given text to the editing field. */
 public boolean commitText(InputConnection ic, CharSequence text) {
   if (ic != null) {
     if (text.length() > 1) {
       // Batch edit a sequence of characters.
       ic.beginBatchEdit();
       ic.commitText(text, 1);
       ic.endBatchEdit();
     } else {
       ic.commitText(text, 1);
     }
     // Composing-text in the editor has been cleared.
     composingText.setLength(0);
     return true;
   }
   return false;
 }