MediaViewer: Show divider above the caption only if there is a caption and the media is video (to have a divider with the video controller)
This commit is contained in:
parent
2c6b4e31b9
commit
53567562d5
1 changed files with 6 additions and 1 deletions
|
|
@ -51,6 +51,7 @@ import io.element.android.compound.theme.ElementTheme
|
||||||
import io.element.android.compound.tokens.generated.CompoundIcons
|
import io.element.android.compound.tokens.generated.CompoundIcons
|
||||||
import io.element.android.libraries.architecture.AsyncData
|
import io.element.android.libraries.architecture.AsyncData
|
||||||
import io.element.android.libraries.core.mimetype.MimeTypes
|
import io.element.android.libraries.core.mimetype.MimeTypes
|
||||||
|
import io.element.android.libraries.core.mimetype.MimeTypes.isMimeTypeVideo
|
||||||
import io.element.android.libraries.designsystem.components.button.BackButton
|
import io.element.android.libraries.designsystem.components.button.BackButton
|
||||||
import io.element.android.libraries.designsystem.components.dialogs.RetryDialog
|
import io.element.android.libraries.designsystem.components.dialogs.RetryDialog
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||||
|
|
@ -125,6 +126,7 @@ fun MediaViewerView(
|
||||||
)
|
)
|
||||||
MediaViewerBottomBar(
|
MediaViewerBottomBar(
|
||||||
modifier = Modifier.align(Alignment.BottomCenter),
|
modifier = Modifier.align(Alignment.BottomCenter),
|
||||||
|
showDivider = state.mediaInfo.mimeType.isMimeTypeVideo(),
|
||||||
caption = state.mediaInfo.caption,
|
caption = state.mediaInfo.caption,
|
||||||
onHeightChange = { bottomPaddingInPixels = it },
|
onHeightChange = { bottomPaddingInPixels = it },
|
||||||
)
|
)
|
||||||
|
|
@ -360,6 +362,7 @@ private fun MediaViewerTopBar(
|
||||||
@Composable
|
@Composable
|
||||||
private fun MediaViewerBottomBar(
|
private fun MediaViewerBottomBar(
|
||||||
caption: String?,
|
caption: String?,
|
||||||
|
showDivider: Boolean,
|
||||||
onHeightChange: (Int) -> Unit,
|
onHeightChange: (Int) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
|
@ -371,8 +374,10 @@ private fun MediaViewerBottomBar(
|
||||||
onHeightChange(it.height)
|
onHeightChange(it.height)
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
HorizontalDivider()
|
|
||||||
if (caption != null) {
|
if (caption != null) {
|
||||||
|
if (showDivider) {
|
||||||
|
HorizontalDivider()
|
||||||
|
}
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue