PickVisualMediaRequest.Builder


class PickVisualMediaRequest.Builder


A builder for constructing PickVisualMediaRequest instances.

Summary

Public constructors

Public functions

PickVisualMediaRequest

Build the PickVisualMediaRequest specified by this builder.

PickVisualMediaRequest.Builder
setAccentColor(accentColor: Long)

Set the accent color for the PickVisualMediaRequest.

PickVisualMediaRequest.Builder

Set the default tab for the PickVisualMediaRequest.

PickVisualMediaRequest.Builder
setMaxItems(maxItems: @IntRange(from = 2) Int)

Limit the number of selectable items in the photo picker when using PickMultipleVisualMedia

PickVisualMediaRequest.Builder

Set the media type for the PickVisualMediaRequest.

PickVisualMediaRequest.Builder
setOrderedSelection(isOrderedSelection: Boolean)

Set the ordered selection for the PickVisualMediaRequest.

Public constructors

Builder

Added in 1.6.0
Builder()

Public functions

build

Added in 1.6.0
fun build(): PickVisualMediaRequest

Build the PickVisualMediaRequest specified by this builder.

Returns
PickVisualMediaRequest

the newly constructed PickVisualMediaRequest.

setAccentColor

Added in 1.10.0-rc01
fun setAccentColor(accentColor: Long): PickVisualMediaRequest.Builder

Set the accent color for the PickVisualMediaRequest.

The accent color is used to change the main color in the photo picker. This parameter might be not supported by the underlying photo picker implementation.

Parameters
accentColor: Long

color long to apply as accent to the main color in the picker

Returns
PickVisualMediaRequest.Builder

This builder.

setDefaultTab

Added in 1.10.0-rc01
fun setDefaultTab(
    defaultTab: ActivityResultContracts.PickVisualMedia.DefaultTab
): PickVisualMediaRequest.Builder

Set the default tab for the PickVisualMediaRequest.

The default tab is used to open the preferred view inside the photo picker at first such as, e.g. DefaultTab.PhotosTab, DefaultTab.AlbumsTab. This parameter might be not supported by the underlying photo picker implementation.

Parameters
defaultTab: ActivityResultContracts.PickVisualMedia.DefaultTab

the tab to launch the picker in

Returns
PickVisualMediaRequest.Builder

This builder.

setMaxItems

Added in 1.10.0-rc01
fun setMaxItems(maxItems: @IntRange(from = 2) Int): PickVisualMediaRequest.Builder

Limit the number of selectable items in the photo picker when using PickMultipleVisualMedia

Parameters
maxItems: @IntRange(from = 2) Int

int type limiting the number of selectable items

Returns
PickVisualMediaRequest.Builder

This builder.

setMediaType

Added in 1.6.0
fun setMediaType(
    mediaType: ActivityResultContracts.PickVisualMedia.VisualMediaType
): PickVisualMediaRequest.Builder

Set the media type for the PickVisualMediaRequest.

The type is the mime type to filter by, e.g. PickVisualMedia.ImageOnly, PickVisualMedia.ImageAndVideo, PickVisualMedia.SingleMimeType("image/gif")

Parameters
mediaType: ActivityResultContracts.PickVisualMedia.VisualMediaType

type to go into the PickVisualMediaRequest

Returns
PickVisualMediaRequest.Builder

This builder.

setOrderedSelection

Added in 1.10.0-rc01
fun setOrderedSelection(isOrderedSelection: Boolean): PickVisualMediaRequest.Builder

Set the ordered selection for the PickVisualMediaRequest.

Allow the user to control the order in which images are returned to the calling app. This parameter might be not supported by the underlying photo picker implementation.

Parameters
isOrderedSelection: Boolean

boolean to enable customisable selection order in the picker

Returns
PickVisualMediaRequest.Builder

This builder.