Added in API level 3

InputMethodSessionImpl


open class InputMethodSessionImpl : AbstractInputMethodService.AbstractInputMethodSessionImpl

Concrete implementation of AbstractInputMethodService.AbstractInputMethodSessionImpl that provides all of the standard behavior for an input method session.

Summary

Public constructors

Public methods
open Unit
appPrivateCommand(action: String!, data: Bundle!)

Call InputMethodService.onAppPrivateCommand().

open Unit

Call InputMethodService.onDisplayCompletions().

open Unit

open Unit
toggleSoftInput(showFlags: Int, hideFlags: Int)

Handles a request to toggle the IME visibility.

open Unit
updateCursor(newCursor: Rect!)

Call InputMethodService.onUpdateCursor().

open Unit

Call InputMethodService.onUpdateCursorAnchorInfo().

open Unit

Call InputMethodService.onUpdateExtractedText().

open Unit
updateSelection(oldSelStart: Int, oldSelEnd: Int, newSelStart: Int, newSelEnd: Int, candidatesStart: Int, candidatesEnd: Int)

Call InputMethodService.onUpdateSelection().

open Unit
viewClicked(focusChanged: Boolean)

Inherited functions
Unit appPrivateCommand(action: String!, data: Bundle!)

Process a private command sent from the application to the input method. This can be used to provide domain-specific features that are only known between certain input methods and their clients.

Unit displayCompletions(completions: Array<CompletionInfo!>!)

Called by a text editor that performs auto completion, to tell the input method about the completions it has available. This can be used by the input method to display them to the user to select the text to be inserted.

Unit finishInput()

This method is called when the application would like to stop receiving text input.

Unit toggleSoftInput(showFlags: Int, hideFlags: Int)

Toggle the soft input window. Applications can toggle the state of the soft input window.

Unit updateCursor(newCursor: Rect!)

This method is called when cursor location of the target input field has changed within its window. This is not normally called, but will only be reported if requested by the input method.

Unit updateCursorAnchorInfo(cursorAnchorInfo: CursorAnchorInfo!)

This method is called when the cursor and/or the character position relevant to text input is changed on the screen. This is not called by default. It will only be reported if requested by the input method.

Unit updateExtractedText(token: Int, text: ExtractedText!)

Called by a text editor to report its new extracted text when its contents change. This will only be called if the input method calls InputConnection.getExtractedText() with the option to report updates.

Unit updateSelection(oldSelStart: Int, oldSelEnd: Int, newSelStart: Int, newSelEnd: Int, candidatesStart: Int, candidatesEnd: Int)

This method is called when the selection or cursor in the current target input field has changed.

Unit viewClicked(focusChanged: Boolean)

This method is called when the user tapped a text view. IMEs can't rely on this method being called because this was not part of the original IME protocol, so applications with custom text editing written before this method appeared will not call to inform the IME of this interaction.

Unit dispatchGenericMotionEvent(seq: Int, event: MotionEvent!, callback: InputMethodSession.EventCallback!)

Take care of dispatching incoming generic motion events to the appropriate callbacks on the service, and tell the client when this is done.

Unit dispatchKeyEvent(seq: Int, event: KeyEvent!, callback: InputMethodSession.EventCallback!)

Take care of dispatching incoming key events to the appropriate callbacks on the service, and tell the client when this is done.

Unit dispatchTrackballEvent(seq: Int, event: MotionEvent!, callback: InputMethodSession.EventCallback!)

Take care of dispatching incoming trackball events to the appropriate callbacks on the service, and tell the client when this is done.

Boolean isEnabled()

Check whether this session has been enabled by the system. If not enabled, you should not execute any calls on to it.

Boolean isRevoked()

Check whether this session has been revoked by the system. Revoked session is also always disabled, so there is generally no need to explicitly check for this.

Boolean onShouldVerifyKeyEvent(event: KeyEvent)

Unit revokeSelf()

Revoke the session from the client. This disabled the session, and prevents it from ever being enabled again.

Unit setEnabled(enabled: Boolean)

Change the enabled state of the session. This only works if the session has not been revoked.

Public constructors

InputMethodSessionImpl

InputMethodSessionImpl()

Public methods

appPrivateCommand

Added in API level 3
open fun appPrivateCommand(
    action: String!,
    data: Bundle!
): Unit

Call InputMethodService.onAppPrivateCommand().

Parameters
action String!: 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 Bundle!: Any data to include with the command.

displayCompletions

Added in API level 3
open fun displayCompletions(completions: Array<CompletionInfo!>!): Unit

Call InputMethodService.onDisplayCompletions().

Parameters
completions Array<CompletionInfo!>!: Array of text completions that are available, starting with the best. If this array is null, any existing completions will be removed.

finishInput

Added in API level 3
open fun finishInput(): Unit

toggleSoftInput

Added in API level 3
open fun toggleSoftInput(
    showFlags: Int,
    hideFlags: Int
): Unit

Deprecated: Starting in Build.VERSION_CODES.S the system no longer invokes this method, instead it explicitly shows or hides the IME. An InputMethodService wishing to toggle its own visibility should instead invoke android.inputmethodservice.InputMethodService#requestShowSelf or InputMethodService.requestHideSelf

Handles a request to toggle the IME visibility.

updateCursor

Added in API level 3
open fun updateCursor(newCursor: Rect!): Unit

Call InputMethodService.onUpdateCursor().

Parameters
newCursor Rect!: The rectangle of the cursor currently being shown in the input field's window coordinates.

updateCursorAnchorInfo

Added in API level 21
open fun updateCursorAnchorInfo(info: CursorAnchorInfo!): Unit

Call InputMethodService.onUpdateCursorAnchorInfo().

Parameters
cursorAnchorInfo Positional information relevant to text input, such as text insertion point and composition string.

updateExtractedText

Added in API level 3
open fun updateExtractedText(
    token: Int,
    text: ExtractedText!
): Unit

Call InputMethodService.onUpdateExtractedText().

Parameters
token Int: The input method supplied token for identifying its request.
text ExtractedText!: The new extracted text.

updateSelection

Added in API level 3
open fun updateSelection(
    oldSelStart: Int,
    oldSelEnd: Int,
    newSelStart: Int,
    newSelEnd: Int,
    candidatesStart: Int,
    candidatesEnd: Int
): Unit

Call InputMethodService.onUpdateSelection().

Parameters
oldSelStart Int: The previous text offset of the cursor selection start position.
oldSelEnd Int: The previous text offset of the cursor selection end position.
newSelStart Int: The new text offset of the cursor selection start position.
newSelEnd Int: The new text offset of the cursor selection end position.
candidatesStart Int: The text offset of the current candidate text start position.
candidatesEnd Int: The text offset of the current candidate text end position.

viewClicked

Added in API level 14
open fun viewClicked(focusChanged: Boolean): Unit
Parameters
focusChanged Boolean: true if the user changed the focused view by this click.