🌈 Create new beautiful Compose Gradients with our new wesite ->
Class

TextInputService

Source set: Common
public open class TextInputService(private val platformTextInputService: PlatformTextInputService)

Functions

startInput

Source set: Common
public open fun startInput(
        value: TextFieldValue,
        imeOptions: ImeOptions,
        onEditCommand: (List<EditCommand>) -> Unit,
        onImeActionPerformed: (ImeAction) -> Unit,
    ): TextInputSession

Start text input session for given client.

If there is a previous TextInputSession open, it will immediately be closed by this call to startInput.

Parameters

value initial TextFieldValue
imeOptions IME configuration
onEditCommand callback to inform about changes requested by IME
onImeActionPerformed callback to inform if an IME action such as ImeAction.Done etc occurred.

stopInput

Source set: Common
public open fun stopInput(session: TextInputSession)

Stop text input session.

If the session is not the currently open session, no action will occur.

Parameters

session the session returned by startInput call.

showSoftwareKeyboard

Source set: Common
@Deprecated(
        message =
            "Use SoftwareKeyboardController.show or " +
                "TextInputSession.showSoftwareKeyboard instead.",
        replaceWith = ReplaceWith("textInputSession.showSoftwareKeyboard()"),
    )
    // TODO(b/183448615) @InternalTextApi
    public fun showSoftwareKeyboard()

Request showing onscreen keyboard.

This call will be ignored if there is not an open TextInputSession, as it means there is nothing that will accept typed input. The most common way to open a TextInputSession is to set the focus to an editable text composable.

There is no guarantee that the keyboard will be shown. The software keyboard or system service may silently ignore this request.

hideSoftwareKeyboard

Source set: Common
@Deprecated(
        message =
            "Use SoftwareKeyboardController.hide or " +
                "TextInputSession.hideSoftwareKeyboard instead.",
        replaceWith = ReplaceWith("textInputSession.hideSoftwareKeyboard()"),
    )
    // TODO(b/183448615) @InternalTextApi
    public fun hideSoftwareKeyboard(): Unit

Hide onscreen keyboard.