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

Sets parameters for highlighting a specific album's media in the photo picker.

PickVisualMediaRequest.Builder
setHighlightSearchResultsParams(
    highlightSearchResultsParams: HighlightSearchResultsParams?
)

Sets parameters for highlighting search results in the photo picker.

PickVisualMediaRequest.Builder
setLocationMetadataAccessRequested(
    isLocationMetadataAccessRequested: Boolean
)

Sets whether the caller requests access to location metadata for the selected media items.

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 capabilities for the PickVisualMediaRequest.

PickVisualMediaRequest.Builder

Set the media type for the PickVisualMediaRequest.

PickVisualMediaRequest.Builder
setOrderedSelection(isOrderedSelection: Boolean)

Set the ordered selection for the PickVisualMediaRequest.

PickVisualMediaRequest.Builder
@RequiresExtension(extension = 34, version = 22)
setSelectionParams(selectionParams: SelectionParams?)

Sets selection constraints for media items in the photo picker.

PickVisualMediaRequest.Builder

Public constructors

Builder

Added in 1.0.0-alpha03
Builder()

Public functions

build

Added in 1.0.0-alpha03
fun build(): PickVisualMediaRequest

Build the PickVisualMediaRequest specified by this builder.

Returns
PickVisualMediaRequest

the newly constructed PickVisualMediaRequest.

Throws
IllegalArgumentException

if both search results highlight and album highlight parameters are set.

setAccentColor

Added in 1.0.0-alpha03
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 feature was added in API level 35 / R ext 12 and applies the default behavior for older versions.

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.0.0-alpha03
fun setDefaultTab(defaultTab: 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 feature was added in API level 35 / R ext 12 and applies the default behavior for older versions.

Parameters
defaultTab: PickVisualMedia.DefaultTab

the tab to launch the picker in (defaults to DefaultTab.PhotosTab)

Returns
PickVisualMediaRequest.Builder

This builder.

setHighlightAlbumParams

Added in 1.0.0-alpha03
fun setHighlightAlbumParams(highlightAlbumParams: HighlightAlbumParams?): PickVisualMediaRequest.Builder

Sets parameters for highlighting a specific album's media in the photo picker.

This allows apps to highlight media results of an album in the photo picker UI whenever feasible based on the given input album (one of HighlightAlbumParams.HighlightAlbum). Only one of search results highlight or album highlight can be specified to either show a highlighted media section when the photopicker launches or to open the photopicker to show a highlighted media results grid based on the given input album. Specifying both album and search highlight will result in throwing IllegalArgumentException.

This feature was added in Android Tiramisu (API level 33 / T ext 19) and will be ignored on Android R and S.

Parameters
highlightAlbumParams: HighlightAlbumParams?

The album highlight configuration, or null to clear.

Returns
PickVisualMediaRequest.Builder

This builder.

setHighlightSearchResultsParams

Added in 1.0.0-alpha03
fun setHighlightSearchResultsParams(
    highlightSearchResultsParams: HighlightSearchResultsParams?
): PickVisualMediaRequest.Builder

Sets parameters for highlighting search results in the photo picker. This allows apps to highlight search results in the photopicker UI whenever feasible based on the given input text query. Only one of search results highlight or album highlight can be specified to either show a highlighted media section when the photopicker launches or to open the photopicker to show a highlighted media results grid based on the given input query. Specifying both album and search highlight will result in throwing IllegalArgumentException.

This feature was added in Android Tiramisu (API level 33 / T ext 19) and will be ignored on Android R and S.

Parameters
highlightSearchResultsParams: HighlightSearchResultsParams?

The search result highlight configuration, or null to clear.

Returns
PickVisualMediaRequest.Builder

This builder.

setLocationMetadataAccessRequested

Added in 1.0.0-alpha03
fun setLocationMetadataAccessRequested(
    isLocationMetadataAccessRequested: Boolean
): PickVisualMediaRequest.Builder

Sets whether the caller requests access to location metadata for the selected media items.

When set to true, this informs the Photopicker that the app is requesting location information (such as EXIF GPS data) for the media items selected by the user. The default value is false, meaning location metadata is redacted by default.

Requesting location metadata does not guarantee that the calling app will receive it. The Photopicker may prompt the user via the picker UI, and the user's choice to allow or deny location sharing is final. If granted, calling apps can access this metadata when the selected media files are opened via the returned URIs.

This feature was added in SDK extension 23 on Android Tiramisu (API level 33) and higher. If the underlying Photopicker implementation or device does not support this feature, this request is safely ignored.

Parameters
isLocationMetadataAccessRequested: Boolean

boolean whether to request location metadata access from the Photopicker

Returns
PickVisualMediaRequest.Builder

This builder.

setMaxItems

Added in 1.0.0-alpha03
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.

setMediaCapabilitiesForTranscoding

Added in 1.0.0-alpha03
@RequiresApi(value = 33)
fun setMediaCapabilitiesForTranscoding(
    mediaCapabilities: PickVisualMedia.MediaCapabilities?
): PickVisualMediaRequest.Builder

Set the media capabilities for the PickVisualMediaRequest.

This parameter allows you to specify the media capabilities that your application can handle, such as the HDR type of the media. This parameter might be not supported by the underlying photo picker implementation.

When the requested video format does not match the capabilities specified by the calling app and the video duration is within the range that photo picker can handle, photo picker will transcode the video into a default supported format, otherwise, the calling app will receive the original file.

Parameters
mediaCapabilities: PickVisualMedia.MediaCapabilities?

the MediaCapabilities to apply to the media selection.

Returns
PickVisualMediaRequest.Builder

This builder.

setMediaType

Added in 1.0.0-alpha03
fun setMediaType(mediaType: 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: PickVisualMedia.VisualMediaType

type to go into the PickVisualMediaRequest

Returns
PickVisualMediaRequest.Builder

This builder.

setOrderedSelection

Added in 1.0.0-alpha03
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.

setSelectionParams

Added in 1.0.0-alpha03
@RequiresExtension(extension = 34, version = 22)
fun setSelectionParams(selectionParams: SelectionParams?): PickVisualMediaRequest.Builder

Sets selection constraints for media items in the photo picker. The items that do not satisfy these input constraints will not be selectable in the photopicker grid.

This feature was added for the system PhotoPicker in SDK extension version 22 (API level 34 / U ext 22) and is available starting from the same and higher. If the platform conditions are not met, this cannot be used. Callers of this must add this check before using.

Parameters
selectionParams: SelectionParams?

The selection constraint parameters, or null to clear.

Returns
PickVisualMediaRequest.Builder

This builder.

setUiCustomizationParams

Added in 1.0.0-alpha03
fun setUiCustomizationParams(uiCustomizationParams: UiCustomizationParams?): PickVisualMediaRequest.Builder