TranslationRequest
class TranslationRequest : Parcelable
| kotlin.Any | |
| ↳ | android.view.translation.TranslationRequest |
Translation request sent to the translation service by the android.view.translation.Translator which contains the text to be translated.
Summary
| Nested classes | |
|---|---|
|
A builder for |
|
| Constants | |
|---|---|
| static Int |
Indicates this request wants to receive the dictionary result. |
| static Int |
Indicates this request is willing to accept partial responses. |
| static Int |
Indicates this request wants to receive the standard translation result. |
| static Int |
Indicates this request wants to receive the transliteration result. |
| Inherited constants | |
|---|---|
| Public methods | |
|---|---|
| Int | |
| Int |
getFlags()Request flags. |
| MutableList<TranslationRequestValue!> |
List of |
| MutableList<ViewTranslationRequest!> |
List of |
| String |
toString() |
| Unit |
writeToParcel(dest: Parcel, flags: Int)Flatten this object in to a Parcel. |
| Properties | |
|---|---|
| static Parcelable.Creator<TranslationRequest!> | |
Constants
FLAG_DICTIONARY_RESULT
static val FLAG_DICTIONARY_RESULT: Int
Indicates this request wants to receive the dictionary result.
See TranslationResponseValue.EXTRA_DEFINITIONS for more detail on the structure of the returned data.
Value is either 0 or a combination of android.view.translation.TranslationRequest#FLAG_TRANSLATION_RESULT, android.view.translation.TranslationRequest#FLAG_DICTIONARY_RESULT, android.view.translation.TranslationRequest#FLAG_TRANSLITERATION_RESULT, and android.view.translation.TranslationRequest#FLAG_PARTIAL_RESPONSES
Value: 2FLAG_PARTIAL_RESPONSES
static val FLAG_PARTIAL_RESPONSES: Int
Indicates this request is willing to accept partial responses.
The partial responses can be accessed by TranslationResponse.getTranslationResponseValues() or TranslationResponse.getViewTranslationResponses(). These responses will each contain only a subset of the corresponding translated values.
The are no guarantees to the number of translated values or the order in which these values are returned in the TranslationResponse.
This flag denotes the client can expect multiple partial responses, but there may not necessarily be multiple responses.
Value is either
0 or a combination of android.view.translation.TranslationRequest#FLAG_TRANSLATION_RESULT, android.view.translation.TranslationRequest#FLAG_DICTIONARY_RESULT, android.view.translation.TranslationRequest#FLAG_TRANSLITERATION_RESULT, and android.view.translation.TranslationRequest#FLAG_PARTIAL_RESPONSES
Value: 8FLAG_TRANSLATION_RESULT
static val FLAG_TRANSLATION_RESULT: Int
Indicates this request wants to receive the standard translation result.
Value is either 0 or a combination of android.view.translation.TranslationRequest#FLAG_TRANSLATION_RESULT, android.view.translation.TranslationRequest#FLAG_DICTIONARY_RESULT, android.view.translation.TranslationRequest#FLAG_TRANSLITERATION_RESULT, and android.view.translation.TranslationRequest#FLAG_PARTIAL_RESPONSES
Value: 1FLAG_TRANSLITERATION_RESULT
static val FLAG_TRANSLITERATION_RESULT: Int
Indicates this request wants to receive the transliteration result.
This returns a CharSequence representation of the transliteration of the translated text. See TranslationResponseValue.getTransliteration().
Value is either 0 or a combination of android.view.translation.TranslationRequest#FLAG_TRANSLATION_RESULT, android.view.translation.TranslationRequest#FLAG_DICTIONARY_RESULT, android.view.translation.TranslationRequest#FLAG_TRANSLITERATION_RESULT, and android.view.translation.TranslationRequest#FLAG_PARTIAL_RESPONSES
Value: 4Public methods
describeContents
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 |
getFlags
fun getFlags(): Int
Request flags. FLAG_TRANSLATION_RESULT by default.
getTranslationRequestValues
fun getTranslationRequestValues(): MutableList<TranslationRequestValue!>
List of TranslationRequestValues to be translated. The index of entries in this list will be their respective key in the android.util.SparseArray returned by calling TranslationResponse.getTranslationResponseValues().
| Return | |
|---|---|
MutableList<TranslationRequestValue!> |
This value cannot be null. |
getViewTranslationRequests
fun getViewTranslationRequests(): MutableList<ViewTranslationRequest!>
List of ViewTranslationRequests to be translated. The index of entries in this list will be their respective key in the android.util.SparseArray returned by calling TranslationResponse.getViewTranslationResponses().
| Return | |
|---|---|
MutableList<ViewTranslationRequest!> |
This value cannot be null. |
toString
fun toString(): String
| Return | |
|---|---|
String |
a string representation of the object. |
writeToParcel
fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
Flatten this object in to a Parcel.
| Parameters | |
|---|---|
dest |
Parcel: 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 |