From 6daaa0758c3b3b9843222f026cd286ada67b1391 Mon Sep 17 00:00:00 2001 From: Kevinlinpr Date: Thu, 10 Oct 2024 00:26:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=81=8A=E5=A4=A9=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E8=BE=B9=E8=B7=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aiosman/riderpro/ui/chat/ChatScreen.kt | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/com/aiosman/riderpro/ui/chat/ChatScreen.kt b/app/src/main/java/com/aiosman/riderpro/ui/chat/ChatScreen.kt index 723a020..b19b3b9 100644 --- a/app/src/main/java/com/aiosman/riderpro/ui/chat/ChatScreen.kt +++ b/app/src/main/java/com/aiosman/riderpro/ui/chat/ChatScreen.kt @@ -51,6 +51,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.focus.onFocusChanged import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity @@ -133,7 +134,7 @@ fun ChatScreen(userId: String) { Image( painter = painterResource(R.drawable.rider_pro_nav_back), modifier = Modifier - .size(36.dp) + .size(28.dp) .noRippleClickable { navController.popBackStack() }, @@ -237,11 +238,11 @@ fun ChatSelfItem(item: ChatItem) { Spacer(modifier = Modifier.height(4.dp)) Box( modifier = Modifier - .widthIn(min = 20.dp, max = 250.dp) + .widthIn(min = 20.dp, max = (if (item.messageType == V2TIMMessage.V2TIM_ELEM_TYPE_TEXT) 250.dp else 150.dp)) .clip(RoundedCornerShape(8.dp)) .background(Color(0xFF000000)) - .padding(vertical = 8.dp, horizontal = 16.dp) - .padding(bottom = 3.dp) + .padding(vertical = (if (item.messageType == V2TIMMessage.V2TIM_ELEM_TYPE_TEXT) 8.dp else 0.dp), horizontal = (if (item.messageType == V2TIMMessage.V2TIM_ELEM_TYPE_TEXT) 16.dp else 0.dp)) + .padding(bottom = (if (item.messageType == V2TIMMessage.V2TIM_ELEM_TYPE_TEXT) 3.dp else 0.dp)) ) { when (item.messageType) { V2TIMMessage.V2TIM_ELEM_TYPE_TEXT -> { @@ -333,11 +334,11 @@ fun ChatOtherItem(item: ChatItem) { Spacer(modifier = Modifier.height(4.dp)) Box( modifier = Modifier - .widthIn(min = 20.dp, max = 250.dp) + .widthIn(min = 20.dp, max = (if (item.messageType == V2TIMMessage.V2TIM_ELEM_TYPE_TEXT) 250.dp else 150.dp)) .clip(RoundedCornerShape(8.dp)) .background(Color(0xffFFFFFF)) - .padding(vertical = 8.dp, horizontal = 16.dp) - .padding(bottom = 3.dp) + .padding(vertical = (if (item.messageType == V2TIMMessage.V2TIM_ELEM_TYPE_TEXT) 8.dp else 0.dp), horizontal = (if (item.messageType == V2TIMMessage.V2TIM_ELEM_TYPE_TEXT) 16.dp else 0.dp)) + .padding(bottom = (if (item.messageType == V2TIMMessage.V2TIM_ELEM_TYPE_TEXT) 3.dp else 0.dp)) ) { when (item.messageType) { V2TIMMessage.V2TIM_ELEM_TYPE_TEXT -> { @@ -441,7 +442,7 @@ fun ChatInput( .clip(RoundedCornerShape(16.dp)) .background(Color(0xffe5e5e5)) .padding(horizontal = 16.dp), - contentAlignment = androidx.compose.ui.Alignment.CenterStart + contentAlignment = androidx.compose.ui.Alignment.CenterStart, ) { BasicTextField( value = text, @@ -476,10 +477,10 @@ fun ChatInput( } Spacer(modifier = Modifier.width(16.dp)) Icon( - painter = painterResource(id = R.drawable.rider_pro_images), + painter = painterResource(id = R.drawable.rider_pro_camera), contentDescription = "Emoji", modifier = Modifier - .size(32.dp) + .size(30.dp) .noRippleClickable { imagePickUpLauncher.launch( Intent.createChooser( @@ -490,17 +491,15 @@ fun ChatInput( ) ) }, - tint = Color(0xff000000) + tint = Color(0xffe0e0e0) ) Spacer(modifier = Modifier.width(8.dp)) - Crossfade(targetState = text.isNotEmpty(), animationSpec = tween(500)) { isNotEmpty -> - Image( - painter = rememberUpdatedState( - if (isNotEmpty) painterResource(id = R.drawable.rider_pro_send) else painterResource( - id = R.drawable.rider_pro_send_disable - ) - ).value, - contentDescription = "Send", + Crossfade(targetState = text.isNotEmpty(), animationSpec = tween(500), + label = "" + ) { isNotEmpty -> + Icon( + painter = painterResource(id = R.drawable.rider_pro_video_share), + contentDescription = "Emoji", modifier = Modifier .size(32.dp) .noRippleClickable { @@ -509,6 +508,7 @@ fun ChatInput( text = "" } }, + tint = if (isNotEmpty) Color.Red else Color(0xffe0e0e0) ) } }