Builder


class Builder
kotlin.Any
   ↳ android.widget.photopicker.EmbeddedPhotoPickerFeatureInfo.Builder

Summary

Public constructors

Public methods
EmbeddedPhotoPickerFeatureInfo

Build the class for desired feature info arguments

EmbeddedPhotoPickerFeatureInfo.Builder
setAccentColor(accentColor: Long)

Sets accent color which will change color of primary picker elements like Done button, selected media icon colors, tab color etc.

EmbeddedPhotoPickerFeatureInfo.Builder
setHighlightAlbumId(highlightAlbumId: String)

The app can choose to highlight media items of a photopicker album in the embedded photopicker in its expanded state.

EmbeddedPhotoPickerFeatureInfo.Builder
setHighlightSearchMediaTextQuery(highlightSearchMediaTextQuery: String)

The app can choose to highlight media items in the embedded photopicker in its expanded state.

EmbeddedPhotoPickerFeatureInfo.Builder
setMaxSelectionLimit(maxSelectionLimit: Int)

Sets maximum number of items that can be selected by the user

EmbeddedPhotoPickerFeatureInfo.Builder

Sets the mime type to filter media items on.

EmbeddedPhotoPickerFeatureInfo.Builder
setOrderedSelection(orderedSelection: Boolean)

Sets ordered selection of media items i.

EmbeddedPhotoPickerFeatureInfo.Builder
setPreSelectedUris(preSelectedUris: MutableList<Uri!>)

Sets list of uris to be pre-selected when embedded picker is opened.

EmbeddedPhotoPickerFeatureInfo.Builder
setThemeNightMode(themeNightMode: Int)

Sets the embedded photo picker theme to light or dark irrespective of the device theme.

Public constructors

Builder

Builder()

Public methods

build

fun build(): EmbeddedPhotoPickerFeatureInfo

Build the class for desired feature info arguments

Return
EmbeddedPhotoPickerFeatureInfo This value cannot be null.

setAccentColor

fun setAccentColor(accentColor: Long): EmbeddedPhotoPickerFeatureInfo.Builder

Sets accent color which will change color of primary picker elements like Done button, selected media icon colors, tab color etc.

The value of this intent-extra must be a string specifying the hex code of the accent color that is to be used within the picker.

This param is same as MediaStore#EXTRA_PICK_IMAGES_ACCENT_COLOR. See MediaStore#EXTRA_PICK_IMAGES_ACCENT_COLOR for more details on accepted colors.

Parameters
accentColor Long: Hex code of desired accent color. By default, the color of elements will reflect based on device theme
Return
EmbeddedPhotoPickerFeatureInfo.Builder This value cannot be null.

setHighlightAlbumId

fun setHighlightAlbumId(highlightAlbumId: String): EmbeddedPhotoPickerFeatureInfo.Builder

The app can choose to highlight media items of a photopicker album in the embedded photopicker in its expanded state. These can be one of Favorites, Camera, Screenshots, Videos or Downloads. In order to do so, the input value should be one of the album values: MediaStore#PICK_IMAGES_HIGHLIGHT_ALBUM_FAVORITES for the Favorites album, MediaStore#PICK_IMAGES_HIGHLIGHT_ALBUM_CAMERA for the Camera album, MediaStore#PICK_IMAGES_HIGHLIGHT_ALBUM_SCREENSHOTS for the Screenshots album, MediaStore#PICK_IMAGES_HIGHLIGHT_ALBUM_VIDEOS for the Videos album and MediaStore#PICK_IMAGES_HIGHLIGHT_ALBUM_DOWNLOADS for the Downloads album.

The value of this string param must not be empty or null in case the app wants to show a highlighted album media section. An empty value will result in simply ignoring the request for a highlighted media section. A null value will result in IllegalArgumentException being thrown. Any other value except the ones specified will also result in IllegalArgumentException to be thrown. The app can also choose to highlight media items based on a text query using android.widget.photopicker.EmbeddedPhotoPickerFeatureInfo#setHighlightMediaTextQuery. Only one of album highlight or text highlight should be used at any point. Using both will result in IllegalArgumentException to be thrown.

Parameters
highlightAlbumId String: One of the above mentioned string params specifying the album name. This value cannot be null.
Exceptions
java.lang.IllegalArgumentException in case input album is null

setHighlightSearchMediaTextQuery

fun setHighlightSearchMediaTextQuery(highlightSearchMediaTextQuery: String): EmbeddedPhotoPickerFeatureInfo.Builder

The app can choose to highlight media items in the embedded photopicker in its expanded state. The media items in this highlighted section are based on the string input query set in this method. The photopicker will trigger a search based on this input value to show media results in this section.This can be any string literal for which the app wants to highlight media results.

The value of this string param must not be empty or null in case the app wants to show a highlighted media section. An empty value will result in simply ignoring the request for a highlighted media section. A null value will result in IllegalArgumentException The app can also choose to highlight a specific photopicker album using android.widget.photopicker.EmbeddedPhotoPickerFeatureInfo#setHighlightAlbumName. Only one of album highlight or text highlight should be used at any point. Using both will result in IllegalArgumentException to be thrown.

Parameters
highlightSearchMediaTextQuery String: A String param based on which the highlighted results shown. This value cannot be null.
Exceptions
java.lang.IllegalArgumentException in case input string query is null

setMaxSelectionLimit

fun setMaxSelectionLimit(maxSelectionLimit: Int): EmbeddedPhotoPickerFeatureInfo.Builder

Sets maximum number of items that can be selected by the user

The value of this intent-extra should be a positive integer greater than or equal to 1 and less than or equal to MediaStore#getPickImagesMaxLimit

Parameters
maxSelectionLimit Int: Max selection count restriction. Pass limit as 1 to open PhotoPicker in single-select mode. Default is multi select mode with limit as MediaStore#getPickImagesMaxLimit() Value is 1 or greater
Return
EmbeddedPhotoPickerFeatureInfo.Builder This value cannot be null.

setMimeTypes

fun setMimeTypes(mimeTypes: MutableList<String!>): EmbeddedPhotoPickerFeatureInfo.Builder

Sets the mime type to filter media items on.

Values may be a combination of concrete MIME types (such as "image/png") and/or partial MIME types (such as "image/*").

Parameters
mimeTypes MutableList<String!>: List of mime types to filter. By default, all media items will be returned This value cannot be null.
Return
EmbeddedPhotoPickerFeatureInfo.Builder This value cannot be null.

setOrderedSelection

fun setOrderedSelection(orderedSelection: Boolean): EmbeddedPhotoPickerFeatureInfo.Builder

Sets ordered selection of media items i.e. this allows user to view/receive items in their selected order

Parameters
orderedSelection Boolean: Pass true to set ordered selection. Default is false
Return
EmbeddedPhotoPickerFeatureInfo.Builder This value cannot be null.

setPreSelectedUris

fun setPreSelectedUris(preSelectedUris: MutableList<Uri!>): EmbeddedPhotoPickerFeatureInfo.Builder

Sets list of uris to be pre-selected when embedded picker is opened.

This is same as MediaStore#EXTRA_PICKER_PRE_SELECTION_URIS. See MediaStore#EXTRA_PICKER_PRE_SELECTION_URIS for more details on restrictions and filter criteria.

Parameters
preSelectedUris MutableList<Uri!>: list of uris to be pre-selected This value cannot be null.
Return
EmbeddedPhotoPickerFeatureInfo.Builder This value cannot be null.

setThemeNightMode

fun setThemeNightMode(themeNightMode: Int): EmbeddedPhotoPickerFeatureInfo.Builder

Sets the embedded photo picker theme to light or dark irrespective of the device theme.

Parameters
themeNightMode Int: hex code of the desired Configuration.UI_MODE_NIGHT_MASK value.

The default value is Configuration.UI_MODE_NIGHT_UNDEFINED to apply the system (device) theme.

Supported values are -

  • Configuration.UI_MODE_NIGHT_UNDEFINED -> system theme
  • Configuration.UI_MODE_NIGHT_YES -> dark theme
  • Configuration.UI_MODE_NIGHT_NO -> light theme
  • Return
    EmbeddedPhotoPickerFeatureInfo.Builder This value cannot be null.