@@ -27,7 +27,6 @@ import androidx.compose.foundation.layout.Arrangement
2727import androidx.compose.foundation.layout.Box
2828import androidx.compose.foundation.layout.Column
2929import androidx.compose.foundation.layout.ColumnScope
30- import androidx.compose.foundation.layout.IntrinsicSize
3130import androidx.compose.foundation.layout.Row
3231import androidx.compose.foundation.layout.RowScope
3332import androidx.compose.foundation.layout.Spacer
@@ -41,7 +40,6 @@ import androidx.compose.foundation.layout.padding
4140import androidx.compose.foundation.layout.size
4241import androidx.compose.foundation.layout.width
4342import androidx.compose.foundation.layout.widthIn
44- import androidx.compose.foundation.layout.wrapContentWidth
4543import androidx.compose.foundation.lazy.LazyColumn
4644import androidx.compose.foundation.lazy.items
4745import androidx.compose.foundation.lazy.rememberLazyListState
@@ -453,11 +451,13 @@ class ComposeChatAdapter(
453451 val color = if (incoming) {
454452 if (message.isDeleted) {
455453 LocalContext .current.resources.getColor(
456- R .color.bg_message_list_incoming_bubble_deleted, null
454+ R .color.bg_message_list_incoming_bubble_deleted,
455+ null
457456 )
458457 } else {
459458 LocalContext .current.resources.getColor(
460- R .color.bg_message_list_incoming_bubble, null
459+ R .color.bg_message_list_incoming_bubble,
460+ null
461461 )
462462 }
463463 } else {
@@ -469,12 +469,14 @@ class ComposeChatAdapter(
469469 }
470470 val shape = if (incoming) incomingShape else outgoingShape
471471
472+ val rowModifier = if (message.id == messageId && playAnimation) {
473+ Modifier .withCustomAnimation(incoming)
474+ } else {
475+ Modifier
476+ }
477+
472478 Row (
473- modifier = (
474- if (message.id == messageId && playAnimation) Modifier .withCustomAnimation(incoming)
475- else Modifier
476- )
477- .fillMaxWidth(),
479+ modifier = rowModifier.fillMaxWidth(),
478480 horizontalArrangement = if (incoming) Arrangement .Start else Arrangement .End
479481 ) {
480482 if (incoming) {
@@ -501,8 +503,11 @@ class ComposeChatAdapter(
501503 color = Color (color),
502504 shape = shape
503505 ) {
504- val modifier = if (includePadding) Modifier .padding(16 .dp, 4 .dp, 16 .dp, 4 .dp)
505- else Modifier
506+ val modifier = if (includePadding) {
507+ Modifier .padding(16 .dp, 4 .dp, 16 .dp, 4 .dp)
508+ } else {
509+ Modifier
510+ }
506511
507512 Column (modifier = modifier) {
508513 if (messagesJson != null &&
@@ -545,7 +550,6 @@ class ComposeChatAdapter(
545550 ReadStatus (message)
546551 }
547552 }
548-
549553 }
550554 }
551555 }
@@ -598,9 +602,7 @@ class ComposeChatAdapter(
598602 }
599603 }
600604
601- fun isFirstMessageOfThreadInNormalChat (message : ChatMessage ): Boolean {
602- return threadId == null && message.isThread
603- }
605+ fun isFirstMessageOfThreadInNormalChat (message : ChatMessage ): Boolean = threadId == null && message.isThread
604606
605607 @Composable
606608 private fun Modifier.withCustomAnimation (incoming : Boolean ): Modifier {
0 commit comments