InlineSuggestionsRequest.Builder

public static final class InlineSuggestionsRequest.Builder
extends Object

java.lang.Object
   ↳ android.view.inputmethod.InlineSuggestionsRequest.Builder


A builder for InlineSuggestionsRequest

Summary

Public constructors

Builder(List<InlinePresentationSpec> inlinePresentationSpecs)

Creates a new Builder.

Public methods

InlineSuggestionsRequest.Builder addInlinePresentationSpecs(InlinePresentationSpec value)
InlineSuggestionsRequest build()

Builds the instance.

InlineSuggestionsRequest.Builder setExtras(Bundle value)

The extras state propagated from the IME to pass extra data.

InlineSuggestionsRequest.Builder setInlinePresentationSpecs(List<InlinePresentationSpec> value)

The InlinePresentationSpec for each suggestion in the response.

InlineSuggestionsRequest.Builder setInlineTooltipPresentationSpec(InlinePresentationSpec value)

Specifies the UI specification for the inline suggestion tooltip in the response.

InlineSuggestionsRequest.Builder setMaxSuggestionCount(int value)

Max number of suggestions expected from the response.

InlineSuggestionsRequest.Builder setSupportedLocales(LocaleList value)

The IME provided locales for the request.

Inherited methods

Public constructors

Builder

Added in API level 30
public Builder (List<InlinePresentationSpec> inlinePresentationSpecs)

Creates a new Builder.

Parameters
inlinePresentationSpecs List: The InlinePresentationSpec for each suggestion in the response. If the max suggestion count is larger than the number of specs in the list, then the last spec is used for the remainder of the suggestions. The list should not be empty. This value cannot be null.

Public methods

addInlinePresentationSpecs

Added in API level 30
public InlineSuggestionsRequest.Builder addInlinePresentationSpecs (InlinePresentationSpec value)

Parameters
value InlinePresentationSpec: This value cannot be null.

Returns
InlineSuggestionsRequest.Builder This value cannot be null.

build

Added in API level 30
public InlineSuggestionsRequest build ()

Builds the instance. This builder should not be touched after calling this!

Returns
InlineSuggestionsRequest This value cannot be null.

setExtras

Added in API level 30
public InlineSuggestionsRequest.Builder setExtras (Bundle value)

The extras state propagated from the IME to pass extra data.

Note: There should be no remote objects in the bundle, all included remote objects will be removed from the bundle before transmission.

Parameters
value Bundle: This value cannot be null.

Returns
InlineSuggestionsRequest.Builder This value cannot be null.

setInlinePresentationSpecs

Added in API level 30
public InlineSuggestionsRequest.Builder setInlinePresentationSpecs (List<InlinePresentationSpec> value)

The InlinePresentationSpec for each suggestion in the response. If the max suggestion count is larger than the number of specs in the list, then the last spec is used for the remainder of the suggestions. The list should not be empty.

Parameters
value List: This value cannot be null.

Returns
InlineSuggestionsRequest.Builder This value cannot be null.

setInlineTooltipPresentationSpec

Added in API level 31
public InlineSuggestionsRequest.Builder setInlineTooltipPresentationSpec (InlinePresentationSpec value)

Specifies the UI specification for the inline suggestion tooltip in the response.

Parameters
value InlinePresentationSpec: This value cannot be null.

Returns
InlineSuggestionsRequest.Builder This value cannot be null.

setMaxSuggestionCount

Added in API level 30
public InlineSuggestionsRequest.Builder setMaxSuggestionCount (int value)

Max number of suggestions expected from the response. It must be a positive value. Defaults to SUGGESTION_COUNT_UNLIMITED if not set.

In practice, it is recommended that the max suggestion count does not exceed 5 for performance reasons.

Parameters
value int

Returns
InlineSuggestionsRequest.Builder This value cannot be null.

setSupportedLocales

Added in API level 30
public InlineSuggestionsRequest.Builder setSupportedLocales (LocaleList value)

The IME provided locales for the request. If non-empty, the inline suggestions should return languages from the supported locales. If not provided, it'll default to be empty if target SDK is S or above, and default to system locale otherwise.

Note for Autofill Providers: It is recommended for the returned inline suggestions to have one locale to guarantee consistent UI rendering.

Parameters
value LocaleList: This value cannot be null.

Returns
InlineSuggestionsRequest.Builder This value cannot be null.