From c700b7a67cfead0c91ae8e085b9bacc435f114f5 Mon Sep 17 00:00:00 2001 From: yangshilin <2157598560@qq.com> Date: Tue, 10 Mar 2026 15:24:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=85=89=E6=A0=87bug?= =?UTF-8?q?=EF=BC=9B=E7=A7=BB=E9=99=A4=E8=BE=93=E5=85=A5=E6=A1=86=E8=A1=A8?= =?UTF-8?q?=E6=83=85=E6=8C=89=E9=92=AE=EF=BC=9B=E4=BF=AE=E5=A4=8D=E7=AB=A0?= =?UTF-8?q?=E8=8A=82=E5=9B=9E=E9=80=80=E5=8A=A8=E7=94=BB=EF=BC=9B=E9=83=A8?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E9=9D=A2=E5=A4=A7=E5=AD=97=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/components/chat/ChatInputField.kt | 26 ++++----- .../components/chat/ChatInputPresentation.kt | 3 -- .../ui/components/profile/FAQItem.kt | 5 +- .../ui/screens/AccountManagementScreen.kt | 54 ++++++++++++++----- .../life_echo/ui/screens/MyMemoirScreen.kt | 39 ++++++++++---- 5 files changed, 84 insertions(+), 43 deletions(-) diff --git a/app-android/app/src/main/java/com/huaga/life_echo/ui/components/chat/ChatInputField.kt b/app-android/app/src/main/java/com/huaga/life_echo/ui/components/chat/ChatInputField.kt index ebb28e2..32de6f8 100644 --- a/app-android/app/src/main/java/com/huaga/life_echo/ui/components/chat/ChatInputField.kt +++ b/app-android/app/src/main/java/com/huaga/life_echo/ui/components/chat/ChatInputField.kt @@ -38,6 +38,7 @@ import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.layout.SubcomposeLayout import androidx.compose.ui.platform.LocalSoftwareKeyboardController +import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.semantics.Role import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp @@ -72,7 +73,6 @@ fun ChatInputField( modifier: Modifier = Modifier, placeholder: String = "输入消息...", enabled: Boolean = true, - onEmojiClick: () -> Unit = {}, onAddClick: () -> Unit = {}, onStartRecording: () -> Unit = {}, onStopRecording: () -> Unit = {}, @@ -167,15 +167,6 @@ fun ChatInputField( } } - if (layoutPresentation.showEmojiAction) { - RoundIconAction( - icon = AppIcons.SentimentSatisfied, - contentDescription = "表情", - enabled = enabled && !isRecording, - onClick = onEmojiClick, - ) - } - when (layoutPresentation.trailingAction) { ChatInputTrailingAction.ADD -> { RoundIconAction( @@ -319,9 +310,18 @@ private fun TextInputContent( enabled: Boolean, modifier: Modifier = Modifier, ) { + var textFieldValue by remember { mutableStateOf(TextFieldValue(value)) } + LaunchedEffect(value) { + if (value != textFieldValue.text) { + textFieldValue = TextFieldValue(value) + } + } BasicTextField( - value = value, - onValueChange = onValueChange, + value = textFieldValue, + onValueChange = { + textFieldValue = it + onValueChange(it.text) + }, modifier = modifier, textStyle = MaterialTheme.typography.bodyLarge.copy( fontSize = AppTypography.titleMedium, @@ -341,7 +341,7 @@ private fun TextInputContent( CenterAreaShell( backgroundColor = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.14f), ) { - if (value.isEmpty()) { + if (textFieldValue.text.isEmpty()) { Text( text = placeholder, color = MaterialTheme.colorScheme.onSurfaceVariant, diff --git a/app-android/app/src/main/java/com/huaga/life_echo/ui/components/chat/ChatInputPresentation.kt b/app-android/app/src/main/java/com/huaga/life_echo/ui/components/chat/ChatInputPresentation.kt index 499b6dd..dd313d8 100644 --- a/app-android/app/src/main/java/com/huaga/life_echo/ui/components/chat/ChatInputPresentation.kt +++ b/app-android/app/src/main/java/com/huaga/life_echo/ui/components/chat/ChatInputPresentation.kt @@ -32,7 +32,6 @@ enum class ChatInputTrailingAction { data class ChatInputLayoutPresentation( val leadingAction: ChatInputLeadingAction, - val showEmojiAction: Boolean, val trailingAction: ChatInputTrailingAction, ) { companion object { @@ -44,7 +43,6 @@ data class ChatInputLayoutPresentation( return when (inputMode) { InputMode.TEXT -> ChatInputLayoutPresentation( leadingAction = ChatInputLeadingAction.SWITCH_TO_VOICE, - showEmojiAction = true, trailingAction = if (hasText) { ChatInputTrailingAction.SEND } else { @@ -54,7 +52,6 @@ data class ChatInputLayoutPresentation( InputMode.VOICE -> ChatInputLayoutPresentation( leadingAction = ChatInputLeadingAction.SWITCH_TO_TEXT, - showEmojiAction = !isRecording, trailingAction = if (isRecording) { ChatInputTrailingAction.CANCEL } else { diff --git a/app-android/app/src/main/java/com/huaga/life_echo/ui/components/profile/FAQItem.kt b/app-android/app/src/main/java/com/huaga/life_echo/ui/components/profile/FAQItem.kt index 911f525..e152490 100644 --- a/app-android/app/src/main/java/com/huaga/life_echo/ui/components/profile/FAQItem.kt +++ b/app-android/app/src/main/java/com/huaga/life_echo/ui/components/profile/FAQItem.kt @@ -13,7 +13,6 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp import com.huaga.life_echo.network.models.FAQDto import com.huaga.life_echo.ui.icons.AppIcons import com.huaga.life_echo.ui.theme.AppTypography @@ -67,8 +66,8 @@ fun FAQItem( Text( text = faq.answer, fontSize = AppTypography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, - lineHeight = 20.sp + lineHeight = AppTypography.lineHeightNormal, + color = MaterialTheme.colorScheme.onSurfaceVariant ) } } diff --git a/app-android/app/src/main/java/com/huaga/life_echo/ui/screens/AccountManagementScreen.kt b/app-android/app/src/main/java/com/huaga/life_echo/ui/screens/AccountManagementScreen.kt index 6573dad..e3f92d9 100644 --- a/app-android/app/src/main/java/com/huaga/life_echo/ui/screens/AccountManagementScreen.kt +++ b/app-android/app/src/main/java/com/huaga/life_echo/ui/screens/AccountManagementScreen.kt @@ -232,38 +232,63 @@ fun AccountManagementScreen( ) } - // 登出当前设备确认对话框 + // 登出当前设备确认对话框(跟随大字模式) if (showLogoutDialog) { AlertDialog( onDismissRequest = { showLogoutDialog = false }, - title = { Text("确认登出") }, - text = { Text("确定要登出当前设备吗?") }, + title = { + Text( + text = "确认登出", + fontSize = AppTypography.titleMedium, + fontWeight = FontWeight.SemiBold + ) + }, + text = { + Text( + text = "确定要登出当前设备吗?", + fontSize = AppTypography.bodyMedium, + lineHeight = AppTypography.lineHeightNormal + ) + }, confirmButton = { TextButton( onClick = { viewModel.logout() showLogoutDialog = false onLogoutSuccess() - } + }, + colors = ButtonDefaults.textButtonColors( + contentColor = MaterialTheme.colorScheme.error + ) ) { - Text("确认", color = MaterialTheme.colorScheme.error) + Text("确认", fontSize = AppTypography.bodyMedium) } }, dismissButton = { TextButton(onClick = { showLogoutDialog = false }) { - Text("取消") + Text("取消", fontSize = AppTypography.bodyMedium) } } ) } - // 登出所有设备确认对话框 + // 登出所有设备确认对话框(跟随大字模式) if (showLogoutAllDialog) { AlertDialog( onDismissRequest = { showLogoutAllDialog = false }, - title = { Text("确认登出所有设备") }, - text = { - Text("确定要登出所有设备吗?这将使您在所有设备上的登录状态失效,需要重新登录。") + title = { + Text( + text = "确认登出所有设备", + fontSize = AppTypography.titleMedium, + fontWeight = FontWeight.SemiBold + ) + }, + text = { + Text( + text = "确定要登出所有设备吗?这将使您在所有设备上的登录状态失效,需要重新登录。", + fontSize = AppTypography.bodyMedium, + lineHeight = AppTypography.lineHeightNormal + ) }, confirmButton = { TextButton( @@ -272,14 +297,17 @@ fun AccountManagementScreen( showLogoutAllDialog = false onLogoutSuccess() } - } + }, + colors = ButtonDefaults.textButtonColors( + contentColor = MaterialTheme.colorScheme.error + ) ) { - Text("确认登出", color = MaterialTheme.colorScheme.error) + Text("确认登出", fontSize = AppTypography.bodyMedium) } }, dismissButton = { TextButton(onClick = { showLogoutAllDialog = false }) { - Text("取消") + Text("取消", fontSize = AppTypography.bodyMedium) } } ) diff --git a/app-android/app/src/main/java/com/huaga/life_echo/ui/screens/MyMemoirScreen.kt b/app-android/app/src/main/java/com/huaga/life_echo/ui/screens/MyMemoirScreen.kt index 17da66c..12dc788 100644 --- a/app-android/app/src/main/java/com/huaga/life_echo/ui/screens/MyMemoirScreen.kt +++ b/app-android/app/src/main/java/com/huaga/life_echo/ui/screens/MyMemoirScreen.kt @@ -168,13 +168,25 @@ fun MyMemoirScreen( AnimatedContent( targetState = showFullTextReading || selectedChapter != null, transitionSpec = { - slideInHorizontally( - initialOffsetX = { it }, - animationSpec = tween(300) - ) togetherWith slideOutHorizontally( - targetOffsetX = { -it }, - animationSpec = tween(300) - ) + if (targetState) { + // 进入章节/阅读:新内容从右侧滑入,目录向左滑出 + slideInHorizontally( + initialOffsetX = { it }, + animationSpec = tween(300) + ) togetherWith slideOutHorizontally( + targetOffsetX = { -it }, + animationSpec = tween(300) + ) + } else { + // 返回目录:目录从左侧滑入,章节向右滑出 + slideInHorizontally( + initialOffsetX = { -it }, + animationSpec = tween(300) + ) togetherWith slideOutHorizontally( + targetOffsetX = { it }, + animationSpec = tween(300) + ) + } }, label = "memoir_navigation" ) { isReading -> @@ -230,18 +242,23 @@ fun MyMemoirScreen( // 清除回忆确认弹窗状态 var showClearDialog by remember { mutableStateOf(false) } - // 清除回忆确认弹窗 + // 清除回忆确认弹窗(跟随大字模式) if (showClearDialog) { AlertDialog( onDismissRequest = { showClearDialog = false }, title = { Text( text = "清除回忆", + fontSize = AppTypography.titleMedium, fontWeight = FontWeight.SemiBold ) }, text = { - Text("清除回忆会完全清除当前章节的内容,确定继续吗?") + Text( + "清除回忆会完全清除当前章节的内容,确定继续吗?", + fontSize = AppTypography.bodyMedium, + lineHeight = AppTypography.lineHeightNormal + ) }, confirmButton = { TextButton( @@ -255,12 +272,12 @@ fun MyMemoirScreen( contentColor = MaterialTheme.colorScheme.error ) ) { - Text("确定清除") + Text("确定清除", fontSize = AppTypography.bodyMedium) } }, dismissButton = { TextButton(onClick = { showClearDialog = false }) { - Text("取消") + Text("取消", fontSize = AppTypography.bodyMedium) } } )