java.lang.Object | |
↳ | android.view.inputmethod.BaseInputConnection |
Base class for implementors of the InputConnection interface, taking care
of most of the common behavior for providing a connection to an Editable.
Implementors of this class will want to be sure to implement
getEditable()
to provide access to their own editable object, and
to refer to the documentation in
InputConnection
.
[Expand]
Inherited Constants
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.view.inputmethod.InputConnection
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Default implementation does nothing.
|
||||||||||
|
Default implementation uses
MetaKeyKeyListener.clearMetaKeyState(long, int)
to clear the state.
|
||||||||||
|
Default implementation does nothing and returns false.
|
||||||||||
|
Default implementation does nothing and returns false.
|
||||||||||
|
Default implementation replaces any existing composing text with
the given text.
|
||||||||||
|
The default implementation performs the deletion around the current
selection position of the editable text.
|
||||||||||
|
Default implementation does nothing.
|
||||||||||
|
The default implementation removes the composing state from the
current editable text.
|
||||||||||
|
|
||||||||||
|
|
||||||||||
|
The default implementation uses TextUtils.getCapsMode to get the
cursor caps mode for the current selection position in the editable
text, unless in dummy mode in which case 0 is always returned.
|
||||||||||
|
Return the target of edit operations.
|
||||||||||
|
The default implementation always returns null.
|
||||||||||
|
The default implementation returns the text currently selected, or null if none is
selected.
|
||||||||||
|
The default implementation returns the given amount of text from the
current cursor position in the buffer.
|
||||||||||
|
The default implementation returns the given amount of text from the
current cursor position in the buffer.
|
||||||||||
|
The default implementation does nothing.
|
||||||||||
|
The default implementation turns this into the enter key.
|
||||||||||
|
The default implementation does nothing.
|
||||||||||
|
|
||||||||||
|
Updates InputMethodManager with the current fullscreen mode.
|
||||||||||
|
Provides standard implementation for sending a key event to the window
attached to the input connection's view.
|
||||||||||
|
Mark a certain region of text as composing text.
|
||||||||||
|
|
||||||||||
|
The default implementation places the given text into the editable,
replacing any existing composing text.
|
||||||||||
|
The default implementation changes the selection position in the
current editable text.
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
|||||||||||
From interface
android.view.inputmethod.InputConnection
|
Default implementation does nothing.
Default implementation uses
MetaKeyKeyListener.clearMetaKeyState(long, int)
to clear the state.
states |
The states to be cleared, may be one or more bits as
per
KeyEvent.getMetaState()
.
|
---|
Default implementation does nothing and returns false.
text | The committed completion. |
---|
Default implementation does nothing and returns false.
correctionInfo | Detailed information about the correction. |
---|
Default implementation replaces any existing composing text with the given text. In addition, only if dummy mode, a key event is sent for the new text and the current editable buffer cleared.
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. |
The default implementation performs the deletion around the current selection position of the editable text.
beforeLength | The number of characters to be deleted before the current cursor position. |
---|---|
afterLength | The number of characters to be deleted after the current cursor position. |
Default implementation does nothing.
The default implementation removes the composing state from the current editable text. In addition, only if dummy mode, a key event is sent for the new text and the current editable buffer cleared.
The default implementation uses TextUtils.getCapsMode to get the cursor caps mode for the current selection position in the editable text, unless in dummy mode in which case 0 is always returned.
reqModes |
The desired modes to retrieve, as defined by
TextUtils.getCapsMode
. These
constants are defined so that you can simply pass the current
TextBoxAttribute.contentType
value
directly in to here.
|
---|
InputType
.
Return the target of edit operations. The default implementation returns its own fake editable that is just used for composing text; subclasses that are real text editors should override this and supply their own.
The default implementation always returns null.
request |
Description of how the text should be returned.
ExtractedTextRequest
|
---|---|
flags |
Additional options to control the client, either 0 or
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.
The default implementation returns the text currently selected, or null if none is selected.
flags |
Supplies additional options controlling how the text is
returned. May be either 0 or
GET_TEXT_WITH_STYLES
.
|
---|
The default implementation returns the given amount of text from the current cursor position in the buffer.
length | The expected length of the text. |
---|---|
flags |
Supplies additional options controlling how the text is
returned. May be either 0 or
GET_TEXT_WITH_STYLES
.
|
The default implementation returns the given amount of text from the current cursor position in the buffer.
length | The expected length of the text. |
---|---|
flags |
Supplies additional options controlling how the text is
returned. May be either 0 or
GET_TEXT_WITH_STYLES
.
|
The default implementation does nothing.
The default implementation turns this into the enter key.
actionCode |
This must be one of the action constants for
EditorInfo.editorType
, such as
EditorInfo.EDITOR_ACTION_GO
.
|
---|
The default implementation does nothing.
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. |
Updates InputMethodManager with the current fullscreen mode.
Provides standard implementation for sending a key event to the window attached to the input connection's view.
event | The key event. |
---|
Mark a certain region of text as composing text. If there was a
composing region, the characters are left as they were and the
composing span removed, as if
finishComposingText()
has been called. The default style for composing text is used.
The passed indices are clipped to the contents bounds. If
the resulting region is zero-sized, no region is marked and the
effect is the same as that of calling
finishComposingText()
.
The order of start and end is not important. In effect, the
region from start to end and the region from end to start is
the same. Editor authors, be ready to accept a start that is
greater than end.
Since this does not change the contents of the text, editors should not call
updateSelection(View, int, int, int, int)
and
IMEs should not receive
onUpdateSelection(int, int, int, int, int, int)
.
This has no impact on the cursor/selection position. It may result in the cursor being anywhere inside or outside the composing region, including cases where the selection and the composing region overlap partially or entirely.
start | the position in the text at which the composing region begins |
---|---|
end | the position in the text at which the composing region ends |
The default implementation places the given text into the editable, replacing any existing composing text. The new text is marked as in a composing state with the composing style.
text |
The composing text with styles if necessary. If no style
object attached to the text, the default style for composing text
is used. See
Spanned
for how to attach style
object to the text.
SpannableString
and
SpannableStringBuilder
are two
implementations of the interface
Spanned
.
|
---|---|
newCursorPosition | The new cursor position around the text. 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 you 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. |
The default implementation changes the selection position in the current editable text.
start | the character index where the selection should start. |
---|---|
end | the character index where the selection should end. |