feat: consistent corners in message composition area, typing indicator
This commit is contained in:
parent
d06eb55aa3
commit
8c4615f207
|
|
@ -5,7 +5,6 @@ import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.foundation.text.BasicTextField
|
import androidx.compose.foundation.text.BasicTextField
|
||||||
import androidx.compose.foundation.text.KeyboardActions
|
import androidx.compose.foundation.text.KeyboardActions
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
|
|
@ -128,11 +127,7 @@ fun MessageField(
|
||||||
.padding(4.dp)
|
.padding(4.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
shape = RoundedCornerShape(
|
|
||||||
topStart = 16.dp,
|
|
||||||
topEnd = 16.dp
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,12 @@ import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
@ -43,9 +45,15 @@ fun TypingIndicator(
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
Modifier
|
Modifier
|
||||||
.background(MaterialTheme.colorScheme.surface)
|
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(all = 4.dp)
|
.clip(
|
||||||
|
RoundedCornerShape(
|
||||||
|
topStart = 16.dp,
|
||||||
|
topEnd = 16.dp,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.background(MaterialTheme.colorScheme.background)
|
||||||
|
.padding(vertical = 8.dp, horizontal = 16.dp)
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(
|
text = stringResource(
|
||||||
|
|
|
||||||
|
|
@ -377,7 +377,7 @@ fun ChannelScreen(
|
||||||
}
|
}
|
||||||
|
|
||||||
val scrollDownFABPadding by animateDpAsState(
|
val scrollDownFABPadding by animateDpAsState(
|
||||||
if (viewModel.typingUsers.isNotEmpty()) 32.dp else 0.dp,
|
if (viewModel.typingUsers.isNotEmpty()) 40.dp else 0.dp,
|
||||||
animationSpec = RevoltTweenDp
|
animationSpec = RevoltTweenDp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -462,7 +462,7 @@ fun ChannelScreen(
|
||||||
) {
|
) {
|
||||||
LazyColumn(state = lazyListState, reverseLayout = true) {
|
LazyColumn(state = lazyListState, reverseLayout = true) {
|
||||||
item {
|
item {
|
||||||
Spacer(modifier = Modifier.height(32.dp))
|
Spacer(modifier = Modifier.height(40.dp))
|
||||||
}
|
}
|
||||||
|
|
||||||
items(viewModel.renderableMessages) { message ->
|
items(viewModel.renderableMessages) { message ->
|
||||||
|
|
@ -523,33 +523,42 @@ fun ChannelScreen(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimatedVisibility(visible = viewModel.replies.isNotEmpty()) {
|
Column(
|
||||||
ReplyManager(
|
modifier = Modifier.clip(
|
||||||
replies = viewModel.replies,
|
RoundedCornerShape(
|
||||||
onRemove = viewModel::removeReply,
|
topStart = 16.dp,
|
||||||
onToggleMention = viewModel::toggleReplyMentionFor
|
topEnd = 16.dp
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
AnimatedVisibility(visible = viewModel.replies.isNotEmpty()) {
|
||||||
|
ReplyManager(
|
||||||
|
replies = viewModel.replies,
|
||||||
|
onRemove = viewModel::removeReply,
|
||||||
|
onToggleMention = viewModel::toggleReplyMentionFor
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
AnimatedVisibility(visible = viewModel.attachments.isNotEmpty()) {
|
||||||
|
AttachmentManager(
|
||||||
|
attachments = viewModel.attachments,
|
||||||
|
uploading = viewModel.sendingMessage,
|
||||||
|
onRemove = viewModel::removeAttachment
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageField(
|
||||||
|
messageContent = viewModel.messageContent,
|
||||||
|
onMessageContentChange = viewModel::setMessageContent,
|
||||||
|
onSendMessage = viewModel::sendPendingMessage,
|
||||||
|
onAddAttachment = {
|
||||||
|
pickFileLauncher.launch(arrayOf("*/*"))
|
||||||
|
},
|
||||||
|
channelType = channel.channelType!!,
|
||||||
|
channelName = channel.name ?: channel.id!!,
|
||||||
|
forceSendButton = viewModel.attachments.isNotEmpty(),
|
||||||
|
disabled = viewModel.attachments.isNotEmpty() && viewModel.sendingMessage
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimatedVisibility(visible = viewModel.attachments.isNotEmpty()) {
|
|
||||||
AttachmentManager(
|
|
||||||
attachments = viewModel.attachments,
|
|
||||||
uploading = viewModel.sendingMessage,
|
|
||||||
onRemove = viewModel::removeAttachment
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageField(
|
|
||||||
messageContent = viewModel.messageContent,
|
|
||||||
onMessageContentChange = viewModel::setMessageContent,
|
|
||||||
onSendMessage = viewModel::sendPendingMessage,
|
|
||||||
onAddAttachment = {
|
|
||||||
pickFileLauncher.launch(arrayOf("*/*"))
|
|
||||||
},
|
|
||||||
channelType = channel.channelType!!,
|
|
||||||
channelName = channel.name ?: channel.id!!,
|
|
||||||
forceSendButton = viewModel.attachments.isNotEmpty(),
|
|
||||||
disabled = viewModel.attachments.isNotEmpty() && viewModel.sendingMessage
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue