Added in API level 3

AbstractInputMethodSessionImpl


abstract class AbstractInputMethodSessionImpl : InputMethodSession
InputMethodService.InputMethodSessionImpl

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

Base class for derived classes to implement their InputMethodSession interface. This takes care of basic maintenance of the session, but most behavior must be implemented in a derived class.

Summary

Public constructors

Public methods
open Unit

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

open Unit

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

open Unit

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

open Boolean

Check whether this session has been enabled by the system.

open Boolean

Check whether this session has been revoked by the system.

open Boolean

open Unit

Revoke the session from the client.

open Unit
setEnabled(enabled: Boolean)

Change the enabled state of the session.

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.

Public constructors

AbstractInputMethodSessionImpl

AbstractInputMethodSessionImpl()

Public methods

dispatchGenericMotionEvent

Added in API level 17
open fun dispatchGenericMotionEvent(
    seq: Int,
    event: MotionEvent!,
    callback: InputMethodSession.EventCallback!
): Unit

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

Parameters
event MotionEvent!: The motion event.
Return
Unit Whether the input method wants to handle this event.

dispatchKeyEvent

Added in API level 3
open fun dispatchKeyEvent(
    seq: Int,
    event: KeyEvent!,
    callback: InputMethodSession.EventCallback!
): Unit

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

Parameters
event KeyEvent!: The key event.
Return
Unit Whether the input method wants to handle this event.

dispatchTrackballEvent

Added in API level 3
open fun dispatchTrackballEvent(
    seq: Int,
    event: MotionEvent!,
    callback: InputMethodSession.EventCallback!
): Unit

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

Parameters
event MotionEvent!: The motion event.
Return
Unit Whether the input method wants to handle this event.

isEnabled

Added in API level 3
open fun isEnabled(): Boolean

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

isRevoked

Added in API level 3
open fun isRevoked(): Boolean

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.

onShouldVerifyKeyEvent

open fun onShouldVerifyKeyEvent(event: KeyEvent): Boolean
Parameters
event KeyEvent: This value cannot be null.

revokeSelf

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

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

setEnabled

Added in API level 3
open fun setEnabled(enabled: Boolean): Unit

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