SelectionBuilder
@RequiresApi(19) open class SelectionBuilder
kotlin.Any | |
↳ | androidx.slice.builders.SelectionBuilder |
Builder to construct a selection which can be added to a ListBuilder
. A selection presents a list of options to the user and allows the user to select exactly one option.
Summary
Public constructors | |
---|---|
<init>() Creates a SelectionBuilder with no options. |
Public methods | |
---|---|
open SelectionBuilder! |
addOption(optionKey: String!, optionText: CharSequence!) Adds an option to this SelectionBuilder. |
open SelectionBuilder! |
setContentDescription(@Nullable contentDescription: CharSequence?) Sets the content description. |
open SelectionBuilder! |
setInputAction(@NonNull inputAction: PendingIntent) Sets the |
open SelectionBuilder! |
setInputAction(@NonNull inputAction: RemoteCallback) Sets the |
open SelectionBuilder! |
setLayoutDirection(layoutDirection: Int) Sets the layout direction. |
open SelectionBuilder! |
setPrimaryAction(@NonNull primaryAction: SliceAction) Sets the primary action for the selection slice. |
open SelectionBuilder! |
setSelectedOption(selectedOption: String!) Sets which option is selected by default. |
open SelectionBuilder! |
setSubtitle(@Nullable subtitle: CharSequence?) Sets the subtitle. |
open SelectionBuilder! |
setTitle(@Nullable title: CharSequence?) Sets the title. |
Public constructors
<init>
SelectionBuilder()
Creates a SelectionBuilder with no options.
Public methods
addOption
open fun addOption(
optionKey: String!,
optionText: CharSequence!
): SelectionBuilder!
Adds an option to this SelectionBuilder. The new option will be appended to the list of options.
Parameters | |
---|---|
optionKey |
String!: the key that will be returned if the user selects this option |
optionText |
CharSequence!: the text that will be displayed to the user for this option |
Return | |
---|---|
SelectionBuilder! |
this SelectionBuilder |
setContentDescription
open fun setContentDescription(@Nullable contentDescription: CharSequence?): SelectionBuilder!
Sets the content description.
Parameters | |
---|---|
contentDescription |
CharSequence?: the content description |
Return | |
---|---|
SelectionBuilder! |
this SelectionBuilder |
setInputAction
open fun setInputAction(@NonNull inputAction: PendingIntent): SelectionBuilder!
Sets the PendingIntent
to send when the selection is made or changed. The intent will include an extra with the key androidx.slice.Slice#EXTRA_SELECTION
and a String
value containing the key of the key of the selected option.
Parameters | |
---|---|
inputAction |
PendingIntent: the intent to send when the user makes or changes the selection |
Return | |
---|---|
SelectionBuilder! |
this SelectionBuilder |
setInputAction
open fun setInputAction(@NonNull inputAction: RemoteCallback): SelectionBuilder!
Sets the RemoteCallback
to send when the selection is made or changed. The intent will include an extra with the key androidx.slice.Slice#EXTRA_SELECTION
and a String
value containing the key of the key of the selected option.
Parameters | |
---|---|
inputAction |
RemoteCallback: the intent to send when the user makes or changes the selection |
Return | |
---|---|
SelectionBuilder! |
this SelectionBuilder |
setLayoutDirection
open fun setLayoutDirection(layoutDirection: Int): SelectionBuilder!
Sets the layout direction.
Parameters | |
---|---|
layoutDirection |
Int: the layout direction |
Return | |
---|---|
SelectionBuilder! |
this SelectionBuilder |
setPrimaryAction
open fun setPrimaryAction(@NonNull primaryAction: SliceAction): SelectionBuilder!
Sets the primary action for the selection slice. The action specified here will be sent when the whole slice is clicked, or when the app presenting the slice is not capable of rendering a selection interface.
Parameters | |
---|---|
primaryAction |
SliceAction: the action to trigger when the user clicks the whole slice |
Return | |
---|---|
SelectionBuilder! |
this SelectionBuilder |
setSelectedOption
open fun setSelectedOption(selectedOption: String!): SelectionBuilder!
Sets which option is selected by default.
Parameters | |
---|---|
selectedOption |
String!: the key of the selected option |
Return | |
---|---|
SelectionBuilder! |
this SelectionBuilder |
setSubtitle
open fun setSubtitle(@Nullable subtitle: CharSequence?): SelectionBuilder!
Sets the subtitle.
Parameters | |
---|---|
subtitle |
CharSequence?: the subtitle |
Return | |
---|---|
SelectionBuilder! |
this SelectionBuilder |
setTitle
open fun setTitle(@Nullable title: CharSequence?): SelectionBuilder!
Sets the title.
Parameters | |
---|---|
title |
CharSequence?: the title |
Return | |
---|---|
SelectionBuilder! |
this SelectionBuilder |