EmbeddedPhotoPickerClient
interface EmbeddedPhotoPickerClient
| android.widget.photopicker.EmbeddedPhotoPickerClient |
Callback to define mechanisms by which can apps can receive notifications about different events from embedded photopicker for the corresponding Session (EmbeddedPhotoPickerSession).
PhotoPicker will invoke the methods of this interface on the Executor provided by the caller in EmbeddedPhotoPickerProvider.openSession
Any methods on a single instance of this object will always be invoked in a non-concurrent or thread safe way. In other words, all methods are invoked in a serial execution manner on the executor passed by the caller. Hence callers wouldn't need any buffer or locking mechanism on their end.
Summary
| Public methods | |
|---|---|
| open Unit |
Reports that the user clicked on the camera button within the embedded photo picker. |
| open Unit |
Reports that navigation to a tab has completed, triggered either programmatically via |
| open Unit |
onSearchStatusChanged(isSearchEnabled: Boolean)Reports when search feature availability changes in the embedded photopicker. |
| abstract Unit |
Reports that the user is done with their selection and should collapse the picker. |
| abstract Unit |
onSessionError(cause: Throwable)Reports that terminal error has occurred in the session. |
| abstract Unit |
onSessionOpened(session: EmbeddedPhotoPickerSession)Reports that session of app with photopicker was established successfully. |
| abstract Unit |
onUriPermissionGranted(uris: MutableList<Uri!>)Reports that URI permission has been granted to the item selected by the user. |
| abstract Unit |
onUriPermissionRevoked(uris: MutableList<Uri!>)Reports that URI permission has been revoked of the item deselected by the user. |
Public methods
onCameraButtonClicked
open fun onCameraButtonClicked(): Unit
Reports that the user clicked on the camera button within the embedded photo picker.
This callback is only invoked when the host app has enabled the camera button via EmbeddedPhotoPickerFeatureInfo.Builder.setCameraButtonEnabled(boolean).
Upon receiving this callback, the host app can launch its own camera flow, trigger a system camera intent (e.g., android.provider.MediaStore#ACTION_IMAGE_CAPTURE), or present a custom capture interface.
This callback is dispatched on the java.util.concurrent.Executor provided by the host app during session creation.
onNavigationCompleted
open fun onNavigationCompleted(: Int): Unit
Reports that navigation to a tab has completed, triggered either programmatically via EmbeddedPhotoPickerSession.navigateTo(int) or by user interaction.
This callback is only invoked if allowed navigation tabs are configured via EmbeddedPhotoPickerFeatureInfo.Builder.setAllowedNavigationTabs.
| Parameters | |
|---|---|
tabId |
Int: The identifier of the tab ERROR[hidden: NavigationTabConstants.NavigationTab] that was navigated to. Value is one of the following: |
onSearchStatusChanged
open fun onSearchStatusChanged(isSearchEnabled: Boolean): Unit
Reports when search feature availability changes in the embedded photopicker.
This callback is only invoked if search status events are enabled via EmbeddedPhotoPickerFeatureInfo.Builder.setSearchStatusEventsEnabled(boolean).
| Parameters | |
|---|---|
isSearchEnabled |
Boolean: true if search is available, false otherwise. |
onSelectionComplete
abstract fun onSelectionComplete(): Unit
Reports that the user is done with their selection and should collapse the picker.
This doesn't necessarily mean that the session should be closed, but rather the user has indicated that they are done selecting images and should go back to the app.
onSessionError
abstract fun onSessionError(cause: Throwable): Unit
Reports that terminal error has occurred in the session. Any further events notified on this session will be ignored. The embedded photopicker view will be torn down along with session upon error.
| Parameters | |
|---|---|
cause |
Throwable: This value cannot be null. |
onSessionOpened
abstract fun onSessionOpened(session: EmbeddedPhotoPickerSession): Unit
Reports that session of app with photopicker was established successfully. Also shares EmbeddedPhotoPickerSession handle containing the view with the caller that should be used to notify the session of UI events.
| Parameters | |
|---|---|
session |
EmbeddedPhotoPickerSession: This value cannot be null. |
onUriPermissionGranted
abstract fun onUriPermissionGranted(uris: MutableList<Uri!>): Unit
Reports that URI permission has been granted to the item selected by the user.
It is possible that the permission to the URI was revoked if the item was unselected by user before the URI is actually accessed by the caller. Hence callers must handle SecurityException when attempting to read or use the URI in response to this callback.
| Parameters | |
|---|---|
uris |
MutableList<Uri!>: This value cannot be null. |
onUriPermissionRevoked
abstract fun onUriPermissionRevoked(uris: MutableList<Uri!>): Unit
Reports that URI permission has been revoked of the item deselected by the user.
| Parameters | |
|---|---|
uris |
MutableList<Uri!>: This value cannot be null. |