From 742b8b25e8edada43aa627970c77c19ea18ab239 Mon Sep 17 00:00:00 2001 From: zhong <2724770085@qq.com> Date: Mon, 1 Dec 2025 18:45:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E7=BE=A4=E8=81=8A=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2UI=E8=B0=83=E6=95=B4=EF=BC=9A=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E7=BE=A4=E8=81=8A=E6=8C=89=E9=92=AE=E6=AD=A3?= =?UTF-8?q?=E5=B8=B8=E7=8A=B6=E6=80=81=E4=B8=8B=E7=9A=84=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=EF=BC=9B=E6=96=B0=E5=A2=9E=E7=A6=81=E7=94=A8=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E4=B8=8B=E7=82=B9=E5=87=BB=E6=97=B6=E6=8F=90=E7=A4=BA=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ravenow/ui/group/CreateGroupChatScreen.kt | 170 +++++++++++++----- app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-zh/strings.xml | 1 + app/src/main/res/values/strings.xml | 3 + 4 files changed, 130 insertions(+), 45 deletions(-) diff --git a/app/src/main/java/com/aiosman/ravenow/ui/group/CreateGroupChatScreen.kt b/app/src/main/java/com/aiosman/ravenow/ui/group/CreateGroupChatScreen.kt index 6bf6c4f..e6062d4 100644 --- a/app/src/main/java/com/aiosman/ravenow/ui/group/CreateGroupChatScreen.kt +++ b/app/src/main/java/com/aiosman/ravenow/ui/group/CreateGroupChatScreen.kt @@ -99,6 +99,15 @@ fun CreateGroupChatScreen() { } val navigationBarPadding = WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding() + var showSelectTipsDialog by remember { mutableStateOf(false) } + + // 自动隐藏“请选择群成员并输入群名称”提示弹窗 + LaunchedEffect(showSelectTipsDialog) { + if (showSelectTipsDialog) { + kotlinx.coroutines.delay(2000) + showSelectTipsDialog = false + } + } // 获取费用和余额信息 val pointsRules by PointService.pointsRules.collectAsState(initial = null) @@ -495,63 +504,134 @@ fun CreateGroupChatScreen() { } } - // 创建群聊按钮 - 固定在底部 - Button( - onClick = { - // 创建群聊逻辑 - if (selectedMembers.isNotEmpty()) { - // 检查是否超过上限 - if (selectedMembers.size > maxMemberLimit) { - CreateGroupChatViewModel.showError(context.getString(R.string.create_group_chat_exceed_limit, maxMemberLimit)) - return@Button - } - // 如果费用大于0,显示确认弹窗 - if (cost > 0) { - CreateGroupChatViewModel.showConfirmDialog() + // 创建群聊按钮 - 固定在底部(启用时使用渐变背景) + val isCreateEnabled = + groupName.text.isNotEmpty() && selectedMembers.isNotEmpty() && !CreateGroupChatViewModel.isLoading + + Box( + modifier = Modifier + .fillMaxWidth() + .padding( + start = 16.dp, + end = 16.dp, + top = buttonTopPadding, + bottom = navigationBarPadding + 16.dp + ) + .let { baseModifier -> + if (isCreateEnabled) { + baseModifier.background( + brush = Brush.linearGradient( + colors = listOf( + Color(0x997c45ed), + Color(0x997c68ef), + Color(0x997bd8f8) + ) + ), + shape = RoundedCornerShape(24.dp) + ) } else { - // 费用为0,直接创建 - scope.launch { - val success = CreateGroupChatViewModel.createGroupChat( - groupName = groupName.text, - selectedMembers = selectedMembers, - context = context + baseModifier + } + } + ) { + Button( + onClick = { + // 创建群聊逻辑 + if (selectedMembers.isNotEmpty()) { + // 检查是否超过上限 + if (selectedMembers.size > maxMemberLimit) { + CreateGroupChatViewModel.showError( + context.getString( + R.string.create_group_chat_exceed_limit, + maxMemberLimit + ) ) - if (success) { - navController.popBackStack() + return@Button + } + // 如果费用大于0,显示确认弹窗 + if (cost > 0) { + CreateGroupChatViewModel.showConfirmDialog() + } else { + // 费用为0,直接创建 + scope.launch { + val success = CreateGroupChatViewModel.createGroupChat( + groupName = groupName.text, + selectedMembers = selectedMembers, + context = context + ) + if (success) { + navController.popBackStack() + } } } } + }, + modifier = Modifier + .fillMaxWidth(), + colors = ButtonDefaults.buttonColors( + containerColor = if (isCreateEnabled) Color.Transparent else AppColors.main, + contentColor = AppColors.mainText, + disabledContainerColor = AppColors.disabledBackground, + disabledContentColor = AppColors.text + ), + shape = RoundedCornerShape(24.dp), + enabled = isCreateEnabled + ) { + if (CreateGroupChatViewModel.isLoading) { + Text( + text = stringResource(R.string.agent_createing), + fontSize = 16.sp, + fontWeight = FontWeight.W600 + ) + } else { + Text( + text = stringResource(R.string.create_group_chat), + fontSize = 16.sp, + fontWeight = FontWeight.W600 + ) } - }, - modifier = Modifier - .fillMaxWidth() - .padding(start = 16.dp, end = 16.dp, top = buttonTopPadding, bottom = navigationBarPadding + 16.dp), - colors = ButtonDefaults.buttonColors( - containerColor = AppColors.main, - contentColor = AppColors.mainText, - disabledContainerColor = AppColors.disabledBackground, - disabledContentColor = AppColors.text - ), - shape = RoundedCornerShape(24.dp), - enabled = groupName.text.isNotEmpty() && selectedMembers.isNotEmpty() && !CreateGroupChatViewModel.isLoading - ) { - if (CreateGroupChatViewModel.isLoading) { - Text( - text = stringResource(R.string.agent_createing), - fontSize = 16.sp, - fontWeight = FontWeight.W600 - ) - } else { - Text( - text = stringResource(R.string.create_group_chat), - fontSize = 16.sp, - fontWeight = FontWeight.W600 + } + + // 禁用状态下拦截点击并弹出提示 + if (!isCreateEnabled) { + Box( + modifier = Modifier + .matchParentSize() + .noRippleClickable { + showSelectTipsDialog = true + } ) } } } + // 请选择群成员并输入群名称 提示弹窗 + if (showSelectTipsDialog) { + Dialog( + onDismissRequest = { showSelectTipsDialog = false }, + properties = DialogProperties(dismissOnClickOutside = true, dismissOnBackPress = true) + ) { + Box( + modifier = Modifier + .background(color = AppColors.background, shape = RoundedCornerShape(16.dp)) + .padding(horizontal = 20.dp, vertical = 16.dp) + ) { + Column( + horizontalAlignment = Alignment.CenterHorizontally + ) { + Text( + text = stringResource(R.string.create_group_chat_select_members_and_name), + fontSize = 16.sp, + fontWeight = FontWeight.W600, + color = Color(0xFF7C45ED), + textAlign = TextAlign.Center + ) + } + } + } + } + // 消费确认弹窗 if (CreateGroupChatViewModel.showConfirmDialog) { CreateGroupChatConfirmDialog( diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index e756bb2..c81e7be 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -225,6 +225,7 @@ Paip.ai まだここは空です + グループメンバーを選択し、グループ名を入力してください 作成 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index f8b5e68..0a2b27e 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -225,6 +225,7 @@ 仅保存最近5个草稿 历史搜索 这里还空着呢~ + 请选择群成员并输入群名称 创建 AI diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b8db9da..169b148 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -224,6 +224,9 @@ people Paip.ai It\'s still empty here + Please select group members and enter group name + + Create