Added in API level 31

TranslationCapability


class TranslationCapability : Parcelable

Capability class holding information for a pair of TranslationSpecs.

Holds information and limitations on how to create a TranslationContext which can be used by TranslationManager.createOnDeviceTranslator(TranslationContext, Executor, Consumer).

Summary

Constants
static Int

The translation service supports translation between the source and target specs, and it is ready to be downloaded onto the device.

static Int

The translation service supports translation between the source and target specs, and it is being downloaded onto the device currently.

static Int

The translation service does not support translation between the source and target specs.

static Int

The translation service supports translation between the source and target specs, and it is downloaded and ready to use on device.

Inherited constants
Int CONTENTS_FILE_DESCRIPTOR

Descriptor bit used with describeContents(): indicates that the Parcelable object's flattened representation includes a file descriptor.

Int PARCELABLE_WRITE_RETURN_VALUE

Flag for use with writeToParcel: the object being written is a return value, that is the result of a function such as "Parcelable someFunction()", "void someFunction(out Parcelable)", or "void someFunction(inout Parcelable)". Some implementations may want to release resources at this point.

Public methods
Int

TranslationSpec

TranslationSpec describing the source data specs for this capability.

Int

The state of translation readiness between mSourceSpec and mTargetSpec.

Int

Translation flags for settings that are supported by the translation service between the TranslationSpecs provided in this capability.

TranslationSpec

TranslationSpec describing the target data specs for this capability.

Boolean

Whether ui translation for the source-target TranslationSpecs is enabled.

String

Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Constants

STATE_AVAILABLE_TO_DOWNLOAD

Added in API level 31
static val STATE_AVAILABLE_TO_DOWNLOAD: Int

The translation service supports translation between the source and target specs, and it is ready to be downloaded onto the device.
Value is android.view.translation.TranslationCapability#STATE_AVAILABLE_TO_DOWNLOAD, android.view.translation.TranslationCapability#STATE_DOWNLOADING, android.view.translation.TranslationCapability#STATE_ON_DEVICE, android.view.translation.TranslationCapability#STATE_NOT_AVAILABLE, or android.view.translation.TranslationCapability.STATE_REMOVED_AND_AVAILABLE

Value: 1

STATE_DOWNLOADING

Added in API level 31
static val STATE_DOWNLOADING: Int

The translation service supports translation between the source and target specs, and it is being downloaded onto the device currently.
Value is android.view.translation.TranslationCapability#STATE_AVAILABLE_TO_DOWNLOAD, android.view.translation.TranslationCapability#STATE_DOWNLOADING, android.view.translation.TranslationCapability#STATE_ON_DEVICE, android.view.translation.TranslationCapability#STATE_NOT_AVAILABLE, or android.view.translation.TranslationCapability.STATE_REMOVED_AND_AVAILABLE

Value: 2

STATE_NOT_AVAILABLE

Added in API level 31
static val STATE_NOT_AVAILABLE: Int

The translation service does not support translation between the source and target specs.

Note: This state is not returned from calling TranslationManager.getOnDeviceTranslationCapabilities. This state will only appear as part of capability updates from TranslationManager.addOnDeviceTranslationCapabilityUpdateListener if existing support was dropped.


Value is android.view.translation.TranslationCapability#STATE_AVAILABLE_TO_DOWNLOAD, android.view.translation.TranslationCapability#STATE_DOWNLOADING, android.view.translation.TranslationCapability#STATE_ON_DEVICE, android.view.translation.TranslationCapability#STATE_NOT_AVAILABLE, or android.view.translation.TranslationCapability.STATE_REMOVED_AND_AVAILABLE
Value: 4

STATE_ON_DEVICE

Added in API level 31
static val STATE_ON_DEVICE: Int

The translation service supports translation between the source and target specs, and it is downloaded and ready to use on device.
Value is android.view.translation.TranslationCapability#STATE_AVAILABLE_TO_DOWNLOAD, android.view.translation.TranslationCapability#STATE_DOWNLOADING, android.view.translation.TranslationCapability#STATE_ON_DEVICE, android.view.translation.TranslationCapability#STATE_NOT_AVAILABLE, or android.view.translation.TranslationCapability.STATE_REMOVED_AND_AVAILABLE

Value: 3

Public methods

describeContents

Added in API level 31
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

getSourceSpec

Added in API level 31
fun getSourceSpec(): TranslationSpec

TranslationSpec describing the source data specs for this capability.

Return
TranslationSpec This value cannot be null.

getState

Added in API level 31
fun getState(): Int

The state of translation readiness between mSourceSpec and mTargetSpec.

getSupportedTranslationFlags

Added in API level 31
fun getSupportedTranslationFlags(): Int

Translation flags for settings that are supported by the translation service between the TranslationSpecs provided in this capability.

getTargetSpec

Added in API level 31
fun getTargetSpec(): TranslationSpec

TranslationSpec describing the target data specs for this capability.

Return
TranslationSpec This value cannot be null.

isUiTranslationEnabled

Added in API level 31
fun isUiTranslationEnabled(): Boolean

Whether ui translation for the source-target TranslationSpecs is enabled.

Translation service will still support translation requests for this capability.

toString

Added in API level 31
fun toString(): String
Return
String a string representation of the object.

writeToParcel

Added in API level 31
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

Properties

CREATOR

Added in API level 31
static val CREATOR: Parcelable.Creator<TranslationCapability!>