SuggestionSpan
open class SuggestionSpan : CharacterStyle, ParcelableSpan
kotlin.Any | ||
↳ | android.text.style.CharacterStyle | |
↳ | android.text.style.SuggestionSpan |
Holds suggestion candidates for the text enclosed in this span. When such a span is edited in an EditText, double tapping on the text enclosed in this span will display a popup dialog listing suggestion replacement for that text. The user can then replace the original text by one of the suggestions. These spans should typically be created by the input method to provide correction and alternates for the text.
Summary
Constants | |
---|---|
static String |
This action is deprecated in |
static Int |
Sets this flag if the auto correction is about to be applied to a word/text that the user is typing/composing. |
static Int |
Sets this flag if the suggestions should be easily accessible with few interactions. |
static Int |
Sets this flag if the suggestions apply to a grammar error. |
static Int |
Sets this flag if the suggestions apply to a misspelled word/text. |
static Int | |
static String |
This is deprecated in |
static String |
This is deprecated in |
static String |
This is deprecated in |
Public constructors | |
---|---|
SuggestionSpan(context: Context!, suggestions: Array<String!>!, flags: Int) |
|
SuggestionSpan(src: Parcel!) |
|
SuggestionSpan(locale: Locale!, suggestions: Array<String!>!, flags: Int) |
Public methods | |
---|---|
open Int | |
open Boolean |
Indicates whether some other object is "equal to" this one. |
open Int |
getFlags() |
open String | |
open Locale? |
Returns a well-formed BCP 47 language tag representation of the suggestions, as a |
open Int | |
open Array<String!>! | |
open Int | |
open Int |
hashCode() |
open Unit | |
open Unit |
updateDrawState(tp: TextPaint!) |
open Unit |
writeToParcel(dest: Parcel, flags: Int) |
Inherited functions | |
---|---|
Properties | |
---|---|
static Parcelable.Creator<SuggestionSpan!> |
Constants
ACTION_SUGGESTION_PICKED
static valACTION_SUGGESTION_PICKED: String
Deprecated: For IMEs to receive this kind of user interaction signals, implement IMEs' own suggestion picker UI instead of relying on SuggestionSpan
. To retrieve bounding boxes for each character of the composing text, use android.view.inputmethod.CursorAnchorInfo
.
This action is deprecated in android.os.Build.VERSION_CODES#Q
.
Value: "android.text.style.SUGGESTION_PICKED"
FLAG_AUTO_CORRECTION
static val FLAG_AUTO_CORRECTION: Int
Sets this flag if the auto correction is about to be applied to a word/text that the user is typing/composing. This type of suggestion is rendered differently to indicate the auto correction is happening.
Value: 4
FLAG_EASY_CORRECT
static val FLAG_EASY_CORRECT: Int
Sets this flag if the suggestions should be easily accessible with few interactions. This flag should be set for every suggestions that the user is likely to use.
Value: 1
FLAG_GRAMMAR_ERROR
static val FLAG_GRAMMAR_ERROR: Int
Sets this flag if the suggestions apply to a grammar error. This type of suggestion is rendered differently to highlight the error.
Value: 8
FLAG_MISSPELLED
static val FLAG_MISSPELLED: Int
Sets this flag if the suggestions apply to a misspelled word/text. This type of suggestion is rendered differently to highlight the error.
Value: 2
SUGGESTION_SPAN_PICKED_AFTER
static valSUGGESTION_SPAN_PICKED_AFTER: String
Deprecated: See ACTION_SUGGESTION_PICKED
.
This is deprecated in android.os.Build.VERSION_CODES#Q
.
Value: "after"
SUGGESTION_SPAN_PICKED_BEFORE
static valSUGGESTION_SPAN_PICKED_BEFORE: String
Deprecated: See ACTION_SUGGESTION_PICKED
.
This is deprecated in android.os.Build.VERSION_CODES#Q
.
Value: "before"
SUGGESTION_SPAN_PICKED_HASHCODE
static valSUGGESTION_SPAN_PICKED_HASHCODE: String
Deprecated: See ACTION_SUGGESTION_PICKED
.
This is deprecated in android.os.Build.VERSION_CODES#Q
.
Value: "hashcode"
Public constructors
SuggestionSpan
SuggestionSpan(
context: Context!,
suggestions: Array<String!>!,
flags: Int)
Parameters | |
---|---|
context |
Context!: Context for the application |
suggestions |
Array<String!>!: Suggestions for the string under the span |
flags |
Int: Additional flags indicating how this span is handled in TextView |
SuggestionSpan
SuggestionSpan(
context: Context!,
locale: Locale!,
suggestions: Array<String!>!,
flags: Int,
notificationTargetClass: Class<*>!)
Parameters | |
---|---|
context |
Context!: Context for the application |
locale |
Locale!: locale Locale of the suggestions |
suggestions |
Array<String!>!: Suggestions for the string under the span. Only the first up to SuggestionSpan.SUGGESTIONS_MAX_SIZE will be considered. Null values not permitted. |
flags |
Int: Additional flags indicating how this span is handled in TextView |
notificationTargetClass |
Class<*>!: if not null, this class will get notified when the user selects one of the suggestions. On Android android.os.Build.VERSION_CODES#Q and later this parameter is always ignored. |
SuggestionSpan
SuggestionSpan(
locale: Locale!,
suggestions: Array<String!>!,
flags: Int)
Parameters | |
---|---|
locale |
Locale!: Locale of the suggestions |
suggestions |
Array<String!>!: Suggestions for the string under the span |
flags |
Int: Additional flags indicating how this span is handled in TextView |
Public methods
describeContents
open fun describeContents(): Int
Return | |
---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
equals
open fun equals(other: Any?): Boolean
Indicates whether some other object is "equal to" this one.
The equals
method implements an equivalence relation on non-null object references:
- It is reflexive: for any non-null reference value
x
,x.equals(x)
should returntrue
. - It is symmetric: for any non-null reference values
x
andy
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any non-null reference values
x
,y
, andz
, ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
. - It is consistent: for any non-null reference values
x
andy
, multiple invocations ofx.equals(y)
consistently returntrue
or consistently returnfalse
, provided no information used inequals
comparisons on the objects is modified. - For any non-null reference value
x
,x.equals(null)
should returnfalse
.
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
Parameters | |
---|---|
obj |
the reference object with which to compare. |
o |
This value may be null . |
Return | |
---|---|
Boolean |
true if this object is the same as the obj argument; false otherwise. |
getLocale
open fungetLocale(): String
Deprecated: use getLocaleObject()
instead.
Return | |
---|---|
String |
the locale of the suggestions. An empty string is returned if no locale is specified. This value cannot be null . |
getLocaleObject
open fun getLocaleObject(): Locale?
Returns a well-formed BCP 47 language tag representation of the suggestions, as a Locale
object.
Caveat: The returned object is guaranteed to be a a well-formed BCP 47 language tag representation. For example, this method can return an empty locale rather than returning a malformed data when this object is initialized with an malformed Locale
object, e.g. new Locale(" a ", " b c d ", " "
.
Return | |
---|---|
Locale? |
the locale of the suggestions. null is returned if no locale is specified. |
getSuggestions
open fun getSuggestions(): Array<String!>!
Return | |
---|---|
Array<String!>! |
an array of suggestion texts for this span |
getUnderlineColor
open fun getUnderlineColor(): Int
Return | |
---|---|
Int |
The color of the underline for that span, or 0 if there is no underline |
hashCode
open fun hashCode(): Int
Return | |
---|---|
Int |
a hash code value for this object. |
writeToParcel
open fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
Parameters | |
---|---|
dest |
Parcel: The Parcel in which the object should be written. This value cannot be null . |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE . Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |