Builder
class Builder
kotlin.Any | |
↳ | android.view.translation.TranslationResponse.Builder |
A builder for TranslationResponse
Summary
Public constructors | |
---|---|
Creates a new Builder. |
Public methods | |
---|---|
TranslationResponse |
build() Builds the instance. |
TranslationResponse.Builder |
setFinalResponse(value: Boolean) Whether this response contains complete translated values, or is the final response in a series of partial responses. |
TranslationResponse.Builder |
setTranslationResponseValue(index: Int, value: TranslationResponseValue) Adds |
TranslationResponse.Builder |
List of translated |
TranslationResponse.Builder |
setViewTranslationResponse(index: Int, response: ViewTranslationResponse) Sets the list of |
TranslationResponse.Builder |
List of translated |
Public constructors
Builder
Builder(translationStatus: Int)
Creates a new Builder.
Parameters | |
---|---|
translationStatus |
Int: The translation result status code. Value is android.view.translation.TranslationResponse#TRANSLATION_STATUS_SUCCESS , android.view.translation.TranslationResponse#TRANSLATION_STATUS_UNKNOWN_ERROR , or android.view.translation.TranslationResponse#TRANSLATION_STATUS_CONTEXT_UNSUPPORTED |
Public methods
build
fun build(): TranslationResponse
Builds the instance. This builder should not be touched after calling this!
Return | |
---|---|
TranslationResponse |
This value cannot be null . |
setFinalResponse
fun setFinalResponse(value: Boolean): TranslationResponse.Builder
Whether this response contains complete translated values, or is the final response in a series of partial responses.
This is true
by default.
Return | |
---|---|
TranslationResponse.Builder |
This value cannot be null . |
setTranslationResponseValue
fun setTranslationResponseValue(
index: Int,
value: TranslationResponseValue
): TranslationResponse.Builder
Adds TranslationResponseValue
to be translated. The input TranslationResponseValue format should match those provided by the android.view.translation.Translator
's targetSpec.
Parameters | |
---|---|
value |
TranslationResponseValue: the translated value. This value cannot be null . |
Return | |
---|---|
TranslationResponse.Builder |
this Builder. This value cannot be null . |
setTranslationResponseValues
fun setTranslationResponseValues(value: SparseArray<TranslationResponseValue!>): TranslationResponse.Builder
List of translated TranslationResponseValue
s. The key of entries in this list will be their respective index in TranslationRequest#getTranslationRequestValues()
.
Parameters | |
---|---|
value |
SparseArray<TranslationResponseValue!>: This value cannot be null . |
Return | |
---|---|
TranslationResponse.Builder |
This value cannot be null . |
setViewTranslationResponse
fun setViewTranslationResponse(
index: Int,
response: ViewTranslationResponse
): TranslationResponse.Builder
Sets the list of ViewTranslationResponse
to be translated. The input ViewTranslationResponse contains TranslationResponseValue
s whose format should match those provided by the android.view.translation.Translator
's targetSpec.
Parameters | |
---|---|
response |
ViewTranslationResponse: the translated response. This value cannot be null . |
Return | |
---|---|
TranslationResponse.Builder |
this Builder. This value cannot be null . |
setViewTranslationResponses
fun setViewTranslationResponses(value: SparseArray<ViewTranslationResponse!>): TranslationResponse.Builder
List of translated ViewTranslationResponse
s. The key of entries in this list will be their respective index in TranslationRequest#getViewTranslationRequests()
.
Parameters | |
---|---|
value |
SparseArray<ViewTranslationResponse!>: This value cannot be null . |
Return | |
---|---|
TranslationResponse.Builder |
This value cannot be null . |