CursorAnchorInfo.Builder
public
static
final
class
CursorAnchorInfo.Builder
extends Object
| java.lang.Object | |
| ↳ | android.view.inputmethod.CursorAnchorInfo.Builder |
Builder for CursorAnchorInfo. This class is not designed to be thread-safe.
Summary
Public constructors | |
|---|---|
Builder()
|
|
Public methods | |
|---|---|
CursorAnchorInfo.Builder
|
addCharacterBounds(int index, float left, float top, float right, float bottom, int flags)
Adds the bounding box of the character specified with the index. |
CursorAnchorInfo.Builder
|
addVisibleLineBounds(float left, float top, float right, float bottom)
Add the bounds of a visible text line of the current editor. |
CursorAnchorInfo
|
build()
|
CursorAnchorInfo.Builder
|
clearVisibleLineBounds()
Clear the visible text line bounds previously added to this |
void
|
reset()
Resets the internal state so that this instance can be reused to build another
instance of |
CursorAnchorInfo.Builder
|
setComposingText(int composingTextStart, CharSequence composingText)
Sets the text range of the composing text. |
CursorAnchorInfo.Builder
|
setEditorBoundsInfo(EditorBoundsInfo bounds)
Sets the current editor related bounds. |
CursorAnchorInfo.Builder
|
setInsertionMarkerLocation(float horizontalPosition, float lineTop, float lineBaseline, float lineBottom, int flags)
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. |
CursorAnchorInfo.Builder
|
setTextAppearanceInfo(TextAppearanceInfo textAppearanceInfo)
Set the information related to text appearance, which is extracted from the original
|
Inherited methods | |
|---|---|
Public constructors
Builder
public Builder ()
Public methods
addCharacterBounds
public CursorAnchorInfo.Builder addCharacterBounds (int index, float left, float top, float right, float bottom, int flags)
Adds the bounding box of the character specified with the index.
| Parameters | |
|---|---|
index |
int: index of the character in Java chars units. Must be specified in
ascending order across successive calls. |
left |
float: x coordinate of the left edge of the character in local coordinates. |
top |
float: y coordinate of the top edge of the character in local coordinates. |
right |
float: x coordinate of the right edge of the character in local coordinates. |
bottom |
float: y coordinate of the bottom edge of the character in local coordinates. |
flags |
int: flags for this character bounds. See CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
CursorAnchorInfo.FLAG_HAS_INVISIBLE_REGION and CursorAnchorInfo.FLAG_IS_RTL. These flags must be
specified when necessary. |
| Returns | |
|---|---|
CursorAnchorInfo.Builder |
|
| Throws | |
|---|---|
IllegalArgumentException |
If the index is a negative value, or not greater than all of the previously called indices. |
addVisibleLineBounds
public CursorAnchorInfo.Builder addVisibleLineBounds (float left, float top, float right, float bottom)
Add the bounds of a visible text line of the current editor. The line bounds should not include the vertical space between lines or the horizontal space before and after a line. It's preferable if the line bounds are added in the logical order, so that IME can process them easily.
| Parameters | |
|---|---|
left |
float: the left bound of the left-most character in the line |
top |
float: the top bound of the top-most character in the line |
right |
float: the right bound of the right-most character in the line |
bottom |
float: the bottom bound of the bottom-most character in the line |
| Returns | |
|---|---|
CursorAnchorInfo.Builder |
This value cannot be null. |
build
public CursorAnchorInfo build ()
| Returns | |
|---|---|
CursorAnchorInfo |
CursorAnchorInfo using parameters in this Builder. |
| Throws | |
|---|---|
IllegalArgumentException |
if one or more positional parameters are specified but
the coordinate transformation matrix is not provided via setMatrix(android.graphics.Matrix). |
clearVisibleLineBounds
public CursorAnchorInfo.Builder clearVisibleLineBounds ()
Clear the visible text line bounds previously added to this Builder.
| Returns | |
|---|---|
CursorAnchorInfo.Builder |
This value cannot be null. |
reset
public void reset ()
Resets the internal state so that this instance can be reused to build another
instance of CursorAnchorInfo.
setComposingText
public CursorAnchorInfo.Builder setComposingText (int composingTextStart, CharSequence composingText)
Sets the text range of the composing text. Calling this can be skipped if there is no composing text.
| Parameters | |
|---|---|
composingTextStart |
int: index where the composing text starts. |
composingText |
CharSequence: the entire composing text. |
| Returns | |
|---|---|
CursorAnchorInfo.Builder |
|
setEditorBoundsInfo
public CursorAnchorInfo.Builder setEditorBoundsInfo (EditorBoundsInfo bounds)
Sets the current editor related bounds.
| Parameters | |
|---|---|
bounds |
EditorBoundsInfo: EditorBoundsInfo in local coordinates.
This value may be null. |
| Returns | |
|---|---|
CursorAnchorInfo.Builder |
This value cannot be null. |
setInsertionMarkerLocation
public CursorAnchorInfo.Builder setInsertionMarkerLocation (float horizontalPosition, float lineTop, float lineBaseline, float lineBottom, int flags)
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 |
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 |
int: flags of the insertion marker. See CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION for
example. |
| Returns | |
|---|---|
CursorAnchorInfo.Builder |
|
setMatrix
public CursorAnchorInfo.Builder setMatrix (Matrix matrix)
Sets the matrix that transforms local coordinates into screen coordinates.
| Parameters | |
|---|---|
matrix |
Matrix: transformation matrix from local coordinates into screen coordinates. null
is interpreted as an identity matrix. |
| Returns | |
|---|---|
CursorAnchorInfo.Builder |
|
setSelectionRange
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.
| Parameters | |
|---|---|
newStart |
int |
newEnd |
int |
| Returns | |
|---|---|
CursorAnchorInfo.Builder |
|
setTextAppearanceInfo
public CursorAnchorInfo.Builder setTextAppearanceInfo (TextAppearanceInfo textAppearanceInfo)
Set the information related to text appearance, which is extracted from the original
TextView.
| Parameters | |
|---|---|
textAppearanceInfo |
TextAppearanceInfo: TextAppearanceInfo of TextView.
This value may be null. |
| Returns | |
|---|---|
CursorAnchorInfo.Builder |
This value cannot be null. |