EmbeddedPhotoPickerSession


interface EmbeddedPhotoPickerSession
android.widget.photopicker.EmbeddedPhotoPickerSession

Class that holds the embedded photopicker view wrapped in SurfaceControlViewHost.SurfacePackage that can be embedded by the caller in their view hierarchy by placing it in a SurfaceView via its SurfaceView.setChildSurfacePackage api. Callers of EmbeddedPhotoPickerProvider.openSession will asynchronously receive instance of this class from the service upon its successful execution via EmbeddedPhotoPickerClient.onSessionOpened callback.

Instance of this class can be then used by callers to notify PhotoPicker about different events for service to act upon them.

When a session is no longer being used, it should be closed by callers to help system release the resources.

Summary

Public methods
abstract Unit

Close the session, i.

abstract SurfaceControlViewHost.SurfacePackage

Returns the SurfaceControlViewHost.SurfacePackage that contains view representing embedded picker.

abstract Unit

Notifies photopicker that host side configuration has changed.

abstract Unit

Notify that user switched photopicker between expanded/collapsed state.

abstract Unit
notifyResized(width: Int, height: Int)

Notify that caller's presentation area has changed and photopicker's dimensions should change accordingly.

abstract Unit

Notify that embedded photopicker view is visible or not to the user.

abstract Unit

Notify that the user deselected some items.

Public methods

close

abstract fun close(): Unit

Close the session, i.e. photopicker will release resources associated with this session. Any further notifications to this Session will be ignored by the service.

getSurfacePackage

abstract fun getSurfacePackage(): SurfaceControlViewHost.SurfacePackage

Returns the SurfaceControlViewHost.SurfacePackage that contains view representing embedded picker.

Callers can attach this view in their hierarchy using SurfaceView.setChildSurfacePackage api.

Return
SurfaceControlViewHost.SurfacePackage This value cannot be null.

notifyConfigurationChanged

abstract fun notifyConfigurationChanged(configuration: Configuration): Unit

Notifies photopicker that host side configuration has changed.

Parameters
configuration Configuration: new configuration of caller This value cannot be null.

notifyPhotoPickerExpanded

abstract fun notifyPhotoPickerExpanded(isExpanded: Boolean): Unit

Notify that user switched photopicker between expanded/collapsed state.

Some photopicker features (like Profile selector, Album grid etc.) are only shown in full/expanded view and are hidden in collapsed view.

Parameters
isExpanded Boolean: true if expanded, false if collapsed.

notifyResized

abstract fun notifyResized(
    width: Int,
    height: Int
): Unit

Notify that caller's presentation area has changed and photopicker's dimensions should change accordingly.

Parameters
width Int: width of the view, in pixels
height Int: height of the view, in pixels

notifyVisibilityChanged

abstract fun notifyVisibilityChanged(isVisible: Boolean): Unit

Notify that embedded photopicker view is visible or not to the user.

This helps photopicker to close upstream work and manage the lifecycle of this Session instance.

Parameters
isVisible Boolean: True if view visible to the user, false if not.

requestRevokeUriPermission

abstract fun requestRevokeUriPermission(uris: MutableList<Uri!>): Unit

Notify that the user deselected some items.

Parameters
uris MutableList<Uri!>: The Uri list of the deselected items. This value cannot be null.