Attachment : quickly improve rendering too
This commit is contained in:
parent
f0483b8fdb
commit
e9e99918be
1 changed files with 18 additions and 22 deletions
|
|
@ -16,11 +16,12 @@
|
||||||
|
|
||||||
package io.element.android.features.messages.impl.attachments.preview
|
package io.element.android.features.messages.impl.attachments.preview
|
||||||
|
|
||||||
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.defaultMinSize
|
import androidx.compose.foundation.layout.defaultMinSize
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
|
@ -28,6 +29,7 @@ import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.rememberUpdatedState
|
import androidx.compose.runtime.rememberUpdatedState
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
|
|
@ -66,16 +68,11 @@ fun AttachmentsPreviewView(
|
||||||
}
|
}
|
||||||
|
|
||||||
Scaffold(modifier) {
|
Scaffold(modifier) {
|
||||||
Box(
|
AttachmentPreviewContent(
|
||||||
modifier = Modifier.padding(it),
|
attachment = state.attachment,
|
||||||
contentAlignment = Alignment.Center
|
onSendClicked = ::postSendAttachment,
|
||||||
) {
|
onDismiss = onDismiss
|
||||||
AttachmentPreviewContent(
|
)
|
||||||
attachment = state.attachment,
|
|
||||||
onSendClicked = ::postSendAttachment,
|
|
||||||
onDismiss = onDismiss
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
AttachmentSendStateView(
|
AttachmentSendStateView(
|
||||||
sendActionState = state.sendActionState,
|
sendActionState = state.sendActionState,
|
||||||
|
|
@ -119,19 +116,19 @@ private fun AttachmentPreviewContent(
|
||||||
onSendClicked: () -> Unit,
|
onSendClicked: () -> Unit,
|
||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
) {
|
) {
|
||||||
Column(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(top = 24.dp)
|
.navigationBarsPadding(),
|
||||||
|
contentAlignment = Alignment.BottomCenter
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxSize(),
|
||||||
.fillMaxWidth()
|
contentAlignment = Alignment.Center
|
||||||
.weight(1f),
|
|
||||||
contentAlignment = Alignment.Center,
|
|
||||||
) {
|
) {
|
||||||
when (attachment) {
|
when (attachment) {
|
||||||
is Attachment.Media -> LocalMediaView(
|
is Attachment.Media -> LocalMediaView(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
localMedia = attachment.localMedia,
|
localMedia = attachment.localMedia,
|
||||||
onClick = {}
|
onClick = {}
|
||||||
)
|
)
|
||||||
|
|
@ -142,8 +139,9 @@ private fun AttachmentPreviewContent(
|
||||||
onSendClicked = onSendClicked,
|
onSendClicked = onSendClicked,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.defaultMinSize(minHeight = 120.dp)
|
.background(Color.Black.copy(alpha = 0.7f))
|
||||||
.padding(all = 24.dp)
|
.padding(horizontal = 24.dp)
|
||||||
|
.defaultMinSize(minHeight = 80.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -154,9 +152,7 @@ private fun AttachmentsPreviewBottomActions(
|
||||||
onSendClicked: () -> Unit,
|
onSendClicked: () -> Unit,
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
ButtonRowMolecule(
|
ButtonRowMolecule(modifier = modifier) {
|
||||||
modifier = modifier,
|
|
||||||
) {
|
|
||||||
TextButton(stringResource(id = CommonStrings.action_cancel), onClick = onCancelClicked)
|
TextButton(stringResource(id = CommonStrings.action_cancel), onClick = onCancelClicked)
|
||||||
TextButton(stringResource(id = CommonStrings.action_send), onClick = onSendClicked)
|
TextButton(stringResource(id = CommonStrings.action_send), onClick = onSendClicked)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue