public class EditableInputConnection extends BaseInputConnection
mIMM
CURSOR_UPDATE_IMMEDIATE, CURSOR_UPDATE_MONITOR, GET_EXTRACTED_TEXT_MONITOR, GET_TEXT_WITH_STYLES, INPUT_CONTENT_GRANT_READ_URI_PERMISSION
Constructor and Description |
---|
EditableInputConnection(TextView textview) |
Modifier and Type | Method and Description |
---|---|
boolean |
beginBatchEdit()
Default implementation does nothing.
|
boolean |
clearMetaKeyStates(int states)
Default implementation uses
MetaKeyKeyListener.clearMetaKeyState(long, int) to clear the state. |
void |
closeConnection()
Default implementation calls
BaseInputConnection.finishComposingText() . |
boolean |
commitCompletion(CompletionInfo text)
Default implementation does nothing and returns false.
|
boolean |
commitCorrection(CorrectionInfo correctionInfo)
Calls the
TextView.onCommitCorrection(android.view.inputmethod.CorrectionInfo) method of the associated TextView. |
boolean |
commitText(CharSequence text,
int newCursorPosition)
Default implementation replaces any existing composing text with
the given text.
|
boolean |
endBatchEdit()
Default implementation does nothing.
|
Editable |
getEditable()
Return the target of edit operations.
|
ExtractedText |
getExtractedText(ExtractedTextRequest request,
int flags)
The default implementation always returns null.
|
boolean |
performContextMenuAction(int id)
The default implementation does nothing.
|
boolean |
performEditorAction(int actionCode)
The default implementation turns this into the enter key.
|
boolean |
performPrivateCommand(String action,
Bundle data)
The default implementation does nothing.
|
boolean |
requestCursorUpdates(int cursorUpdateMode)
The default implementation does nothing.
|
commitContent, deleteSurroundingText, deleteSurroundingTextInCodePoints, finishComposingText, getComposingSpanEnd, getComposingSpanStart, getCursorCapsMode, getHandler, getSelectedText, getTextAfterCursor, getTextBeforeCursor, removeComposingSpans, reportFullscreenMode, sendKeyEvent, setComposingRegion, setComposingSpans, setComposingSpans, setComposingText, setSelection
public EditableInputConnection(TextView textview)
public Editable getEditable()
BaseInputConnection
getEditable
in class BaseInputConnection
public boolean beginBatchEdit()
BaseInputConnection
beginBatchEdit
in interface InputConnection
beginBatchEdit
in class BaseInputConnection
public boolean endBatchEdit()
BaseInputConnection
endBatchEdit
in interface InputConnection
endBatchEdit
in class BaseInputConnection
public void closeConnection()
BaseInputConnection
BaseInputConnection.finishComposingText()
.closeConnection
in interface InputConnection
closeConnection
in class BaseInputConnection
public boolean clearMetaKeyStates(int states)
BaseInputConnection
MetaKeyKeyListener.clearMetaKeyState(long, int)
to clear the state.clearMetaKeyStates
in interface InputConnection
clearMetaKeyStates
in class BaseInputConnection
states
- The states to be cleared, may be one or more bits as
per KeyEvent.getMetaState()
.public boolean commitCompletion(CompletionInfo text)
BaseInputConnection
commitCompletion
in interface InputConnection
commitCompletion
in class BaseInputConnection
text
- The committed completion.public boolean commitCorrection(CorrectionInfo correctionInfo)
TextView.onCommitCorrection(android.view.inputmethod.CorrectionInfo)
method of the associated TextView.commitCorrection
in interface InputConnection
commitCorrection
in class BaseInputConnection
correctionInfo
- Detailed information about the correction.Build.VERSION_CODES.N
and later, returns false
when the target application does not implement this method.public boolean performEditorAction(int actionCode)
BaseInputConnection
performEditorAction
in interface InputConnection
performEditorAction
in class BaseInputConnection
actionCode
- This must be one of the action constants for
EditorInfo.editorType
, such as
EditorInfo.EDITOR_ACTION_GO
.public boolean performContextMenuAction(int id)
BaseInputConnection
performContextMenuAction
in interface InputConnection
performContextMenuAction
in class BaseInputConnection
public ExtractedText getExtractedText(ExtractedTextRequest request, int flags)
BaseInputConnection
getExtractedText
in interface InputConnection
getExtractedText
in class BaseInputConnection
request
- Description of how the text should be returned.
ExtractedTextRequest
flags
- Additional options to control the client, either 0 or
InputConnection.GET_EXTRACTED_TEXT_MONITOR
.ExtractedText
object describing the state of the text view and containing the
extracted text itself, or null if the input connection is no
longer valid of the editor can't comply with the request for
some reason.public boolean performPrivateCommand(String action, Bundle data)
BaseInputConnection
performPrivateCommand
in interface InputConnection
performPrivateCommand
in class BaseInputConnection
action
- Name of the command to be performed. This must
be a scoped name, i.e. prefixed with a package name you own, so that
different developers will not create conflicting commands.data
- Any data to include with the command.public boolean commitText(CharSequence text, int newCursorPosition)
BaseInputConnection
commitText
in interface InputConnection
commitText
in class BaseInputConnection
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 requestCursorUpdates(int cursorUpdateMode)
BaseInputConnection
requestCursorUpdates
in interface InputConnection
requestCursorUpdates
in class BaseInputConnection
cursorUpdateMode
- InputConnection.CURSOR_UPDATE_IMMEDIATE
and/or
InputConnection.CURSOR_UPDATE_MONITOR
. Pass 0
to disable the effect of
InputConnection.CURSOR_UPDATE_MONITOR
.true
if the request is scheduled. false
to indicate that when the
application will not call
InputMethodManager.updateCursorAnchorInfo(android.view.View, CursorAnchorInfo)
.
In Build.VERSION_CODES.N
and later, returns false
also when the
target application does not implement this method.