TextBoundsInfoResult


public final class TextBoundsInfoResult
extends Object

java.lang.Object
   ↳ android.view.inputmethod.TextBoundsInfoResult


The object that holds the result of the InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) call.

Summary

Constants

int CODE_CANCELLED

Result for InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) when the request is cancelled.

int CODE_FAILED

Result for InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) when the request failed.

int CODE_SUCCESS

Result for InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) when the editor successfully returns a TextBoundsInfo.

int CODE_UNSUPPORTED

Result for InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) when the editor doesn't implement the method.

Public constructors

TextBoundsInfoResult(int resultCode)

Create a TextBoundsInfoResult object with no TextBoundsInfo.

TextBoundsInfoResult(int resultCode, TextBoundsInfo textBoundsInfo)

Create a TextBoundsInfoResult object.

Public methods

int getResultCode()

Return the result code of the InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) call.

TextBoundsInfo getTextBoundsInfo()

Return the TextBoundsInfo provided by the editor.

Inherited methods

Constants

CODE_CANCELLED

Added in API level 34
public static final int CODE_CANCELLED

Result for InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) when the request is cancelled. This happens when the InputConnection is or becomes invalidated while requesting the TextBoundsInfo, for example because a new InputConnection was started, or due to InputMethodManager#invalidateInput.

Constant Value: 3 (0x00000003)

CODE_FAILED

Added in API level 34
public static final int CODE_FAILED

Result for InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) when the request failed. This result code is returned when the editor can't provide a valid TextBoundsInfo. (e.g. The editor view is not laid out.)

Constant Value: 2 (0x00000002)

CODE_SUCCESS

Added in API level 34
public static final int CODE_SUCCESS

Result for InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) when the editor successfully returns a TextBoundsInfo.

Constant Value: 1 (0x00000001)

CODE_UNSUPPORTED

Added in API level 34
public static final int CODE_UNSUPPORTED

Result for InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) when the editor doesn't implement the method.

Constant Value: 0 (0x00000000)

Public constructors

TextBoundsInfoResult

Added in API level 34
public TextBoundsInfoResult (int resultCode)

Create a TextBoundsInfoResult object with no TextBoundsInfo. The given resultCode can't be CODE_SUCCESS.

Parameters
resultCode int: the result code of the InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) call. Value is CODE_UNSUPPORTED, CODE_SUCCESS, CODE_FAILED, or CODE_CANCELLED

TextBoundsInfoResult

Added in API level 34
public TextBoundsInfoResult (int resultCode, 
                TextBoundsInfo textBoundsInfo)

Create a TextBoundsInfoResult object.

Parameters
resultCode int: the result code of the InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) call. Value is CODE_UNSUPPORTED, CODE_SUCCESS, CODE_FAILED, or CODE_CANCELLED

textBoundsInfo TextBoundsInfo: the returned TextBoundsInfo of the InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) call. It can't be null if the resultCode is CODE_SUCCESS.

Throws
IllegalStateException if the resultCode is CODE_SUCCESS but the given textBoundsInfo is null.

Public methods

getResultCode

Added in API level 34
public int getResultCode ()

Return the result code of the InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) call. Its value is one of the CODE_UNSUPPORTED, CODE_SUCCESS, CODE_FAILED and CODE_CANCELLED.

Returns
int Value is CODE_UNSUPPORTED, CODE_SUCCESS, CODE_FAILED, or CODE_CANCELLED

getTextBoundsInfo

Added in API level 34
public TextBoundsInfo getTextBoundsInfo ()

Return the TextBoundsInfo provided by the editor. It is non-null if the resultCode is CODE_SUCCESS. Otherwise, it can be null in the following conditions: