Package-level declarations

Types

Link copied to clipboard
data class MediaGalleryConfig(val isCloseVisible: Boolean = true, val isOptionsVisible: Boolean = true, val isShareVisible: Boolean = true, val isGalleryVisible: Boolean = true, val optionsConfig: MediaGalleryOptionsConfig = MediaGalleryOptionsConfig()) : Parcelable

Model holding the configuration for the media gallery options. By default, all options are enabled/visible.

Link copied to clipboard
data class MediaGalleryOptionsConfig(val isShowInChatVisible: Boolean = true, val isReplyVisible: Boolean = true, val isSaveMediaVisible: Boolean = true, val isDeleteVisible: Boolean = true) : Parcelable

Model holding the configuration for the media gallery options. By default, all options are enabled/visible.

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, initialPage: Int, onHeaderLeadingContentClick: () -> Unit, onOptionClick: (Attachment, MediaGalleryPreviewOption) -> Unit, onRequestShareAttachment: (Attachment) -> Unit, onConfirmShareAttachment: (Attachment) -> Unit, modifier: Modifier = Modifier, config: MediaGalleryConfig = ChatTheme.mediaGalleryConfig, 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() .height(56.dp), message = viewModel.message, connectionState = viewModel.connectionState, onLeadingContentClick = onHeaderLeadingContentClick, onTrailingContentClick = onHeaderTrailingContentClick, ) }, content: @Composable (padding: PaddingValues, pagerState: PagerState, attachments: List<Attachment>, onPlaybackError: () -> Unit) -> Unit = { padding, pagerState, attachments, onPlaybackError -> MediaGalleryPager( modifier = Modifier .fillMaxSize() .background(ChatTheme.colors.appBackground) .padding(padding), pagerState = pagerState, attachments = attachments, onPlaybackError = { onPlaybackError() }, ) }, footer: @Composable (attachments: List<Attachment>, currentPage: Int) -> Unit = { attachments, currentPage -> MediaGalleryPreviewFooter( attachments = attachments, currentPage = currentPage, totalPages = attachments.size, connectionState = viewModel.connectionState, isSharingInProgress = viewModel.isSharingInProgress, onLeadingContentClick = onFooterLeadingContentClick, onTrailingContentClick = onFooterTrailingContentClick, ) }, 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?, initialPage: Int, promptedAttachment: Attachment?, isSharingInProgress: Boolean, isShowingOptions: Boolean, isShowingGallery: Boolean, onOptionClick: (Attachment, MediaGalleryPreviewOption) -> Unit, onRequestShareAttachment: (Attachment) -> Unit, modifier: Modifier = Modifier, config: MediaGalleryConfig = ChatTheme.mediaGalleryConfig, 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() .height(56.dp), message = message, connectionState = connectionState, onLeadingContentClick = onHeaderLeadingContentClick, onTrailingContentClick = onHeaderTrailingContentClick, ) }, content: @Composable (padding: PaddingValues, pagerState: PagerState, attachments: List<Attachment>, onPlaybackError: () -> Unit) -> Unit = { padding, pagerState, attachments, onPlaybackError -> MediaGalleryPager( modifier = Modifier .fillMaxSize() .background(ChatTheme.colors.appBackground) .padding(padding), pagerState = pagerState, attachments = attachments, onPlaybackError = { onPlaybackError() }, ) }, footer: @Composable (attachments: List<Attachment>, currentPage: Int) -> Unit = { attachments, currentPage -> MediaGalleryPreviewFooter( attachments = attachments, currentPage = currentPage, totalPages = attachments.size, connectionState = connectionState, isSharingInProgress = isSharingInProgress, onLeadingContentClick = onFooterLeadingContentClick, onTrailingContentClick = onFooterTrailingContentClick, ) }, 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: