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