TextToolbar


Interface for text-related toolbar.

Summary

Public functions

Unit

Hide the floating toolbar(post-M) or primary toolbar(pre-M).

Cmn
Unit
showMenu(
    rect: Rect,
    onCopyRequested: (() -> Unit)?,
    onPasteRequested: (() -> Unit)?,
    onCutRequested: (() -> Unit)?,
    onSelectAllRequested: (() -> Unit)?
)

Show the floating toolbar(post-M) or primary toolbar(pre-M) for copying, cutting and pasting text.

Cmn
open Unit
showMenu(
    rect: Rect,
    onCopyRequested: (() -> Unit)?,
    onPasteRequested: (() -> Unit)?,
    onCutRequested: (() -> Unit)?,
    onSelectAllRequested: (() -> Unit)?,
    onAutofillRequested: (() -> Unit)?
)

Show the floating toolbar(post-M) or primary toolbar(pre-M) for copying, cutting and pasting text.

Cmn

Public properties

TextToolbarStatus

Return the TextToolbarStatus to check if the toolbar is shown or hidden.

Cmn

Public functions

hide

fun hide(): Unit

Hide the floating toolbar(post-M) or primary toolbar(pre-M).

showMenu

fun showMenu(
    rect: Rect,
    onCopyRequested: (() -> Unit)? = null,
    onPasteRequested: (() -> Unit)? = null,
    onCutRequested: (() -> Unit)? = null,
    onSelectAllRequested: (() -> Unit)? = null
): Unit

Show the floating toolbar(post-M) or primary toolbar(pre-M) for copying, cutting and pasting text.

Parameters
rect: Rect

region of interest. The selected region around which the floating toolbar should show. This rect is in global coordinates system.

onCopyRequested: (() -> Unit)? = null

callback to copy text into ClipBoardManager. If null, the copy option will not be shown.

onPasteRequested: (() -> Unit)? = null

callback to get text from ClipBoardManager and paste it. If null, the paste option will not be shown.

onCutRequested: (() -> Unit)? = null

callback to cut text and copy the text into ClipBoardManager. If null, the cut option will not be shown.

onSelectAllRequested: (() -> Unit)? = null

callback to select all the text content. If null, the select all option will not be shown.

showMenu

open fun showMenu(
    rect: Rect,
    onCopyRequested: (() -> Unit)? = null,
    onPasteRequested: (() -> Unit)? = null,
    onCutRequested: (() -> Unit)? = null,
    onSelectAllRequested: (() -> Unit)? = null,
    onAutofillRequested: (() -> Unit)? = null
): Unit

Show the floating toolbar(post-M) or primary toolbar(pre-M) for copying, cutting and pasting text.

Parameters
rect: Rect

region of interest. The selected region around which the floating toolbar should show. This rect is in global coordinates system.

onCopyRequested: (() -> Unit)? = null

callback to copy text into ClipBoardManager. If null, the copy option will not be shown.

onPasteRequested: (() -> Unit)? = null

callback to get text from ClipBoardManager and paste it. If null, the paste option will not be shown.

onCutRequested: (() -> Unit)? = null

callback to cut text and copy the text into ClipBoardManager. If null, the cut option will not be shown.

onSelectAllRequested: (() -> Unit)? = null

callback to select all the text content. If null, the select all option will not be shown.

onAutofillRequested: (() -> Unit)? = null

callback to autofill the field. If null, the autofill option will not be shown.

Public properties

status

val status: TextToolbarStatus

Return the TextToolbarStatus to check if the toolbar is shown or hidden.