public static class EditStyledText.StyledTextInputConnection extends InputConnectionWrapper
CURSOR_UPDATE_IMMEDIATE, CURSOR_UPDATE_MONITOR, GET_EXTRACTED_TEXT_MONITOR, GET_TEXT_WITH_STYLES, INPUT_CONTENT_GRANT_READ_URI_PERMISSION
Constructor and Description |
---|
StyledTextInputConnection(InputConnection target,
EditStyledText est) |
Modifier and Type | Method and Description |
---|---|
boolean |
commitText(CharSequence text,
int newCursorPosition)
Commit text to the text box and set the new cursor position.
|
boolean |
finishComposingText()
Have the text editor finish whatever composing text is
currently active.
|
beginBatchEdit, clearMetaKeyStates, closeConnection, commitCompletion, commitContent, commitCorrection, deleteSurroundingText, deleteSurroundingTextInCodePoints, endBatchEdit, getCursorCapsMode, getExtractedText, getHandler, getMissingMethodFlags, getSelectedText, getTextAfterCursor, getTextBeforeCursor, performContextMenuAction, performEditorAction, performPrivateCommand, reportFullscreenMode, requestCursorUpdates, sendKeyEvent, setComposingRegion, setComposingText, setSelection, setTarget
public StyledTextInputConnection(InputConnection target, EditStyledText est)
public boolean commitText(CharSequence text, int newCursorPosition)
InputConnectionWrapper
This method removes the contents of the currently composing
text and replaces it with the passed CharSequence, and then
moves the cursor according to newCursorPosition
. If there
is no composing text when this method is called, the new text is
inserted at the cursor position, removing text inside the selection
if any. This behaves like calling
setComposingText(text, newCursorPosition)
then InputConnection.finishComposingText()
.
Calling this method will cause the editor to call
InputMethodService.onUpdateSelection(int, int, int, int, int, int)
on the current IME after the batch input is over.
Editor authors, for this to happen you need to
make the changes known to the input method by calling
InputMethodManager.updateSelection(View, int, int, int, int)
,
but be careful to wait until the batch edit is over if one is
in progress.
commitText
in interface InputConnection
commitText
in class InputConnectionWrapper
text
- The text to commit. This may include styles.newCursorPosition
- The new cursor position around the text,
in Java characters. If > 0, this is relative to the end
of the text - 1; if <= 0, this is relative to the start
of the text. So a value of 1 will always advance the cursor
to the position after the full text being inserted. Note that
this means you can't position the cursor within the text,
because the editor can make modifications to the text
you are providing so it is not possible to correctly specify
locations there.public boolean finishComposingText()
InputConnectionWrapper
IME authors: be aware that this call may be expensive with some editors.
Editor authors: please note that the cursor may be anywhere in the contents when this is called, including in the middle of the composing span or in a completely unrelated place. It must not move.
finishComposingText
in interface InputConnection
finishComposingText
in class InputConnectionWrapper