@RequiresApi(value = 26)
public final class SelectionParams


Represents selection constraints for the photo picker.

This class allows specifying constraints that the selected media items must satisfy. By providing this information to androidx.photopicker.activity.PickVisualMediaRequest, the photo picker will disable selection of items in the picker grid that violate these constraints.

Callers should use Builder to construct an instance of this class.

Summary

Nested types

@RequiresApi(value = 26)
public final class SelectionParams.Builder

A builder for constructing SelectionParams instances.

Public methods

final long

The maximum allowed resolution in total pixels, or -1 if unrestricted (default).

final long

The maximum allowed size, in bytes, for an individual media item, or -1 if unrestricted (default).

final long

The maximum allowed cumulative size, in bytes, for the entire batch of selected media items, or -1 if unrestricted (default).

final Duration

The maximum allowed duration for a video media item, or null if unrestricted (default).

final @NonNull List<@NonNull String>

The list of allowed mime types that items must match to be selectable.

final long

The minimum required resolution in total pixels, or -1 if unrestricted (default).

final Duration

The minimum required duration for a video media item, or null if unrestricted (default).

Public methods

getMaxMediaItemResolutionInPixels

Added in 1.0.0-alpha03
public final long getMaxMediaItemResolutionInPixels()

The maximum allowed resolution in total pixels, or -1 if unrestricted (default).

getMaxMediaItemSizeInBytes

Added in 1.0.0-alpha03
public final long getMaxMediaItemSizeInBytes()

The maximum allowed size, in bytes, for an individual media item, or -1 if unrestricted (default).

getMaxSelectionBatchSizeInBytes

Added in 1.0.0-alpha03
public final long getMaxSelectionBatchSizeInBytes()

The maximum allowed cumulative size, in bytes, for the entire batch of selected media items, or -1 if unrestricted (default).

getMaxVideoDuration

Added in 1.0.0-alpha03
public final Duration getMaxVideoDuration()

The maximum allowed duration for a video media item, or null if unrestricted (default).

getMimeTypes

Added in 1.0.0-alpha03
public final @NonNull List<@NonNull String> getMimeTypes()

The list of allowed mime types that items must match to be selectable. If empty, all mime types are allowed (default).

getMinMediaItemResolutionInPixels

Added in 1.0.0-alpha03
public final long getMinMediaItemResolutionInPixels()

The minimum required resolution in total pixels, or -1 if unrestricted (default).

getMinVideoDuration

Added in 1.0.0-alpha03
public final Duration getMinVideoDuration()

The minimum required duration for a video media item, or null if unrestricted (default).