Package-level declarations

Types

Link copied to clipboard

Shows an image and video previews along with enabling the user to perform various actions such as image or file deletion.

Link copied to clipboard

The contract used to start the MediaGalleryPreviewActivity given a message ID and the position of the clicked attachment.

Link copied to clipboard

An Activity that is capable of playing video/audio stream.

Functions

Link copied to clipboard
fun MediaGalleryPreviewScreen(viewModel: MediaGalleryPreviewViewModel, selectedAttachmentUrl: String?, onHeaderLeadingContentClick: () -> Unit, onOptionClick: (Attachment, MediaGalleryPreviewOption) -> Unit, onRequestShareAttachment: (Attachment) -> Unit, onConfirmShareAttachment: (Attachment) -> Unit, modifier: Modifier = Modifier, config: MediaGalleryConfig = ChatTheme.config.mediaGallery, onHeaderTrailingContentClick: () -> Unit = { viewModel.toggleMediaOptions(true) }, onFooterLeadingContentClick: (Attachment) -> Unit = onRequestShareAttachment, onFooterTrailingContentClick: (Attachment) -> Unit = { viewModel.toggleGallery(true) }, onDismissShareAttachment: () -> Unit = { viewModel.promptedAttachment = null }, onDismissOptionsMenu: () -> Unit = { viewModel.toggleMediaOptions(false) }, onDismissGallery: () -> Unit = { viewModel.toggleGallery(false) }, header: @Composable (attachments: List<Attachment>, currentPage: Int) -> Unit = { _, _ -> MediaGalleryPreviewHeader( modifier = Modifier.fillMaxWidth(), message = viewModel.message, connectionState = viewModel.connectionState, onLeadingContentClick = onHeaderLeadingContentClick, onTrailingContentClick = onHeaderTrailingContentClick, ) }, content: @Composable (padding: PaddingValues, pagerState: PagerState, attachments: List<Attachment>, player: Player?, onMediaClick: () -> Unit) -> Unit = { padding, pagerState, attachments, player, onMediaClick -> MediaGalleryPager( modifier = Modifier .fillMaxSize() .padding(padding), player = player, pagerState = pagerState, attachments = attachments, onMediaClick = onMediaClick, ) }, footer: @Composable (attachments: List<Attachment>, currentPage: Int, player: Player?) -> Unit = { attachments, currentPage, player -> MediaGalleryPreviewFooter( attachments = attachments, currentPage = currentPage, totalPages = attachments.size, connectionState = viewModel.connectionState, isSharingInProgress = viewModel.isSharingInProgress, onLeadingContentClick = onFooterLeadingContentClick, onTrailingContentClick = onFooterTrailingContentClick, topContent = { val currentAttachment = attachments.getOrNull(currentPage) if (player != null && currentAttachment?.isVideo() == true) { VideoPlaybackControls(player = player) } }, ) }, optionsMenu: @Composable (attachment: Attachment, options: List<MediaGalleryPreviewOption>) -> Unit = { attachment, options -> MediaGalleryOptionsMenu( attachment = attachment, options = options, onOptionClick = onOptionClick, onDismiss = onDismissOptionsMenu, ) })

A stateful composable function rendering a screen for previewing visual media attachments (images and videos). Renders a screen with the following structure:

fun MediaGalleryPreviewScreen(message: Message, connectionState: ConnectionState, currentUser: User?, selectedAttachmentUrl: String?, promptedAttachment: Attachment?, isSharingInProgress: Boolean, isShowingOptions: Boolean, isShowingGallery: Boolean, onOptionClick: (Attachment, MediaGalleryPreviewOption) -> Unit, onRequestShareAttachment: (Attachment) -> Unit, modifier: Modifier = Modifier, config: MediaGalleryConfig = ChatTheme.config.mediaGallery, onHeaderLeadingContentClick: () -> Unit = {}, onHeaderTrailingContentClick: () -> Unit = {}, onFooterLeadingContentClick: (Attachment) -> Unit = onRequestShareAttachment, onFooterTrailingContentClick: (Attachment) -> Unit = {}, onConfirmShareAttachment: (Attachment) -> Unit = {}, onDismissShareAttachment: () -> Unit = {}, onDismissOptionsMenu: () -> Unit = {}, onDismissGallery: () -> Unit = {}, header: @Composable (attachments: List<Attachment>, currentPage: Int) -> Unit = { _, _ -> MediaGalleryPreviewHeader( modifier = Modifier.fillMaxWidth(), message = message, connectionState = connectionState, onLeadingContentClick = onHeaderLeadingContentClick, onTrailingContentClick = onHeaderTrailingContentClick, ) }, content: @Composable (padding: PaddingValues, pagerState: PagerState, attachments: List<Attachment>, player: Player?, onMediaClick: () -> Unit) -> Unit = { padding, pagerState, attachments, player, onMediaClick -> MediaGalleryPager( modifier = Modifier .fillMaxSize() .padding(padding), player = player, pagerState = pagerState, attachments = attachments, onMediaClick = onMediaClick, ) }, footer: @Composable (attachments: List<Attachment>, currentPage: Int, player: Player?) -> Unit = { attachments, currentPage, player -> MediaGalleryPreviewFooter( attachments = attachments, currentPage = currentPage, totalPages = attachments.size, connectionState = connectionState, isSharingInProgress = isSharingInProgress, onLeadingContentClick = onFooterLeadingContentClick, onTrailingContentClick = onFooterTrailingContentClick, topContent = { val currentAttachment = attachments.getOrNull(currentPage) if (player != null && currentAttachment?.isVideo() == true) { VideoPlaybackControls(player = player) } }, ) }, optionsMenu: @Composable (attachment: Attachment, options: List<MediaGalleryPreviewOption>) -> Unit = { attachment, options -> MediaGalleryOptionsMenu( attachment = attachment, options = options, onOptionClick = onOptionClick, onDismiss = onDismissOptionsMenu, ) })

A stateless composable function rendering a screen for previewing visual media attachments (images and videos). Renders a screen with the following structure: