Android APIs
public static final class

CursorAnchorInfo.Builder

extends Object
java.lang.Object
   ↳ android.view.inputmethod.CursorAnchorInfo.Builder

Class Overview

Builder for CursorAnchorInfo. This class is not designed to be thread-safe.

Summary

Public Constructors
CursorAnchorInfo.Builder()
Public Methods
CursorAnchorInfo.Builder addCharacterRect(int index, float leadingEdgeX, float leadingEdgeY, float trailingEdgeX, float trailingEdgeY)
Adds the bounding box of the character specified with the index.
CursorAnchorInfo build()
void reset()
Resets the internal state so that this instance can be reused to build another instance of CursorAnchorInfo.
CursorAnchorInfo.Builder setComposingText(int index, CharSequence composingText)
Sets the text range of the composing text.
CursorAnchorInfo.Builder setInsertionMarkerLocation(float horizontalPosition, float lineTop, float lineBaseline, float lineBottom)
Sets the location of the text insertion point (zero width cursor) as a rectangle in local coordinates.
CursorAnchorInfo.Builder setMatrix(Matrix matrix)
Sets the matrix that transforms local coordinates into screen coordinates.
CursorAnchorInfo.Builder setSelectionRange(int newStart, int newEnd)
Sets the text range of the selection.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public CursorAnchorInfo.Builder ()

Public Methods

public CursorAnchorInfo.Builder addCharacterRect (int index, float leadingEdgeX, float leadingEdgeY, float trailingEdgeX, float trailingEdgeY)

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

Editor authors should not call this method for characters that are invisible.

Parameters
index index of the character in Java chars units. Must be specified in ascending order across successive calls.
leadingEdgeX x coordinate of the leading edge of the character in local coordinates, that is, left edge for LTR text and right edge for RTL text.
leadingEdgeY y coordinate of the leading edge of the character in local coordinates.
trailingEdgeX x coordinate of the trailing edge of the character in local coordinates, that is, right edge for LTR text and left edge for RTL text.
trailingEdgeY y coordinate of the trailing edge of the character in local coordinates.
Throws
IllegalArgumentException If the index is a negative value, or not greater than all of the previously called indices.

public CursorAnchorInfo build ()

Returns

public void reset ()

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

public CursorAnchorInfo.Builder setComposingText (int index, CharSequence composingText)

Sets the text range of the composing text. Calling this can be skipped if there is no composing text.

Parameters
index index where the composing text starts.
composingText the entire composing text.

public CursorAnchorInfo.Builder setInsertionMarkerLocation (float horizontalPosition, float lineTop, float lineBaseline, float lineBottom)

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.

Parameters
horizontalPosition 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 getPrimaryHorizontal(int).
lineTop 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 getLineTop(int).
lineBaseline 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 getLineBaseline(int).
lineBottom 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 getLineBottom(int).

public CursorAnchorInfo.Builder setMatrix (Matrix matrix)

Sets the matrix that transforms local coordinates into screen coordinates.

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

public CursorAnchorInfo.Builder setSelectionRange (int newStart, int newEnd)

Sets the text range of the selection. Calling this can be skipped if there is no selection.