TextBoundsInfoResult
class TextBoundsInfoResult
kotlin.Any | |
↳ | android.view.inputmethod.TextBoundsInfoResult |
The object that holds the result of the InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer)
call.
Summary
Constants | |
---|---|
static Int |
Result for |
static Int |
Result for |
static Int |
Result for |
static Int |
Result for |
Public constructors | |
---|---|
TextBoundsInfoResult(resultCode: Int) Create a |
|
TextBoundsInfoResult(resultCode: Int, textBoundsInfo: TextBoundsInfo?) Create a |
Public methods | |
---|---|
Int |
Return the result code of the |
TextBoundsInfo? |
Return the |
Constants
CODE_CANCELLED
static val CODE_CANCELLED: Int
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
.
Value: 3
CODE_FAILED
static val CODE_FAILED: Int
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.)
Value: 2
CODE_SUCCESS
static val CODE_SUCCESS: Int
Result for InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer)
when the editor successfully returns a TextBoundsInfo
.
Value: 1
CODE_UNSUPPORTED
static val CODE_UNSUPPORTED: Int
Result for InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer)
when the editor doesn't implement the method.
Value: 0
Public constructors
TextBoundsInfoResult
TextBoundsInfoResult(resultCode: Int)
Create a TextBoundsInfoResult
object with no TextBoundsInfo
. The given resultCode
can't be CODE_SUCCESS
.
TextBoundsInfoResult
TextBoundsInfoResult(
resultCode: Int,
textBoundsInfo: TextBoundsInfo?)
Create a TextBoundsInfoResult
object.
Parameters | |
---|---|
resultCode |
Int: the result code of the InputConnection#requestTextBoundsInfo(RectF, Executor, Consumer) call. Value is android.view.inputmethod.TextBoundsInfoResult#CODE_UNSUPPORTED , android.view.inputmethod.TextBoundsInfoResult#CODE_SUCCESS , android.view.inputmethod.TextBoundsInfoResult#CODE_FAILED , or android.view.inputmethod.TextBoundsInfoResult#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 . |
Exceptions | |
---|---|
java.lang.IllegalStateException |
if the resultCode is CODE_SUCCESS but the given textBoundsInfo is null. |
Public methods
getResultCode
fun getResultCode(): Int
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
.
getTextBoundsInfo
fun getTextBoundsInfo(): TextBoundsInfo?
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.