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
setHighlightType(highlightType: Int)

The app can choose to specify the highlight type i.

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
setPickerLaunchedInExpandedState(launchedPickerInExpandedState: Boolean)

Embedded photopicker can be launched in the expanded state by the app.

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()

Builder

Builder(featureInfo: EmbeddedPhotoPickerFeatureInfo)
Parameters
featureInfo EmbeddedPhotoPickerFeatureInfo: EmbeddedPhotoPickerFeatureInfo object whose properties need to be copied to create a new object.
This value cannot be null.

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

setHighlightType

fun setHighlightType(highlightType: Int): EmbeddedPhotoPickerFeatureInfo.Builder

The app can choose to specify the highlight type i.e. the way in which the highlighted media results will be shown in the photopicker. The highlight type can be set for both album and search highlights.

The value can be one of:

  • MediaStore#PICK_IMAGES_HIGHLIGHT_TYPE_COLLAPSED to show a highlighted media section in the photopicker or
  • MediaStore#PICK_IMAGES_HIGHLIGHT_TYPE_EXPANDED to show a highlighted media results grid. If this is the preferred highlight type, the embedded picker must be launched in the expanded state iniially by the app itself and setLaunchedPickerInExpandedState must be set to true to indicate the same. If the embedded picker's initial expanded state is found to be false, then the request for MediaStore#PICK_IMAGES_HIGHLIGHT_TYPE_EXPANDED is ignored.
The default highlight type value will be MediaStore#PICK_IMAGES_HIGHLIGHT_TYPE_COLLAPSED. Any other input highlight value will result in IllegalArgumentException to be thrown.
Parameters
highlightType Int: One of the above mentioned int params specifying the highlight type.
Return
EmbeddedPhotoPickerFeatureInfo.Builder This value cannot be null.
Exceptions
java.lang.IllegalArgumentException if the input highlight type is invalid.

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.

setPickerLaunchedInExpandedState

fun setPickerLaunchedInExpandedState(launchedPickerInExpandedState: Boolean): EmbeddedPhotoPickerFeatureInfo.Builder

Embedded photopicker can be launched in the expanded state by the app. If the app opts to do so, this field must be set to true indicating the app chose to initially launch the embedded picker in the expanded state.

Parameters
launchedPickerInExpandedState Boolean: Indicates that the app chose to launch the picker in expanded state.
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.