PickVisualMediaRequest.Builder


public final class PickVisualMediaRequest.Builder


A builder for constructing PickVisualMediaRequest instances.

Summary

Public constructors

Public methods

final @NonNull PickVisualMediaRequest

Build the PickVisualMediaRequest specified by this builder.

final @NonNull PickVisualMediaRequest.Builder
setAccentColor(long accentColor)

Set the accent color for the PickVisualMediaRequest.

final @NonNull PickVisualMediaRequest.Builder

Set the default tab for the PickVisualMediaRequest.

final @NonNull PickVisualMediaRequest.Builder
setMaxItems(@IntRange(from = 2) int maxItems)

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

final @NonNull PickVisualMediaRequest.Builder

Set the media type for the PickVisualMediaRequest.

final @NonNull PickVisualMediaRequest.Builder
setOrderedSelection(boolean isOrderedSelection)

Set the ordered selection for the PickVisualMediaRequest.

Public constructors

Builder

Added in 1.6.0
public Builder()

Public methods

build

Added in 1.6.0
public final @NonNull PickVisualMediaRequest build()

Build the PickVisualMediaRequest specified by this builder.

Returns
@NonNull PickVisualMediaRequest

the newly constructed PickVisualMediaRequest.

setAccentColor

public final @NonNull PickVisualMediaRequest.Builder setAccentColor(long accentColor)

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
long accentColor

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

Returns
@NonNull PickVisualMediaRequest.Builder

This builder.

setDefaultTab

public final @NonNull PickVisualMediaRequest.Builder setDefaultTab(
    @NonNull ActivityResultContracts.PickVisualMedia.DefaultTab defaultTab
)

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
@NonNull ActivityResultContracts.PickVisualMedia.DefaultTab defaultTab

the tab to launch the picker in

Returns
@NonNull PickVisualMediaRequest.Builder

This builder.

setMaxItems

public final @NonNull PickVisualMediaRequest.Builder setMaxItems(@IntRange(from = 2) int maxItems)

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

Parameters
@IntRange(from = 2) int maxItems

int type limiting the number of selectable items

Returns
@NonNull PickVisualMediaRequest.Builder

This builder.

setMediaType

Added in 1.6.0
public final @NonNull PickVisualMediaRequest.Builder setMediaType(
    @NonNull ActivityResultContracts.PickVisualMedia.VisualMediaType mediaType
)

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
@NonNull ActivityResultContracts.PickVisualMedia.VisualMediaType mediaType

type to go into the PickVisualMediaRequest

Returns
@NonNull PickVisualMediaRequest.Builder

This builder.

setOrderedSelection

public final @NonNull PickVisualMediaRequest.Builder setOrderedSelection(boolean isOrderedSelection)

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
boolean isOrderedSelection

boolean to enable customisable selection order in the picker

Returns
@NonNull PickVisualMediaRequest.Builder

This builder.