SelectionManager

class SelectionManager : SelectionRegistrar
kotlin.Any
   ↳ androidx.ui.core.selection.SelectionManager

A bridge class between user interaction to the text composables for text selection.

Summary

Public constructors

A bridge class between user interaction to the text composables for text selection.

Public methods

PxPosition

Adjust coordinates for given text offset.

DragObserver
handleDragObserver(dragStartHandle: Boolean)

Unit
onPress(position: PxPosition)

Any

Allow a Text composable to "register" itself with the manager

Unit

Allow a Text composable to "unregister" itself with the manager

Properties

lateinit LayoutCoordinates

Layout Coordinates of the selection container.

SelectionMode

The selection mode.

(Selection?) -> Unit

The manager will invoke this every time it comes to the conclusion that the selection should change.

Selection?

The current selection.

Public constructors

<init>

SelectionManager()

A bridge class between user interaction to the text composables for text selection.

Public methods

getAdjustedCoordinates

fun getAdjustedCoordinates(p: PxPosition
): PxPosition

Adjust coordinates for given text offset.

Currently android.text.Layout.getLineBottom returns y coordinates of the next line's top offset, which is not included in current line's hit area. To be able to hit current line, move up this y coordinates by 1 pixel.

handleDragObserver

fun handleDragObserver(dragStartHandle: Boolean
): DragObserver

onPress

fun onPress(position: PxPosition
): Unit

subscribe

fun subscribe(handler: TextSelectionHandler
): Any

Allow a Text composable to "register" itself with the manager

unsubscribe

fun unsubscribe(key: Any
): Unit

Allow a Text composable to "unregister" itself with the manager

Properties

containerLayoutCoordinates

lateinit var containerLayoutCoordinates: LayoutCoordinates

Layout Coordinates of the selection container.

mode

var mode: SelectionMode

The selection mode. The default value is Vertical.

onSelectionChange

var onSelectionChange: (Selection?) -> Unit

The manager will invoke this every time it comes to the conclusion that the selection should change. The expectation is that this callback will end up causing setSelection to get called. This is what makes this a "controlled component".

selection

var selection: Selection?

The current selection.