InputState

data class InputState
kotlin.Any
   ↳ androidx.ui.input.InputState

Stores an input state for IME

IME can request editor state with calling getTextBeforeCursor, getSelectedText, etc. This class stores a snapshot of the input state of the edit buffer and provide utility functions for answering these information retrieval requests.

Summary

Public constructors

<init>(text: String = "", selection: TextRange = TextRange(0, 0), composition: TextRange? = null)

Stores an input state for IME

Public methods

String

Helper function for getting text currently selected.

String

Helper function for getting text after selection range.

String

Helper function for getting text before selection range.

Properties

TextRange?

A composition range visible to IME.

TextRange

A selection range visible to IME.

String

A text visible to IME

Public constructors

<init>

InputState(
    text: String = "",
    selection: TextRange = TextRange(0, 0),
    composition: TextRange? = null)

Stores an input state for IME

IME can request editor state with calling getTextBeforeCursor, getSelectedText, etc. This class stores a snapshot of the input state of the edit buffer and provide utility functions for answering these information retrieval requests.

Public methods

getSelectedText

fun getSelectedText(): String

Helper function for getting text currently selected.

getTextAfterSelection

fun getTextAfterSelection(maxChars: Int): String

Helper function for getting text after selection range.

getTextBeforeSelection

fun getTextBeforeSelection(maxChars: Int): String

Helper function for getting text before selection range.

Properties

composition

val composition: TextRange?

A composition range visible to IME. If null, there is no composition range. If non-null, the composition range must be valid range in the given text.

selection

val selection: TextRange

A selection range visible to IME. The selection range must be valid range in the given text.

text

val text: String

A text visible to IME