Builder

class Builder
kotlin.Any
   ↳ android.view.inputmethod.CursorAnchorInfo.Builder

Builder for CursorAnchorInfo. This class is not designed to be thread-safe.
Requires API level 21 (Android 5.0, Lollipop)

Summary

Public constructors

Public methods
CursorAnchorInfo.Builder!
setComposingText(composingTextStart: Int, composingText: CharSequence!)

Sets the text range of the composing text.

CursorAnchorInfo.Builder!
setSelectionRange(newStart: Int, newEnd: Int)

Sets the text range of the selection.

CursorAnchorInfo.Builder!
setInsertionMarkerLocation(horizontalPosition: Float, lineTop: Float, lineBaseline: Float, lineBottom: Float, flags: Int)

Sets the location of the text insertion point (zero width cursor) as a rectangle in local coordinates.

CursorAnchorInfo.Builder!
addCharacterBounds(index: Int, left: Float, top: Float, right: Float, bottom: Float, flags: Int)

Adds the bounding box of the character specified with the index.

Unit

Resets the internal state so that this instance can be reused to build another instance of CursorAnchorInfo.

CursorAnchorInfo.Builder!
setMatrix(matrix: Matrix!)

Sets the matrix that transforms local coordinates into screen coordinates.

CursorAnchorInfo!


Requires API level 21 (Android 5.0, Lollipop)

Public constructors

<init>

Builder()

Public methods

setComposingText

added in API level 21
fun setComposingText(composingTextStart: Int, composingText: CharSequence!): CursorAnchorInfo.Builder!

Sets the text range of the composing text. Calling this can be skipped if there is no composing text.
Requires API level 21 (Android 5.0, Lollipop)

Parameters
composingTextStart Int: index where the composing text starts.
composingText Int: the entire composing text.

setSelectionRange

added in API level 21
fun setSelectionRange(newStart: Int, newEnd: Int): CursorAnchorInfo.Builder!

Sets the text range of the selection. Calling this can be skipped if there is no selection.
Requires API level 21 (Android 5.0, Lollipop)

setInsertionMarkerLocation

added in API level 21
fun setInsertionMarkerLocation(horizontalPosition: Float, lineTop: Float, lineBaseline: Float, lineBottom: Float, flags: Int): CursorAnchorInfo.Builder!

Sets the location of the text insertion point (zero width cursor) as a rectangle in local coordinates. Calling this can be skipped when there is no text insertion point; however if there is an insertion point, editors must call this method.
Requires API level 21 (Android 5.0, Lollipop)

Parameters
horizontalPosition Float: horizontal position of the insertion marker, in the local coordinates that will be transformed with the transformation matrix when rendered on the screen. This should be calculated or compatible with Layout#getPrimaryHorizontal(int).
lineTop Float: vertical position of the insertion marker, in the local coordinates that will be transformed with the transformation matrix when rendered on the screen. This should be calculated or compatible with Layout#getLineTop(int).
lineBaseline Float: vertical position of the insertion marker, in the local coordinates that will be transformed with the transformation matrix when rendered on the screen. This should be calculated or compatible with Layout#getLineBaseline(int).
lineBottom Float: vertical position of the insertion marker, in the local coordinates that will be transformed with the transformation matrix when rendered on the screen. This should be calculated or compatible with Layout#getLineBottom(int).
flags Float: flags of the insertion marker. See #FLAG_HAS_VISIBLE_REGION for example.

addCharacterBounds

added in API level 21
fun addCharacterBounds(index: Int, left: Float, top: Float, right: Float, bottom: Float, flags: Int): CursorAnchorInfo.Builder!

Adds the bounding box of the character specified with the index.
Requires API level 21 (Android 5.0, Lollipop)

Parameters
index Int: index of the character in Java chars units. Must be specified in ascending order across successive calls.
left Int: x coordinate of the left edge of the character in local coordinates.
top Int: y coordinate of the top edge of the character in local coordinates.
right Int: x coordinate of the right edge of the character in local coordinates.
bottom Int: y coordinate of the bottom edge of the character in local coordinates.
flags Int: flags for this character bounds. See #FLAG_HAS_VISIBLE_REGION, #FLAG_HAS_INVISIBLE_REGION and #FLAG_IS_RTL. These flags must be specified when necessary.
Exceptions
IllegalArgumentException If the index is a negative value, or not greater than all of the previously called indices.

reset

added in API level 21
fun reset(): Unit

Resets the internal state so that this instance can be reused to build another instance of CursorAnchorInfo.
Requires API level 21 (Android 5.0, Lollipop)

setMatrix

added in API level 21
fun setMatrix(matrix: Matrix!): CursorAnchorInfo.Builder!

Sets the matrix that transforms local coordinates into screen coordinates.
Requires API level 21 (Android 5.0, Lollipop)

Parameters
matrix Matrix!: transformation matrix from local coordinates into screen coordinates. null is interpreted as an identity matrix.

build

added in API level 21
fun build(): CursorAnchorInfo!


Requires API level 21 (Android 5.0, Lollipop)

Return
CursorAnchorInfo!: CursorAnchorInfo using parameters in this Builder.
Exceptions
IllegalArgumentException if one or more positional parameters are specified but the coordinate transformation matrix is not provided via #setMatrix(Matrix).