From f4ffc0a1b51a5f03e2a27a1a9787400c84c03146 Mon Sep 17 00:00:00 2001 From: Rajat Mittal Date: Mon, 14 Oct 2024 20:49:26 -0700 Subject: [PATCH] Fixed typing indicator display name --- .../views/ChatComponents.kt | 23 ++++++++++++++++++- .../views/TypingIndicator.kt | 1 - 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/amazon/connect/chat/androidchatexample/views/ChatComponents.kt b/app/src/main/java/com/amazon/connect/chat/androidchatexample/views/ChatComponents.kt index 0d5f3ae..7cd9801 100644 --- a/app/src/main/java/com/amazon/connect/chat/androidchatexample/views/ChatComponents.kt +++ b/app/src/main/java/com/amazon/connect/chat/androidchatexample/views/ChatComponents.kt @@ -267,7 +267,28 @@ fun EventView(event: Event) { contentAlignment = alignment ) { if (isTypingEvent) { - TypingIndicator() + Column( + modifier = Modifier + .fillMaxWidth() + .background( + Color(0xFFFFFFFF), + RoundedCornerShape(8.dp) + ) + .padding(8.dp) + ) { + event.displayName?.let { + Text( + text = it, + color = Color.Black, + style = MaterialTheme.typography.bodyMedium, + modifier = Modifier + .padding(4.dp), + maxLines = 1, + overflow = TextOverflow.Ellipsis + ) + } + TypingIndicator() + } } else if (event.eventDirection == MessageDirection.COMMON) { event.text?.let { Text( diff --git a/app/src/main/java/com/amazon/connect/chat/androidchatexample/views/TypingIndicator.kt b/app/src/main/java/com/amazon/connect/chat/androidchatexample/views/TypingIndicator.kt index ef6b772..0513fed 100644 --- a/app/src/main/java/com/amazon/connect/chat/androidchatexample/views/TypingIndicator.kt +++ b/app/src/main/java/com/amazon/connect/chat/androidchatexample/views/TypingIndicator.kt @@ -47,7 +47,6 @@ fun TypingIndicator() { Box( contentAlignment = Alignment.Center, modifier = Modifier - .padding(10.dp) .background(Color(0xFFEDEDED), RoundedCornerShape(8.dp)) .padding( start = 15.dp) .padding( end = 10.dp)