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 |
int |
CODE_FAILED
Result for |
int |
CODE_SUCCESS
Result for |
int |
CODE_UNSUPPORTED
Result for |
Public constructors | |
---|---|
TextBoundsInfoResult(int resultCode)
Create a |
|
TextBoundsInfoResult(int resultCode, TextBoundsInfo textBoundsInfo)
Create a |
Public methods | |
---|---|
int
|
getResultCode()
Return the result code of the
|
TextBoundsInfo
|
getTextBoundsInfo()
Return the |
Inherited methods | |
---|---|
Constants
CODE_CANCELLED
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
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
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
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
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
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
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
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:
- the editor doesn't support
InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer)
. - the editor doesn't have the text bounds information at the moment. (e.g. the editor view is not laid out yet.)
- the
InputConnection
is or become inactive during the request.
Returns | |
---|---|
TextBoundsInfo |