TranslationResponse.Builder
  public
  static
  final
  
  class
  TranslationResponse.Builder
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | android.view.translation.TranslationResponse.Builder | 
A builder for TranslationResponse
Summary
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 constructors
Builder
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 methods
build
public TranslationResponse build ()
Builds the instance. This builder should not be touched after calling this!
| Returns | |
|---|---|
TranslationResponse | 
        This value cannot be null. | 
      
setFinalResponse
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. | 
      
setTranslationResponseValue
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. | 
      
setTranslationResponseValues
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. | 
      
setViewTranslationResponse
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. | 
      
setViewTranslationResponses
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. |