Fields Summary |
---|
private final int | mSelectionStartThe index of the first character of the selected text (inclusive). {@code -1} when there is
no text selection. |
private final int | mSelectionEndThe index of the first character of the selected text (exclusive). {@code -1} when there is
no text selection. |
private final int | mComposingTextStartThe index of the first character of the composing text (inclusive). {@code -1} when there is
no composing text. |
private final CharSequence | mComposingTextThe text, tracked as a composing region. |
private final int | mInsertionMarkerFlagsFlags of the insertion marker. See {@link #FLAG_HAS_VISIBLE_REGION} for example. |
private final float | mInsertionMarkerHorizontalHorizontal 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 {@link Layout#getPrimaryHorizontal(int)}. This can be
{@code java.lang.Float.NaN} when no value is specified. |
private final float | mInsertionMarkerTopVertical 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 {@link Layout#getLineTop(int)}. This can be
{@code java.lang.Float.NaN} when no value is specified. |
private final float | mInsertionMarkerBaselineVertical 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 {@link Layout#getLineBaseline(int)}. This can be
{@code java.lang.Float.NaN} when no value is specified. |
private final float | mInsertionMarkerBottomVertical 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 {@link Layout#getLineBottom(int)}. This can be
{@code java.lang.Float.NaN} when no value is specified. |
private final SparseRectFArray | mCharacterBoundsArrayContainer of rectangular position of characters, keyed with character index in a unit of
Java chars, in the local coordinates that will be transformed with the transformation matrix
when rendered on the screen. |
private final android.graphics.Matrix | mMatrixTransformation matrix that is applied to any positional information of this class to
transform local coordinates into screen coordinates. |
public static final int | FLAG_HAS_VISIBLE_REGIONFlag for {@link #getInsertionMarkerFlags()} and {@link #getCharacterBoundsFlags(int)}: the
insertion marker or character bounds have at least one visible region. |
public static final int | FLAG_HAS_INVISIBLE_REGIONFlag for {@link #getInsertionMarkerFlags()} and {@link #getCharacterBoundsFlags(int)}: the
insertion marker or character bounds have at least one invisible (clipped) region. |
public static final int | FLAG_IS_RTLFlag for {@link #getInsertionMarkerFlags()} and {@link #getCharacterBoundsFlags(int)}: the
insertion marker or character bounds is placed at right-to-left (RTL) character. |
public static final Parcelable.Creator | CREATORUsed to make this class parcelable. |
Methods Summary |
---|
private static boolean | areSameFloatImpl(float a, float b)Compares two float values. Returns {@code true} if {@code a} and {@code b} are
{@link Float#NaN} at the same time.
if (Float.isNaN(a) && Float.isNaN(b)) {
return true;
}
return a == b;
|
public int | describeContents()
return 0;
|
public boolean | equals(java.lang.Object obj)
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (!(obj instanceof CursorAnchorInfo)) {
return false;
}
final CursorAnchorInfo that = (CursorAnchorInfo) obj;
if (hashCode() != that.hashCode()) {
return false;
}
if (mSelectionStart != that.mSelectionStart || mSelectionEnd != that.mSelectionEnd) {
return false;
}
if (mComposingTextStart != that.mComposingTextStart
|| !Objects.equals(mComposingText, that.mComposingText)) {
return false;
}
if (mInsertionMarkerFlags != that.mInsertionMarkerFlags
|| !areSameFloatImpl(mInsertionMarkerHorizontal, that.mInsertionMarkerHorizontal)
|| !areSameFloatImpl(mInsertionMarkerTop, that.mInsertionMarkerTop)
|| !areSameFloatImpl(mInsertionMarkerBaseline, that.mInsertionMarkerBaseline)
|| !areSameFloatImpl(mInsertionMarkerBottom, that.mInsertionMarkerBottom)) {
return false;
}
if (!Objects.equals(mCharacterBoundsArray, that.mCharacterBoundsArray)) {
return false;
}
if (!Objects.equals(mMatrix, that.mMatrix)) {
return false;
}
return true;
|
public android.graphics.RectF | getCharacterBounds(int index)Returns a new instance of {@link RectF} that indicates the location of the character
specified with the index.
if (mCharacterBoundsArray == null) {
return null;
}
return mCharacterBoundsArray.get(index);
|
public int | getCharacterBoundsFlags(int index)Returns the flags associated with the character bounds specified with the index.
if (mCharacterBoundsArray == null) {
return 0;
}
return mCharacterBoundsArray.getFlags(index, 0);
|
public java.lang.CharSequence | getComposingText()Returns the entire composing text.
return mComposingText;
|
public int | getComposingTextStart()Returns the index where the composing text starts.
return mComposingTextStart;
|
public float | getInsertionMarkerBaseline()Returns the vertical baseline position of the insertion marker, in the local coordinates
that will be transformed with {@link #getMatrix()} when rendered on the screen.
return mInsertionMarkerBaseline;
|
public float | getInsertionMarkerBottom()Returns the vertical bottom position of the insertion marker, in the local coordinates
that will be transformed with {@link #getMatrix()} when rendered on the screen.
return mInsertionMarkerBottom;
|
public int | getInsertionMarkerFlags()Returns the flag of the insertion marker.
return mInsertionMarkerFlags;
|
public float | getInsertionMarkerHorizontal()Returns the horizontal start of the insertion marker, in the local coordinates that will
be transformed with {@link #getMatrix()} when rendered on the screen.
return mInsertionMarkerHorizontal;
|
public float | getInsertionMarkerTop()Returns the vertical top position of the insertion marker, in the local coordinates that
will be transformed with {@link #getMatrix()} when rendered on the screen.
return mInsertionMarkerTop;
|
public android.graphics.Matrix | getMatrix()Returns a new instance of {@link android.graphics.Matrix} that indicates the transformation
matrix that is to be applied other positional data in this class.
return new Matrix(mMatrix);
|
public int | getSelectionEnd()Returns the index where the selection ends.
return mSelectionEnd;
|
public int | getSelectionStart()Returns the index where the selection starts.
return mSelectionStart;
|
public int | hashCode()
final float floatHash = mInsertionMarkerHorizontal + mInsertionMarkerTop
+ mInsertionMarkerBaseline + mInsertionMarkerBottom;
int hash = floatHash > 0 ? (int) floatHash : (int)(-floatHash);
hash *= 31;
hash += mInsertionMarkerFlags;
hash *= 31;
hash += mSelectionStart + mSelectionEnd + mComposingTextStart;
hash *= 31;
hash += Objects.hashCode(mComposingText);
hash *= 31;
hash += Objects.hashCode(mCharacterBoundsArray);
hash *= 31;
hash += Objects.hashCode(mMatrix);
return hash;
|
public java.lang.String | toString()
return "SelectionInfo{mSelection=" + mSelectionStart + "," + mSelectionEnd
+ " mComposingTextStart=" + mComposingTextStart
+ " mComposingText=" + Objects.toString(mComposingText)
+ " mInsertionMarkerFlags=" + mInsertionMarkerFlags
+ " mInsertionMarkerHorizontal=" + mInsertionMarkerHorizontal
+ " mInsertionMarkerTop=" + mInsertionMarkerTop
+ " mInsertionMarkerBaseline=" + mInsertionMarkerBaseline
+ " mInsertionMarkerBottom=" + mInsertionMarkerBottom
+ " mCharacterBoundsArray=" + Objects.toString(mCharacterBoundsArray)
+ " mMatrix=" + Objects.toString(mMatrix)
+ "}";
|
public void | writeToParcel(android.os.Parcel dest, int flags)Used to package this object into a {@link Parcel}.
dest.writeInt(mSelectionStart);
dest.writeInt(mSelectionEnd);
dest.writeInt(mComposingTextStart);
TextUtils.writeToParcel(mComposingText, dest, flags);
dest.writeInt(mInsertionMarkerFlags);
dest.writeFloat(mInsertionMarkerHorizontal);
dest.writeFloat(mInsertionMarkerTop);
dest.writeFloat(mInsertionMarkerBaseline);
dest.writeFloat(mInsertionMarkerBottom);
dest.writeParcelable(mCharacterBoundsArray, flags);
final float[] matrixArray = new float[9];
mMatrix.getValues(matrixArray);
dest.writeFloatArray(matrixArray);
|