add delta sync for dm-v15
This commit is contained in:
parent
dc6186233c
commit
b0b5c4d43c
5 changed files with 45 additions and 45 deletions
|
|
@ -22,6 +22,7 @@ import androidx.compose.runtime.remember
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Brush
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
|
@ -34,7 +35,8 @@ fun AudioMessageBubble(
|
|||
message: MessageUiModel,
|
||||
audioUrl: String,
|
||||
isMe: Boolean,
|
||||
bubbleColor: Color,
|
||||
bubbleBrush: Brush,
|
||||
bubbleAlpha: Float = 1.0f,
|
||||
viewModel: ChatViewModel // 🎯 傳入 ViewModel
|
||||
) {
|
||||
// 訂閱全域的播放狀態
|
||||
|
|
@ -57,7 +59,7 @@ fun AudioMessageBubble(
|
|||
bottomEnd = if (isMe) 0.dp else 12.dp
|
||||
)
|
||||
)
|
||||
.background(bubbleColor)
|
||||
.background(brush = bubbleBrush, alpha = bubbleAlpha)
|
||||
.padding(horizontal = 8.dp, vertical = 6.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(4.dp)) {
|
||||
// 播放 / 暫停按鈕
|
||||
IconButton(
|
||||
|
|
|
|||
|
|
@ -56,17 +56,8 @@ fun MessageInputBar(
|
|||
.fillMaxWidth()
|
||||
.navigationBarsPadding() // 自動適應 Android 系統導覽列高度
|
||||
.padding(horizontal = 16.dp, vertical = 8.dp) // 懸浮的外邊距
|
||||
) {
|
||||
|
||||
//glass effect
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.matchParentSize()
|
||||
.blur(10.dp)
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.matchParentSize()
|
||||
//color
|
||||
.background(
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
RoundedCornerShape(16.dp)
|
||||
|
|
@ -76,7 +67,8 @@ fun MessageInputBar(
|
|||
Color.White.copy(alpha = 0.3f),
|
||||
RoundedCornerShape(16.dp)
|
||||
)
|
||||
)
|
||||
) {
|
||||
|
||||
|
||||
Column(modifier = Modifier.fillMaxWidth()) {
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Brush
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
|
|
@ -705,17 +706,23 @@ fun MessageRow(
|
|||
onReactionClick: (MessageUiModel, String) -> Unit,
|
||||
onRowClick: (MessageUiModel) -> Unit,
|
||||
) {
|
||||
val finalBubbleColor = remember(message.status, isHighlight, message.callLogInfo) {
|
||||
val baseColor = when {
|
||||
val (bubbleBrush, bubbleAlpha) = remember(message.status, isHighlight, message.callLogInfo, isMe) {
|
||||
val alpha = if (message.status == MessageStatus.SENDING) 0.75f else 1.0f
|
||||
val brush = when {
|
||||
message.callLogInfo != null -> {
|
||||
if (message.callLogInfo.type == "call_missed") Color(0xFFFCE8E6) else Color(0xFFF1F3F4)
|
||||
SolidColor(if (message.callLogInfo.type == "call_missed") Color(0xFFFCE8E6) else Color(0xFFF1F3F4))
|
||||
}
|
||||
isMe && isHighlight -> Color(0xFFB4E197)
|
||||
isMe -> Color(0xFFDCF8C6)
|
||||
!isMe && isHighlight -> Color(0xFFCFD8DC)
|
||||
else -> Color(0xFFECEFF1)
|
||||
isMe -> {
|
||||
if (isHighlight) {
|
||||
Brush.linearGradient(listOf(Color(0xFFFF8F00), Color(0xFFFFA000)))
|
||||
} else {
|
||||
Brush.linearGradient(listOf(Color(0xFFFF8F00), Color(0xFFFFA000)))
|
||||
}
|
||||
if (message.status == MessageStatus.SENDING) baseColor.copy(alpha = 0.75f) else baseColor
|
||||
}
|
||||
!isMe && isHighlight -> SolidColor(Color(0xFFCFD8DC))
|
||||
else -> SolidColor(Color(0xFFECEFF1))
|
||||
}
|
||||
brush to alpha
|
||||
}
|
||||
|
||||
Row(
|
||||
|
|
@ -761,16 +768,16 @@ fun MessageRow(
|
|||
VideoMessageContent(message, isMe, partnerDisplayName, currentUserId, onReplyClick, onRowClick)
|
||||
}
|
||||
message.isAudio -> {
|
||||
AudioMessageContent(message, isMe, partnerDisplayName, currentUserId, finalBubbleColor, viewModel, onReplyClick)
|
||||
AudioMessageContent(message, isMe, partnerDisplayName, currentUserId, bubbleBrush, bubbleAlpha, viewModel, onReplyClick)
|
||||
}
|
||||
message.isFile -> {
|
||||
FileMessageContent(message, isMe, partnerDisplayName, currentUserId, finalBubbleColor, viewModel, onReplyClick, onRowClick)
|
||||
FileMessageContent(message, isMe, partnerDisplayName, currentUserId, bubbleBrush, bubbleAlpha, viewModel, onReplyClick, onRowClick)
|
||||
}
|
||||
message.callLogInfo != null -> {
|
||||
CallLogMessageContent(message, isMe, partnerDisplayName, currentUserId, onReplyClick, onRowClick)
|
||||
}
|
||||
else -> {
|
||||
TextMessageContent(message, isMe, partnerDisplayName, currentUserId, finalBubbleColor, onReplyClick, onRowClick)
|
||||
TextMessageContent(message, isMe, partnerDisplayName, currentUserId, bubbleBrush, bubbleAlpha, onReplyClick, onRowClick)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1008,7 +1015,8 @@ private fun AudioMessageContent(
|
|||
isMe: Boolean,
|
||||
partnerDisplayName: String,
|
||||
currentUserId: String,
|
||||
bubbleColor: Color,
|
||||
bubbleBrush: Brush,
|
||||
bubbleAlpha: Float,
|
||||
viewModel: ChatViewModel,
|
||||
onReplyClick: (MessageUiModel) -> Unit
|
||||
) {
|
||||
|
|
@ -1029,7 +1037,8 @@ private fun AudioMessageContent(
|
|||
message = message,
|
||||
audioUrl = message.mediaUrl,
|
||||
isMe = isMe,
|
||||
bubbleColor = bubbleColor,
|
||||
bubbleBrush = bubbleBrush,
|
||||
bubbleAlpha = bubbleAlpha,
|
||||
viewModel = viewModel
|
||||
)
|
||||
}
|
||||
|
|
@ -1041,7 +1050,8 @@ private fun FileMessageContent(
|
|||
isMe: Boolean,
|
||||
partnerDisplayName: String,
|
||||
currentUserId: String,
|
||||
bubbleColor: Color,
|
||||
bubbleBrush: Brush,
|
||||
bubbleAlpha: Float,
|
||||
viewModel: ChatViewModel,
|
||||
onReplyClick: (MessageUiModel) -> Unit,
|
||||
onRowClick: (MessageUiModel) -> Unit
|
||||
|
|
@ -1069,7 +1079,7 @@ private fun FileMessageContent(
|
|||
}
|
||||
}
|
||||
)
|
||||
.background(color = bubbleColor)
|
||||
.background(brush = bubbleBrush, alpha = bubbleAlpha)
|
||||
.padding(horizontal = 12.dp, vertical = 10.dp)
|
||||
) {
|
||||
Column {
|
||||
|
|
@ -1181,7 +1191,8 @@ private fun TextMessageContent(
|
|||
isMe: Boolean,
|
||||
partnerDisplayName: String,
|
||||
currentUserId: String,
|
||||
bubbleColor: Color,
|
||||
bubbleBrush: Brush,
|
||||
bubbleAlpha: Float,
|
||||
onReplyClick: (MessageUiModel) -> Unit,
|
||||
onRowClick: (MessageUiModel) -> Unit
|
||||
) {
|
||||
|
|
@ -1199,7 +1210,7 @@ private fun TextMessageContent(
|
|||
onLongClick = { onReplyClick(message) },
|
||||
onClick = { onRowClick(message) }
|
||||
)
|
||||
.background(color = bubbleColor)
|
||||
.background(brush = bubbleBrush, alpha = bubbleAlpha)
|
||||
.padding(horizontal = 12.dp, vertical = 8.dp)
|
||||
) {
|
||||
Column {
|
||||
|
|
|
|||
|
|
@ -153,12 +153,7 @@ fun Loaded_Tg_Message(
|
|||
},
|
||||
modifier = Modifier
|
||||
.background(
|
||||
color = MaterialTheme.colorScheme.primary, // ⭐ 調低透明度
|
||||
shape = RoundedCornerShape(0.dp)
|
||||
)
|
||||
.border(
|
||||
width = 0.5.dp,
|
||||
color = Color.White.copy(alpha = 0.4f),
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
shape = RoundedCornerShape(0.dp)
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ fun HorizontalWheelPicker(
|
|||
modifier = Modifier
|
||||
.matchParentSize()
|
||||
.background(
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
Color(0x14FFFFFF),
|
||||
RoundedCornerShape(16.dp)
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue