@Override public void onText(@Nullable CharSequence text) { final InputConnection ic = getCurrentInputConnection(); ic.beginBatchEdit(); commitTyped(); commitText(ic, text, 0); ic.endBatchEdit(); }
@Override public void onText(CharSequence text) { InputConnection ic = mService.getCurrentInputConnection(); if (ic == null) return; ic.beginBatchEdit(); ic.commitText(text, 1); ic.endBatchEdit(); }
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; }
/** 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; }