feat: Enhance MessageBubble for media-only messages with adjusted padding and border

This commit is contained in:
k1ngsterr1
2026-01-25 16:59:29 +05:00
parent 3608af99c3
commit b385379850
2 changed files with 29 additions and 16 deletions

View File

@@ -292,17 +292,6 @@ fun ImageAttachment(
}
}
// Тонкий бордер как в Telegram (просто через border modifier)
Box(
modifier = Modifier
.fillMaxSize()
.border(
width = 1.dp,
color = borderColor,
shape = RoundedCornerShape(12.dp)
)
)
// Время в правом нижнем углу (только если изображение загружено)
if (downloadStatus == DownloadStatus.DOWNLOADED) {
Box(

View File

@@ -306,6 +306,16 @@ fun MessageBubble(
Spacer(modifier = Modifier.weight(1f))
}
// Проверяем - есть ли только фотки без текста
val hasOnlyMedia = message.attachments.isNotEmpty() &&
message.text.isEmpty() &&
message.replyData == null &&
message.attachments.all { it.type == com.rosetta.messenger.network.AttachmentType.IMAGE }
// Для сообщений только с фото - минимальный padding и тонкий border
val bubblePadding = if (hasOnlyMedia) PaddingValues(0.dp) else PaddingValues(horizontal = 10.dp, vertical = 8.dp)
val bubbleBorderWidth = if (hasOnlyMedia) 1.dp else 0.dp
Box(
modifier = Modifier
.padding(end = 12.dp)
@@ -323,8 +333,22 @@ fun MessageBubble(
onLongClick = onLongClick
)
.clip(bubbleShape)
.background(bubbleColor)
.padding(horizontal = 10.dp, vertical = 8.dp)
.then(
if (hasOnlyMedia) {
Modifier.border(
width = bubbleBorderWidth,
color = if (message.isOutgoing) {
Color.White.copy(alpha = 0.15f)
} else {
if (isDarkTheme) Color.White.copy(alpha = 0.1f) else Color.Black.copy(alpha = 0.08f)
},
shape = bubbleShape
)
} else {
Modifier.background(bubbleColor)
}
)
.padding(bubblePadding)
) {
Column {
message.replyData?.let { reply ->
@@ -355,7 +379,7 @@ fun MessageBubble(
}
// Если есть reply - текст слева, время справа на одной строке
if (message.replyData != null) {
if (message.replyData != null && message.text.isNotEmpty()) {
Row(
verticalAlignment = Alignment.Bottom,
modifier = Modifier.fillMaxWidth()
@@ -392,8 +416,8 @@ fun MessageBubble(
}
}
}
} else {
// Без reply - компактно в одну строку
} else if (!hasOnlyMedia && message.text.isNotEmpty()) {
// Без reply и не только фото - компактно в одну строку
Row(
verticalAlignment = Alignment.Bottom,
horizontalArrangement = Arrangement.spacedBy(10.dp),