From 2cbd2a975ff1d50e112af3a4ddd9637df041660f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=AB=98=E5=B8=86?= <3031465419@qq.com>
Date: Mon, 10 Nov 2025 15:13:26 +0800
Subject: [PATCH 1/2] =?UTF-8?q?Reapply=20"=E5=A2=9E=E5=8A=A0=E8=8B=B1?=
=?UTF-8?q?=E6=96=87=E6=97=A5=E8=AF=AD=E7=BF=BB=E8=AF=91=20=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9=E7=BC=96=E8=BE=91=E8=B5=84=E6=96=99=E7=95=8C=E9=9D=A2?=
=?UTF-8?q?=E6=97=A0=E6=B3=95=E6=9B=B4=E6=94=B9=E6=98=9F=E5=BA=A7mbit"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit a057f7f7fd02928f9af686bf98e37aa133426d13.
---
.../ravenow/ui/account/MbtiSelectScreen.kt | 5 +
.../ravenow/ui/account/ZodiacSelectScreen.kt | 60 ++++++++--
.../com/aiosman/ravenow/ui/account/edit2.kt | 31 ++---
.../tabs/profile/composable/GalleryItem.kt | 4 +-
.../composable/GroupChatEmptyContent.kt | 9 +-
.../tabs/profile/composable/UserAgentsList.kt | 10 +-
.../composable/UserContentPageIndicator.kt | 108 ++++++++++--------
.../index/tabs/profile/composable/UserItem.kt | 11 +-
app/src/main/res/values-ja/strings.xml | 29 +++++
app/src/main/res/values-zh/strings.xml | 29 +++++
app/src/main/res/values/strings.xml | 29 +++++
11 files changed, 240 insertions(+), 85 deletions(-)
diff --git a/app/src/main/java/com/aiosman/ravenow/ui/account/MbtiSelectScreen.kt b/app/src/main/java/com/aiosman/ravenow/ui/account/MbtiSelectScreen.kt
index 7748ade..cf49830 100644
--- a/app/src/main/java/com/aiosman/ravenow/ui/account/MbtiSelectScreen.kt
+++ b/app/src/main/java/com/aiosman/ravenow/ui/account/MbtiSelectScreen.kt
@@ -32,6 +32,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Check
+import com.aiosman.ravenow.AppState
import com.aiosman.ravenow.LocalAppTheme
import com.aiosman.ravenow.LocalNavController
import com.aiosman.ravenow.R
@@ -80,6 +81,10 @@ fun MbtiSelectScreen() {
isSelected = mbti == currentMbti,
onClick = {
model.mbti = mbti
+ // 立即保存到本地存储,确保选择后立即生效
+ AppState.UserId?.let { uid ->
+ com.aiosman.ravenow.AppStore.setUserMbti(uid, mbti)
+ }
navController.navigateUp()
}
)
diff --git a/app/src/main/java/com/aiosman/ravenow/ui/account/ZodiacSelectScreen.kt b/app/src/main/java/com/aiosman/ravenow/ui/account/ZodiacSelectScreen.kt
index 464fcfd..3a1a494 100644
--- a/app/src/main/java/com/aiosman/ravenow/ui/account/ZodiacSelectScreen.kt
+++ b/app/src/main/java/com/aiosman/ravenow/ui/account/ZodiacSelectScreen.kt
@@ -29,24 +29,55 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Check
+import com.aiosman.ravenow.AppState
import com.aiosman.ravenow.LocalAppTheme
import com.aiosman.ravenow.LocalNavController
import com.aiosman.ravenow.R
import com.aiosman.ravenow.ui.comment.NoticeScreenHeader
-// 星座列表
-val ZODIAC_SIGNS = listOf(
- "白羊座", "金牛座", "双子座", "巨蟹座",
- "狮子座", "处女座", "天秤座", "天蝎座",
- "射手座", "摩羯座", "水瓶座", "双鱼座"
+// 星座资源ID列表
+val ZODIAC_SIGN_RES_IDS = listOf(
+ R.string.zodiac_aries,
+ R.string.zodiac_taurus,
+ R.string.zodiac_gemini,
+ R.string.zodiac_cancer,
+ R.string.zodiac_leo,
+ R.string.zodiac_virgo,
+ R.string.zodiac_libra,
+ R.string.zodiac_scorpio,
+ R.string.zodiac_sagittarius,
+ R.string.zodiac_capricorn,
+ R.string.zodiac_aquarius,
+ R.string.zodiac_pisces
)
+/**
+ * 根据存储的星座字符串(可能是任何语言)找到对应的资源ID
+ * 如果找不到,返回null
+ */
+@Composable
+fun findZodiacResId(storedZodiac: String?): Int? {
+ if (storedZodiac.isNullOrEmpty()) return null
+
+ // 尝试在所有语言的资源中查找匹配
+ ZODIAC_SIGN_RES_IDS.forEachIndexed { index, resId ->
+ val zodiacText = stringResource(resId)
+ if (zodiacText == storedZodiac) {
+ return resId
+ }
+ }
+
+ // 如果找不到精确匹配,尝试通过资源ID索引查找(兼容旧数据)
+ // 这里可以根据需要添加更多兼容逻辑
+ return null
+}
+
@Composable
fun ZodiacSelectScreen() {
val navController = LocalNavController.current
val appColors = LocalAppTheme.current
val model = AccountEditViewModel
- val currentZodiac = model.zodiac
+ val currentZodiacResId = findZodiacResId(model.zodiac)
Column(
modifier = Modifier
@@ -70,12 +101,20 @@ fun ZodiacSelectScreen() {
modifier = Modifier.fillMaxSize(),
contentPadding = androidx.compose.foundation.layout.PaddingValues(horizontal = 16.dp, vertical = 8.dp)
) {
- items(ZODIAC_SIGNS) { zodiac ->
+ items(ZODIAC_SIGN_RES_IDS.size) { index ->
+ val zodiacResId = ZODIAC_SIGN_RES_IDS[index]
+ val zodiacText = stringResource(zodiacResId)
ZodiacItem(
- zodiac = zodiac,
- isSelected = zodiac == currentZodiac,
+ zodiac = zodiacText,
+ zodiacResId = zodiacResId,
+ isSelected = zodiacResId == currentZodiacResId,
onClick = {
- model.zodiac = zodiac
+ // 保存当前语言的星座文本
+ model.zodiac = zodiacText
+ // 立即保存到本地存储,确保选择后立即生效
+ AppState.UserId?.let { uid ->
+ com.aiosman.ravenow.AppStore.setUserZodiac(uid, zodiacText)
+ }
navController.navigateUp()
}
)
@@ -88,6 +127,7 @@ fun ZodiacSelectScreen() {
@Composable
fun ZodiacItem(
zodiac: String,
+ zodiacResId: Int,
isSelected: Boolean,
onClick: () -> Unit
) {
diff --git a/app/src/main/java/com/aiosman/ravenow/ui/account/edit2.kt b/app/src/main/java/com/aiosman/ravenow/ui/account/edit2.kt
index c6d2179..4ba76f4 100644
--- a/app/src/main/java/com/aiosman/ravenow/ui/account/edit2.kt
+++ b/app/src/main/java/com/aiosman/ravenow/ui/account/edit2.kt
@@ -105,9 +105,9 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
val cleanValue = value.replace("\n", "").replace("\r", "")
model.name = cleanValue
usernameError = when {
- cleanValue.trim().isEmpty() -> "昵称不能为空"
- cleanValue.length < 3 -> "昵称长度不能小于3"
- cleanValue.length > 20 -> "昵称长度不能大于20"
+ cleanValue.trim().isEmpty() -> context.getString(R.string.error_nickname_empty)
+ cleanValue.length < 3 -> context.getString(R.string.error_nickname_too_short)
+ cleanValue.length > 20 -> context.getString(R.string.error_nickname_too_long)
else -> null
}
}
@@ -119,7 +119,7 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
val cleanValue = value.replace("\n", "").replace("\r", "")
model.bio = cleanValue
bioError = when {
- cleanValue.length > 100 -> "个人简介长度不能大于100"
+ cleanValue.length > 100 -> context.getString(R.string.error_bio_too_long)
else -> null
}
}
@@ -244,7 +244,7 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
tint = Color.White
)
Text(
- text = "更换封面",
+ text = stringResource(R.string.change_cover),
fontSize = 12.sp,
color = Color.White
)
@@ -288,7 +288,7 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
// 标题
Text(
- text = "编辑资料",
+ text = stringResource(R.string.edit_profile_info),
fontSize = 17.sp,
fontWeight = FontWeight.SemiBold,
color = Color.White,
@@ -365,7 +365,7 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
) {
// 昵称输入框
ProfileInfoCard(
- label = "昵称",
+ label = stringResource(R.string.nickname),
value = model.name,
placeholder = "Value",
onValueChange = { onNicknameChange(it) },
@@ -376,7 +376,7 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
// 个人简介输入框
ProfileInfoCard(
- label = "个人简介",
+ label = stringResource(R.string.personal_intro),
value = model.bio,
placeholder = "Welcome to my fantiac word i will show you something about magic",
onValueChange = { onBioChange(it) },
@@ -394,7 +394,7 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
) {
// MBTI 类型
ProfileSelectItem(
- label = "MBTI 类型",
+ label = stringResource(R.string.mbti_type),
value = model.mbti ?: "ENFP",
iconColor = Color(0xFF7C45ED),
iconResDark = null, // TODO: 添加MBTI暗色模式图标
@@ -417,8 +417,13 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
// 星座(使用当前图标)
ProfileSelectItem(
- label = "星座",
- value = model.zodiac ?: "白羊座",
+ label = stringResource(R.string.zodiac),
+ value = model.zodiac?.let { storedZodiac ->
+ // 尝试找到对应的资源ID并显示当前语言的文本
+ findZodiacResId(storedZodiac)?.let { resId ->
+ stringResource(resId)
+ } ?: storedZodiac // 如果找不到,显示原始存储的值
+ } ?: stringResource(R.string.zodiac_aries),
iconColor = Color(0xFFFFCC00),
iconResDark = R.mipmap.frame_4, // 星座暗色模式图标
iconResLight = R.mipmap.xingzuo, // 星座亮色模式图标
@@ -467,7 +472,7 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
contentAlignment = Alignment.Center
) {
Text(
- text = "保存",
+ text = stringResource(R.string.save),
fontSize = 17.sp,
fontWeight = FontWeight.Normal,
color = Color.White
@@ -483,7 +488,7 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
contentAlignment = Alignment.Center
) {
Text(
- text = "加载用户资料失败,请重试",
+ text = stringResource(R.string.error_load_profile_failed),
color = appColors.text
)
}
diff --git a/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/GalleryItem.kt b/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/GalleryItem.kt
index 272b882..c0b0df5 100644
--- a/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/GalleryItem.kt
+++ b/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/GalleryItem.kt
@@ -199,7 +199,7 @@ fun GalleryGrid(
Spacer(modifier = Modifier.height(if(AppState.darkMode) 9.dp else 24.dp))
Text(
- text = "你的故事还没开始",
+ text = stringResource(R.string.your_story_not_started),
fontSize = 16.sp,
color = AppColors.text,
fontWeight = FontWeight.W600
@@ -208,7 +208,7 @@ fun GalleryGrid(
Spacer(modifier = Modifier.height(8.dp))
Text(
- text = "发布一条动态,和世界打个招呼吧",
+ text = stringResource(R.string.publish_moment_greeting),
fontSize = 14.sp,
color = AppColors.secondaryText,
fontWeight = FontWeight.W400
diff --git a/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/GroupChatEmptyContent.kt b/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/GroupChatEmptyContent.kt
index 2c5fa48..b20e214 100644
--- a/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/GroupChatEmptyContent.kt
+++ b/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/GroupChatEmptyContent.kt
@@ -27,6 +27,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
@@ -71,7 +72,7 @@ fun GroupChatEmptyContent() {
// 空状态文本
Text(
- text = "空空如也~",
+ text = stringResource(R.string.empty_nothing),
fontSize = 16.sp,
fontWeight = FontWeight.SemiBold,
color = Color(0xFF000000)
@@ -94,7 +95,7 @@ private fun SegmentedControl(
) {
// 全部
SegmentButton(
- text = "全部",
+ text = stringResource(R.string.chat_all),
isSelected = selectedIndex == 0,
onClick = { onSegmentSelected(0) },
width = 54.dp
@@ -104,7 +105,7 @@ private fun SegmentedControl(
// 公开
SegmentButton(
- text = "公开",
+ text = stringResource(R.string.public_label),
isSelected = selectedIndex == 1,
onClick = { onSegmentSelected(1) },
width = 59.dp
@@ -114,7 +115,7 @@ private fun SegmentedControl(
// 私有
SegmentButton(
- text = "私有",
+ text = stringResource(R.string.private_label),
isSelected = selectedIndex == 2,
onClick = { onSegmentSelected(2) },
width = 54.dp
diff --git a/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/UserAgentsList.kt b/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/UserAgentsList.kt
index d91db42..676c5a4 100644
--- a/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/UserAgentsList.kt
+++ b/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/UserAgentsList.kt
@@ -247,7 +247,7 @@ fun AgentEmptyContentWithSegments() {
Spacer(modifier = Modifier.height(if(AppState.darkMode) 9.dp else 24.dp))
Text(
- text = "专属AI等你召唤",
+ text = stringResource(R.string.exclusive_ai_waiting),
fontSize = 16.sp,
color = AppColors.text,
fontWeight = FontWeight.W600
@@ -256,7 +256,7 @@ fun AgentEmptyContentWithSegments() {
Spacer(modifier = Modifier.height(8.dp))
Text(
- text = "AI将成为你的伙伴,而不是工具",
+ text = stringResource(R.string.ai_companion_not_tool),
fontSize = 14.sp,
color = AppColors.secondaryText,
fontWeight = FontWeight.W400
@@ -311,7 +311,7 @@ private fun AgentSegmentedControl(
) {
// 全部
AgentSegmentButton(
- text = "全部",
+ text = stringResource(R.string.chat_all),
isSelected = selectedIndex == 0,
onClick = { onSegmentSelected(0) },
width = 54.dp
@@ -321,7 +321,7 @@ private fun AgentSegmentedControl(
// 公开
AgentSegmentButton(
- text = "公开",
+ text = stringResource(R.string.public_label),
isSelected = selectedIndex == 1,
onClick = { onSegmentSelected(1) },
width = 59.dp
@@ -331,7 +331,7 @@ private fun AgentSegmentedControl(
// 私有
AgentSegmentButton(
- text = "私有",
+ text = stringResource(R.string.private_label),
isSelected = selectedIndex == 2,
onClick = { onSegmentSelected(2) },
width = 54.dp
diff --git a/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/UserContentPageIndicator.kt b/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/UserContentPageIndicator.kt
index 8e448a5..17aeca5 100644
--- a/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/UserContentPageIndicator.kt
+++ b/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/UserContentPageIndicator.kt
@@ -10,21 +10,14 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.pager.PagerState
-import androidx.compose.foundation.rememberScrollState
-import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.foundation.verticalScroll
-import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
-import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
@@ -52,7 +45,7 @@ fun UserContentPageIndicator(
.padding(horizontal = 16.dp),
horizontalArrangement = Arrangement.SpaceEvenly
) {
- // 图片/相册 Tab
+ // 动态 Tab
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier
@@ -64,15 +57,24 @@ fun UserContentPageIndicator(
}
.padding(vertical = 12.dp)
) {
- Icon(
- painter = painterResource(id = R.drawable.rider_pro_images),
- contentDescription = "Gallery",
- tint = if (pagerState.currentPage == 0) AppColors.text else AppColors.text.copy(alpha = 0.6f),
- modifier = Modifier.size(24.dp)
+ Text(
+ text = stringResource(R.string.index_dynamic),
+ fontSize = 16.sp,
+ fontWeight = if (pagerState.currentPage == 0) FontWeight.SemiBold else FontWeight.Medium,
+ color = if (pagerState.currentPage == 0) Color(0xFF000000) else Color(0x993C3C43)
)
+ Spacer(modifier = Modifier.height(if (pagerState.currentPage == 0) 6.dp else 4.dp))
+ if (pagerState.currentPage == 0) {
+ Box(
+ modifier = Modifier
+ .width(20.dp)
+ .height(2.dp)
+ .background(Color(0xFF000000))
+ )
+ }
}
- // Agent Tab (只在非智能体用户时显示)
+ // 智能体 Tab (只在非智能体用户时显示)
if (showAgentTab) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
@@ -85,40 +87,54 @@ fun UserContentPageIndicator(
}
.padding(vertical = 12.dp)
) {
- Icon(
- painter = painterResource(id = R.drawable.rider_pro_nav_ai),
- contentDescription = "Agents",
- tint = if (pagerState.currentPage == 1) AppColors.text else AppColors.text.copy(alpha = 0.6f),
- modifier = Modifier.size(24.dp)
+ Text(
+ text = stringResource(R.string.chat_ai),
+ fontSize = 16.sp,
+ fontWeight = if (pagerState.currentPage == 1) FontWeight.SemiBold else FontWeight.Medium,
+ color = if (pagerState.currentPage == 1) Color(0xFF000000) else Color(0x993C3C43)
)
+ Spacer(modifier = Modifier.height(if (pagerState.currentPage == 1) 6.dp else 4.dp))
+ if (pagerState.currentPage == 1) {
+ Box(
+ modifier = Modifier
+ .width(20.dp)
+ .height(2.dp)
+ .background(Color(0xFF000000))
+ )
+ }
+ }
+ }
+
+ // 群聊 Tab (只在非智能体用户时显示)
+ if (showAgentTab) {
+ Column(
+ horizontalAlignment = Alignment.CenterHorizontally,
+ modifier = Modifier
+ .weight(1f)
+ .noRippleClickable {
+ scope.launch {
+ pagerState.scrollToPage(2)
+ }
+ }
+ .padding(vertical = 12.dp)
+ ) {
+ Text(
+ text = stringResource(R.string.chat_group),
+ fontSize = 16.sp,
+ fontWeight = if (pagerState.currentPage == 2) FontWeight.SemiBold else FontWeight.Medium,
+ color = if (pagerState.currentPage == 2) Color(0xFF000000) else Color(0x993C3C43)
+ )
+ Spacer(modifier = Modifier.height(if (pagerState.currentPage == 2) 6.dp else 4.dp))
+ if (pagerState.currentPage == 2) {
+ Box(
+ modifier = Modifier
+ .width(20.dp)
+ .height(2.dp)
+ .background(Color(0xFF000000))
+ )
+ }
}
}
}
-
- // 下划线指示器
- Row(
- modifier = Modifier
- .fillMaxWidth()
- .padding(horizontal = 16.dp)
- ) {
- Box(
- modifier = Modifier
- .weight(1f)
- .height(2.dp)
- .background(
- if (pagerState.currentPage == 0) AppColors.text else Color.Transparent
- )
- )
- if (showAgentTab) {
- Box(
- modifier = Modifier
- .weight(1f)
- .height(2.dp)
- .background(
- if (pagerState.currentPage == 1) AppColors.text else Color.Transparent
- )
- )
- }
- }
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/UserItem.kt b/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/UserItem.kt
index 75a3583..7fb341a 100644
--- a/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/UserItem.kt
+++ b/app/src/main/java/com/aiosman/ravenow/ui/index/tabs/profile/composable/UserItem.kt
@@ -27,6 +27,7 @@ import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
@@ -122,7 +123,7 @@ fun UserItem(
)
Spacer(modifier = Modifier.height(2.dp))
Text(
- text = "帖子",
+ text = stringResource(R.string.posts),
fontWeight = FontWeight.Normal,
fontSize = 11.sp,
color = Color(0xFF000000),
@@ -157,7 +158,7 @@ fun UserItem(
)
Spacer(modifier = Modifier.height(2.dp))
Text(
- text = "粉丝",
+ text = stringResource(R.string.followers_upper),
fontWeight = FontWeight.Normal,
fontSize = 11.sp,
color = Color(0xFF000000),
@@ -193,7 +194,7 @@ fun UserItem(
)
Spacer(modifier = Modifier.height(2.dp))
Text(
- text = "关注",
+ text = stringResource(R.string.following_upper),
fontWeight = FontWeight.Normal,
fontSize = 11.sp,
color = Color(0xFF000000),
@@ -273,7 +274,7 @@ fun UserItem(
// 编辑标签(仅自己可见)
if (isSelf) {
ProfileTag(
- text = "编辑",
+ text = stringResource(R.string.edit_profile),
backgroundColor = Color(0x14947A80), // 124/255, 116/255, 128/255, alpha 0.08
textColor = Color(0xFF9284BD), // 146/255, 132/255, 189/255
leadingIcon = {
@@ -333,7 +334,7 @@ private fun EditIcon(
) {
Image(
painter = painterResource(id = R.mipmap.bi),
- contentDescription = "编辑",
+ contentDescription = stringResource(R.string.edit_profile),
modifier = modifier,
colorFilter = ColorFilter.tint(color)
)
diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml
index 098863d..1d097a0 100644
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -12,6 +12,7 @@
ユーザー
いいね
フォロワー
+ 投稿
お気に入り
あれ、何もない。..
通知
@@ -52,6 +53,10 @@
最高のサービスを提供するために、登録前に利用規約を読み、同意してください。
まだ投稿がありません
今すぐモーメントを投稿
+ ストーリーはまだ始まっていません
+ あなたのストーリーはまだ始まっていません
+ モーメントを投稿して、世界に挨拶しましょう
+ 画像がありません
プロフィールを編集
シェア
ログアウト
@@ -151,10 +156,14 @@
グループ
友達
すべて
+ 公開
+ プライベート
人はおしゃべりをしている…
AIエージェントチャット
AIエージェントチャットがありません
AIエージェントと対話してみましょう
+ 専属AIがあなたを待っています
+ AIはあなたのパートナーとなり、ツールではありません
私:
[画像]
[音声]
@@ -166,6 +175,7 @@
ユーザー情報の取得に失敗しました: %s
グループチャットがありません
まだどのグループチャットにも参加していません
+ 何もありません~
グループチャットメッセージのない宇宙は静かすぎます
ホームで興味のあるテーマルームを探してみましょう
まだ友達とチャットしていません~
@@ -255,9 +265,28 @@
MBTIタイプ
星座
+ カバーを変更
+ 自己紹介
+ ニックネームは空にできません
+ ニックネームの長さは3文字以上である必要があります
+ ニックネームの長さは20文字以下である必要があります
+ 自己紹介の長さは100文字以下である必要があります
+ ユーザープロフィールの読み込みに失敗しました。もう一度お試しください
保存
MBTIを選択
星座を選択
+ 牡羊座
+ 牡牛座
+ 双子座
+ 蟹座
+ 獅子座
+ 乙女座
+ 天秤座
+ 蠍座
+ 射手座
+ 山羊座
+ 水瓶座
+ 魚座
さっと動かす
diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml
index 8a8875e..d9faf7e 100644
--- a/app/src/main/res/values-zh/strings.xml
+++ b/app/src/main/res/values-zh/strings.xml
@@ -12,6 +12,7 @@
用户
赞
粉丝
+ 帖子
收藏
消息
关注
@@ -51,6 +52,10 @@
"为了提供更好的服务,请您在注册前仔细阅读并同意《用户协议》。 "
还没有发布任何动态
发布一个动态吧
+ 故事还没开始
+ 你的故事还没开始
+ 发布一条动态,和世界打个招呼吧
+ 暂无图片
编辑
分享
登出
@@ -153,11 +158,15 @@
群聊
朋友
全部
+ 公开
+ 私有
咦,什么都没有...
智能体聊天
AI 在等你的开场白
去首页探索一下,主动发起对话!
+ 专属AI等你召唤
+ AI将成为你的伙伴,而不是工具
我:
[图片]
[语音]
@@ -169,6 +178,7 @@
获取用户信息失败: %s
没有群聊,宇宙好安静
没有群聊消息的宇宙太安静了
+ 空空如也~
在首页探索感兴趣的主题房间
去首页探索感兴趣的高能对话
和朋友,还没有对话哦~
@@ -292,9 +302,28 @@
MBTI 类型
星座
+ 更换封面
+ 个人简介
+ 昵称不能为空
+ 昵称长度不能小于3
+ 昵称长度不能大于20
+ 个人简介长度不能大于100
+ 加载用户资料失败,请重试
保存
选择 MBTI
选择星座
+ 白羊座
+ 金牛座
+ 双子座
+ 巨蟹座
+ 狮子座
+ 处女座
+ 天秤座
+ 天蝎座
+ 射手座
+ 摩羯座
+ 水瓶座
+ 双鱼座
扫一扫
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d476d2a..b43786b 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -11,6 +11,7 @@
Users
LIKE
FOLLOWERS
+ Posts
FAVOURITES
Well,nothing
NOTIFICATIONS
@@ -51,6 +52,10 @@
To provide you with the best service, please read and agree to our User Agreement before registering.
You haven\'t left any tracks yet
Post a moment now
+ Your story hasn\'t started yet
+ Your story hasn\'t started yet
+ Post a moment and say hello to the world
+ No image
Edit profile
share
Logout
@@ -151,9 +156,13 @@
Friends
people chatting now…
All
+ Public
+ Private
Agent Chat
No Agent Chat
Start chatting with agents
+ Exclusive AI waiting for you
+ AI will be your companion, not a tool
Me:
[Image]
[Voice]
@@ -165,6 +174,7 @@
Failed to get user info: %s
No group chats
You have not joined any group chats yet
+ Nothing here~
The universe is too quiet without group chat messages
Explore interesting theme rooms on the homepage
Have not chatted with friends yet~
@@ -286,9 +296,28 @@
MBTI
Zodiac
+ Change Cover
+ Personal Introduction
+ Nickname cannot be empty
+ Nickname length cannot be less than 3
+ Nickname length cannot be greater than 20
+ Bio length cannot be greater than 100
+ Failed to load user profile, please try again
Save
Choose MBTI
Choose Zodiac
+ Aries
+ Taurus
+ Gemini
+ Cancer
+ Leo
+ Virgo
+ Libra
+ Scorpio
+ Sagittarius
+ Capricorn
+ Aquarius
+ Pisces
Scan QR
From 234587afc92476f246145902486c5d2015ad84ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=AB=98=E5=B8=86?= <3031465419@qq.com>
Date: Mon, 10 Nov 2025 20:30:31 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E7=BC=81=D1=85=E7=94=BB=E7=80=B9=E5=B1=BD?=
=?UTF-8?q?=E6=9D=BD=E9=8D=94=E7=86=BB=E5=85=98=E9=8F=87=E5=AD=98=E6=9F=8A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ui/account/AccountEditViewModel.kt | 33 ++++-
.../com/aiosman/ravenow/ui/account/edit2.kt | 122 +++++++++++-------
.../ravenow/ui/composables/AnimatedCounter.kt | 10 +-
.../aiosman/ravenow/ui/composables/Moment.kt | 1 -
.../ravenow/ui/follower/FollowerList.kt | 18 ++-
.../ravenow/ui/follower/FollowerNotice.kt | 18 ++-
.../ravenow/ui/follower/FollowingList.kt | 18 ++-
.../ui/group/GroupChatInfoViewModel.kt | 3 -
.../com/aiosman/ravenow/ui/index/Index.kt | 54 ++++++--
.../aiosman/ravenow/ui/index/tabs/ai/Agent.kt | 10 +-
.../tabs/message/tab/AgentChatListScreen.kt | 25 +++-
.../tabs/message/tab/AllChatListScreen.kt | 24 +++-
.../tabs/message/tab/FriendChatListScreen.kt | 24 +++-
.../tabs/message/tab/GroupChatListScreen.kt | 25 +++-
.../ravenow/ui/index/tabs/moment/Moment.kt | 31 +++--
.../ui/index/tabs/moment/tabs/hot/Moment.kt | 41 ++++--
.../ui/index/tabs/profile/ProfileV3.kt | 97 ++++++++------
.../tabs/profile/composable/GalleryItem.kt | 14 +-
.../composable/GroupChatEmptyContent.kt | 39 +++---
.../tabs/profile/composable/UserAgentsList.kt | 42 +++---
.../composable/UserContentPageIndicator.kt | 12 +-
.../index/tabs/profile/composable/UserItem.kt | 26 ++--
.../aiosman/ravenow/ui/login/emailsignup.kt | 2 +-
.../com/aiosman/ravenow/ui/post/NewPost.kt | 8 +-
app/src/main/res/values-ja/strings.xml | 6 +-
app/src/main/res/values-zh/strings.xml | 4 +
app/src/main/res/values/strings.xml | 6 +-
27 files changed, 497 insertions(+), 216 deletions(-)
diff --git a/app/src/main/java/com/aiosman/ravenow/ui/account/AccountEditViewModel.kt b/app/src/main/java/com/aiosman/ravenow/ui/account/AccountEditViewModel.kt
index 6a552d8..18431f7 100644
--- a/app/src/main/java/com/aiosman/ravenow/ui/account/AccountEditViewModel.kt
+++ b/app/src/main/java/com/aiosman/ravenow/ui/account/AccountEditViewModel.kt
@@ -21,6 +21,8 @@ object AccountEditViewModel : ViewModel() {
var name by mutableStateOf("")
var bio by mutableStateOf("")
var imageUrl by mutableStateOf(null)
+ var bannerImageUrl by mutableStateOf(null)
+ var bannerFile by mutableStateOf(null)
val accountService: AccountService = AccountServiceImpl()
var profile by mutableStateOf(null)
var croppedBitmap by mutableStateOf(null)
@@ -82,6 +84,30 @@ object AccountEditViewModel : ViewModel() {
it.compress(Bitmap.CompressFormat.JPEG, 100, file.outputStream())
UploadImage(file, "avatar.jpg", "", "jpg")
}
+
+ // 处理背景图更新
+ val newBanner = bannerImageUrl?.let { uri ->
+ bannerFile?.let { file ->
+ val cursor = context.contentResolver.query(uri, null, null, null, null)
+ var uploadBanner: UploadImage? = null
+ cursor?.use { cur ->
+ val columnIndex = cur.getColumnIndex("_display_name")
+ if (cur.moveToFirst() && columnIndex != -1) {
+ val displayName = cur.getString(columnIndex)
+ val extension = displayName.substringAfterLast(".")
+ Log.d("AccountEditViewModel", "Banner file name: $displayName, extension: $extension")
+ uploadBanner = UploadImage(file, displayName, uri.toString(), extension)
+ } else {
+ // 如果无法获取文件名,使用默认值
+ val displayName = "banner.jpg"
+ val extension = "jpg"
+ uploadBanner = UploadImage(file, displayName, uri.toString(), extension)
+ }
+ }
+ uploadBanner
+ }
+ }
+
// 去除换行符,确保昵称和个人简介不包含换行
val cleanName = name.trim().replace("\n", "").replace("\r", "")
val cleanBio = bio.trim().replace("\n", "").replace("\r", "")
@@ -89,7 +115,7 @@ object AccountEditViewModel : ViewModel() {
val newName = if (cleanName == profile?.nickName) null else cleanName
accountService.updateProfile(
avatar = newAvatar,
- banner = null,
+ banner = newBanner,
nickName = newName,
bio = cleanBio
)
@@ -100,6 +126,9 @@ object AccountEditViewModel : ViewModel() {
com.aiosman.ravenow.AppStore.setUserZodiac(uid, zodiac)
}
} catch (_: Exception) { }
+ // 清除背景图状态
+ bannerImageUrl = null
+ bannerFile = null
// 刷新用户资料
reloadProfile()
// 刷新个人资料页面的用户资料
@@ -116,6 +145,8 @@ object AccountEditViewModel : ViewModel() {
name = ""
bio = ""
imageUrl = null
+ bannerImageUrl = null
+ bannerFile = null
croppedBitmap = null
isUpdating = false
isLoading = false
diff --git a/app/src/main/java/com/aiosman/ravenow/ui/account/edit2.kt b/app/src/main/java/com/aiosman/ravenow/ui/account/edit2.kt
index 4ba76f4..69fc020 100644
--- a/app/src/main/java/com/aiosman/ravenow/ui/account/edit2.kt
+++ b/app/src/main/java/com/aiosman/ravenow/ui/account/edit2.kt
@@ -72,6 +72,7 @@ import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.SolidColor
import com.aiosman.ravenow.ConstVars
import com.aiosman.ravenow.ui.composables.pickupAndCompressLauncher
+import android.widget.Toast
import java.io.File
/**
@@ -97,6 +98,10 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
quality = 100
) { uri, file ->
// 处理选中的图片
+ // 保存到 ViewModel 中,等待保存时一起上传
+ model.bannerImageUrl = uri
+ model.bannerFile = file
+ // 如果提供了回调,也调用它(用于个人主页直接更新)
onUpdateBanner?.invoke(uri, file, context)
}
@@ -104,6 +109,7 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
// 去除换行符,确保昵称不包含换行
val cleanValue = value.replace("\n", "").replace("\r", "")
model.name = cleanValue
+ // 实时验证,但不显示错误(只在保存时显示)
usernameError = when {
cleanValue.trim().isEmpty() -> context.getString(R.string.error_nickname_empty)
cleanValue.length < 3 -> context.getString(R.string.error_nickname_too_short)
@@ -111,6 +117,16 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
else -> null
}
}
+
+ fun validateNickname(): String? {
+ val cleanValue = model.name.replace("\n", "").replace("\r", "")
+ return when {
+ cleanValue.trim().isEmpty() -> context.getString(R.string.error_nickname_empty)
+ cleanValue.length < 3 -> context.getString(R.string.error_nickname_too_short)
+ cleanValue.length > 20 -> context.getString(R.string.error_nickname_too_long)
+ else -> null
+ }
+ }
val appColors = LocalAppTheme.current
@@ -118,11 +134,20 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
// 去除换行符,确保个人简介不包含换行
val cleanValue = value.replace("\n", "").replace("\r", "")
model.bio = cleanValue
+ // 实时验证,但不显示错误(只在保存时显示)
bioError = when {
cleanValue.length > 100 -> context.getString(R.string.error_bio_too_long)
else -> null
}
}
+
+ fun validateBio(): String? {
+ val cleanValue = model.bio.replace("\n", "").replace("\r", "")
+ return when {
+ cleanValue.length > 100 -> context.getString(R.string.error_bio_too_long)
+ else -> null
+ }
+ }
fun validate(): Boolean {
return usernameError == null && bioError == null
@@ -146,21 +171,21 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
model.reloadProfile()
}
- // 设置状态栏为透明,使用浅色图标(因为顶部背景是深色图片)
+ // 设置状态栏为透明,根据暗色模式决定图标颜色
val systemUiController = rememberSystemUiController()
LaunchedEffect(Unit) {
- systemUiController.setStatusBarColor(Color.Transparent, darkIcons = false)
+ systemUiController.setStatusBarColor(Color.Transparent, darkIcons = !AppState.darkMode)
}
StatusBarMaskLayout(
- modifier = Modifier.background(Color(0xFFFAF9FB)),
- darkIcons = false, // 浅色图标(白色),因为顶部背景是深色
+ modifier = Modifier.background(appColors.background),
+ darkIcons = !AppState.darkMode, // 根据暗色模式决定图标颜色
maskBoxBackgroundColor = Color.Transparent
) {
Box(
modifier = Modifier
.fillMaxSize()
- .background(Color(0xFFFAF9FB))
+ .background(appColors.background)
) {
when {
model.isLoading -> {
@@ -179,7 +204,8 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
modifier = Modifier.fillMaxSize()
) {
// 顶部背景区域(圆角在底部,覆盖状态栏)
- val banner = model.profile?.banner
+ // 优先显示新选择的背景图,如果没有则显示原有的背景图
+ val banner = model.bannerImageUrl?.toString() ?: model.profile?.banner
val statusBarPadding = WindowInsets.systemBars.asPaddingValues().calculateTopPadding()
Box(
modifier = Modifier
@@ -230,15 +256,7 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
) {
// 更换封面图标
Icon(
- painter = painterResource(
- id = if (AppState.darkMode) {
- // TODO: 添加更换封面暗色模式图标
- R.mipmap.frame_4 // 临时占位,需替换为实际图标
- } else {
- // TODO: 添加更换封面亮色模式图标
- R.mipmap.fengm // 临时占位,需替换为实际图标
- }
- ),
+ painter = painterResource(id = R.mipmap.fengm),
contentDescription = null,
modifier = Modifier.size(16.dp),
tint = Color.White
@@ -318,7 +336,7 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
modifier = Modifier
.size(96.dp)
.clip(CircleShape)
- .border(2.4.dp, Color(0xFFFAF9FB), CircleShape),
+ .border(2.4.dp, appColors.background, CircleShape),
contentDescription = "",
contentScale = ContentScale.Crop
)
@@ -338,15 +356,7 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
contentAlignment = Alignment.Center
) {
Icon(
- painter = painterResource(
- id = if (AppState.darkMode) {
- // TODO: 添加编辑头像暗色模式图标
- R.mipmap.frame_4 // 临时占位,需替换为实际图标
- } else {
- // TODO: 添加编辑头像亮色模式图标
- R.mipmap.bi // 临时占位,需替换为实际图标
- }
- ),
+ painter = painterResource(id = R.mipmap.bi),
contentDescription = "Edit Avatar",
modifier = Modifier.size(16.dp),
tint = Color.White
@@ -390,7 +400,7 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
modifier = Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(16.dp))
- .background(Color.White)
+ .background(appColors.secondaryBackground)
) {
// MBTI 类型
ProfileSelectItem(
@@ -411,7 +421,7 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
modifier = Modifier
.fillMaxWidth()
.height(0.3.dp)
- .background(Color(0x41413C43).copy(alpha = 0.2f))
+ .background(appColors.divider)
.padding(horizontal = 16.dp)
)
@@ -453,19 +463,36 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
)
)
.debouncedClickable(
- enabled = validate() && !model.isUpdating,
+ enabled = !model.isUpdating,
debounceTime = 1000L
) {
- if (validate() && !model.isUpdating) {
- model.viewModelScope.launch {
- model.isUpdating = true
- model.updateUserProfile(context)
- model.viewModelScope.launch(Dispatchers.Main) {
- debouncedNavigation {
- navController.navigateUp()
- }
- model.isUpdating = false
+ if (model.isUpdating) return@debouncedClickable
+
+ // 点击保存时重新验证
+ val nicknameErrorMsg = validateNickname()
+ val bioErrorMsg = validateBio()
+
+ // 如果有错误,显示对应的错误提示
+ when {
+ nicknameErrorMsg != null -> {
+ Toast.makeText(context, nicknameErrorMsg, Toast.LENGTH_SHORT).show()
+ return@debouncedClickable
+ }
+ bioErrorMsg != null -> {
+ Toast.makeText(context, bioErrorMsg, Toast.LENGTH_SHORT).show()
+ return@debouncedClickable
+ }
+ }
+
+ // 验证通过,执行保存
+ model.viewModelScope.launch {
+ model.isUpdating = true
+ model.updateUserProfile(context)
+ model.viewModelScope.launch(Dispatchers.Main) {
+ debouncedNavigation {
+ navController.navigateUp()
}
+ model.isUpdating = false
}
}
},
@@ -510,13 +537,12 @@ fun ProfileInfoCard(
isMultiline: Boolean = false
) {
val appColors = LocalAppTheme.current
-
Box(
modifier = Modifier
.fillMaxWidth()
.height(if (isMultiline) 66.dp else 56.dp) // 昵称框高度56dp,个人简介66dp
.clip(RoundedCornerShape(16.dp))
- .background(Color.White),
+ .background(appColors.secondaryBackground),
contentAlignment = if (isMultiline) Alignment.TopStart else Alignment.CenterStart
) {
Row(
@@ -531,7 +557,7 @@ fun ProfileInfoCard(
text = label,
fontSize = 17.sp,
fontWeight = FontWeight.Normal,
- color = Color.Black,
+ color = appColors.text,
modifier = Modifier.width(100.dp)
)
@@ -546,7 +572,7 @@ fun ProfileInfoCard(
text = placeholder,
fontSize = if (isMultiline) 15.sp else 17.sp,
fontWeight = FontWeight.Normal,
- color = Color(0x993C3C43),
+ color = appColors.secondaryText,
modifier = Modifier.fillMaxWidth()
)
}
@@ -558,9 +584,9 @@ fun ProfileInfoCard(
textStyle = androidx.compose.ui.text.TextStyle(
fontSize = if (isMultiline) 15.sp else 17.sp,
fontWeight = FontWeight.Normal,
- color = Color.Black
+ color = appColors.text
),
- cursorBrush = SolidColor(Color.Black),
+ cursorBrush = SolidColor(appColors.text),
maxLines = if (isMultiline) Int.MAX_VALUE else 1,
singleLine = !isMultiline
)
@@ -581,6 +607,7 @@ fun ProfileSelectItem(
iconResDark: Int? = null,
iconResLight: Int? = null
) {
+ val appColors = LocalAppTheme.current
Row(
modifier = Modifier
.fillMaxWidth()
@@ -598,7 +625,8 @@ fun ProfileSelectItem(
Icon(
painter = painterResource(
id = if (AppState.darkMode) {
- iconResDark ?: R.mipmap.frame_4 // 使用传入的暗色模式图标,或默认占位
+ // 暗色模式下使用和亮色模式一样的图标
+ iconResLight ?: iconResDark ?: R.mipmap.naoz
} else {
iconResLight ?: R.mipmap.naoz // 使用传入的亮色模式图标,或默认占位
}
@@ -612,7 +640,7 @@ fun ProfileSelectItem(
text = label,
fontSize = 17.sp,
fontWeight = FontWeight.Normal,
- color = Color.Black
+ color = appColors.text
)
}
@@ -624,14 +652,14 @@ fun ProfileSelectItem(
text = value,
fontSize = 17.sp,
fontWeight = FontWeight.Normal,
- color = Color(0x993C3C43)
+ color = appColors.secondaryText
)
Icon(
imageVector = Icons.Default.ArrowForward,
contentDescription = null,
modifier = Modifier.size(8.dp),
- tint = Color(0x4D3C3C43)
+ tint = appColors.secondaryText
)
}
}
diff --git a/app/src/main/java/com/aiosman/ravenow/ui/composables/AnimatedCounter.kt b/app/src/main/java/com/aiosman/ravenow/ui/composables/AnimatedCounter.kt
index 8f32742..9cdf71f 100644
--- a/app/src/main/java/com/aiosman/ravenow/ui/composables/AnimatedCounter.kt
+++ b/app/src/main/java/com/aiosman/ravenow/ui/composables/AnimatedCounter.kt
@@ -10,6 +10,7 @@ import androidx.compose.animation.togetherWith
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
+import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.sp
import com.aiosman.ravenow.LocalAppTheme
@@ -36,6 +37,13 @@ fun AnimatedCounter(count: Int, modifier: Modifier = Modifier, fontSize: Int = 2
)
}
) { targetCount ->
- Text(text = "$targetCount", modifier = modifier, fontSize = fontSize.sp, color = AppColors.text)
+ Text(
+ text = "$targetCount",
+ modifier = modifier,
+ fontSize = fontSize.sp,
+ color = AppColors.text,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis
+ )
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/aiosman/ravenow/ui/composables/Moment.kt b/app/src/main/java/com/aiosman/ravenow/ui/composables/Moment.kt
index e80046b..a62af99 100644
--- a/app/src/main/java/com/aiosman/ravenow/ui/composables/Moment.kt
+++ b/app/src/main/java/com/aiosman/ravenow/ui/composables/Moment.kt
@@ -426,7 +426,6 @@ fun MomentOperateBtn(count: String, content: @Composable () -> Unit) {
fontSize = 14,
modifier = Modifier
.padding(start = 7.dp)
- .width(24.dp)
)
}
}
diff --git a/app/src/main/java/com/aiosman/ravenow/ui/follower/FollowerList.kt b/app/src/main/java/com/aiosman/ravenow/ui/follower/FollowerList.kt
index b240c99..d6bd19f 100644
--- a/app/src/main/java/com/aiosman/ravenow/ui/follower/FollowerList.kt
+++ b/app/src/main/java/com/aiosman/ravenow/ui/follower/FollowerList.kt
@@ -24,6 +24,8 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.lifecycle.viewmodel.compose.viewModel
@@ -131,17 +133,25 @@ fun FollowerListScreen(userId: Int) {
)
Spacer(modifier = Modifier.size(9.dp)) // 调整间距为9dp
androidx.compose.material.Text(
- text = "还没有人关注你呢",
+ text = stringResource(R.string.follower_empty_title),
color = appColors.text,
fontSize = 16.sp,
- fontWeight = FontWeight.W600
+ fontWeight = FontWeight.W600,
+ textAlign = TextAlign.Center,
+ modifier = Modifier.padding(horizontal = 24.dp),
+ maxLines = 2,
+ overflow = TextOverflow.Ellipsis
)
Spacer(modifier = Modifier.size(8.dp))
androidx.compose.material.Text(
- text = "试着发信号出来,某人就会被吸引啦~",
+ text = stringResource(R.string.follower_empty_subtitle),
color = appColors.text,
fontSize = 14.sp,
- fontWeight = FontWeight.W400
+ fontWeight = FontWeight.W400,
+ textAlign = TextAlign.Center,
+ modifier = Modifier.padding(horizontal = 24.dp),
+ maxLines = 3,
+ overflow = TextOverflow.Ellipsis
)
}
}
diff --git a/app/src/main/java/com/aiosman/ravenow/ui/follower/FollowerNotice.kt b/app/src/main/java/com/aiosman/ravenow/ui/follower/FollowerNotice.kt
index bdfbf41..554433b 100644
--- a/app/src/main/java/com/aiosman/ravenow/ui/follower/FollowerNotice.kt
+++ b/app/src/main/java/com/aiosman/ravenow/ui/follower/FollowerNotice.kt
@@ -25,6 +25,8 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.paging.compose.collectAsLazyPagingItems
@@ -122,17 +124,25 @@ fun FollowerNoticeScreen() {
)
Spacer(modifier = Modifier.height(if (AppState.darkMode) 9.dp else 24.dp))
androidx.compose.material.Text(
- text = "还没有人关注你呢",
+ text = stringResource(R.string.follower_empty_title),
color = AppColors.text,
fontSize = 16.sp,
- fontWeight = FontWeight.W600
+ fontWeight = FontWeight.W600,
+ textAlign = TextAlign.Center,
+ modifier = Modifier.padding(horizontal = 24.dp),
+ maxLines = 2,
+ overflow = TextOverflow.Ellipsis
)
Spacer(modifier = Modifier.size(8.dp))
androidx.compose.material.Text(
- text = "试着发信号出来,某人就会被吸引啦~",
+ text = stringResource(R.string.follower_empty_subtitle),
color = AppColors.text,
fontSize = 14.sp,
- fontWeight = FontWeight.W400
+ fontWeight = FontWeight.W400,
+ textAlign = TextAlign.Center,
+ modifier = Modifier.padding(horizontal = 24.dp),
+ maxLines = 3,
+ overflow = TextOverflow.Ellipsis
)
}
}
diff --git a/app/src/main/java/com/aiosman/ravenow/ui/follower/FollowingList.kt b/app/src/main/java/com/aiosman/ravenow/ui/follower/FollowingList.kt
index c097e13..79c6b9f 100644
--- a/app/src/main/java/com/aiosman/ravenow/ui/follower/FollowingList.kt
+++ b/app/src/main/java/com/aiosman/ravenow/ui/follower/FollowingList.kt
@@ -24,6 +24,8 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.lifecycle.viewmodel.compose.viewModel
@@ -133,17 +135,25 @@ fun FollowingListScreen(userId: Int) {
)
Spacer(modifier = Modifier.size(9.dp)) // 调整间距为9dp
androidx.compose.material.Text(
- text = "还没有关注任何灵魂",
+ text = stringResource(R.string.following_empty_title),
color = appColors.text,
fontSize = 16.sp,
- fontWeight = FontWeight.W600
+ fontWeight = FontWeight.W600,
+ textAlign = TextAlign.Center,
+ modifier = Modifier.padding(horizontal = 24.dp),
+ maxLines = 2,
+ overflow = TextOverflow.Ellipsis
)
Spacer(modifier = Modifier.size(8.dp))
androidx.compose.material.Text(
- text = "探索一下,总有一个你想靠近的光点 ✨",
+ text = stringResource(R.string.following_empty_subtitle),
color = appColors.secondaryText,
fontSize = 14.sp,
- fontWeight = FontWeight.W400
+ fontWeight = FontWeight.W400,
+ textAlign = TextAlign.Center,
+ modifier = Modifier.padding(horizontal = 24.dp),
+ maxLines = 3,
+ overflow = TextOverflow.Ellipsis
)
}
}
diff --git a/app/src/main/java/com/aiosman/ravenow/ui/group/GroupChatInfoViewModel.kt b/app/src/main/java/com/aiosman/ravenow/ui/group/GroupChatInfoViewModel.kt
index 4997a98..79210b5 100644
--- a/app/src/main/java/com/aiosman/ravenow/ui/group/GroupChatInfoViewModel.kt
+++ b/app/src/main/java/com/aiosman/ravenow/ui/group/GroupChatInfoViewModel.kt
@@ -13,9 +13,6 @@ import com.aiosman.ravenow.data.api.AgentRule
import com.aiosman.ravenow.data.api.AgentRuleQuota
import com.aiosman.ravenow.data.api.CreateAgentRuleRequestBody
import com.aiosman.ravenow.data.api.UpdateAgentRuleRequestBody
-import com.aiosman.ravenow.data.api.CreateAgentRuleRequestBody
-import com.aiosman.ravenow.data.api.AgentRule
-import com.aiosman.ravenow.data.api.AgentRuleQuota
import com.aiosman.ravenow.data.parseErrorResponse
import com.aiosman.ravenow.entity.ChatNotification
import com.aiosman.ravenow.entity.GroupInfo
diff --git a/app/src/main/java/com/aiosman/ravenow/ui/index/Index.kt b/app/src/main/java/com/aiosman/ravenow/ui/index/Index.kt
index 6f3b64a..ff7ce38 100644
--- a/app/src/main/java/com/aiosman/ravenow/ui/index/Index.kt
+++ b/app/src/main/java/com/aiosman/ravenow/ui/index/Index.kt
@@ -519,14 +519,31 @@ fun SideMenuContent(
var messageNotificationEnabled by remember { mutableStateOf(true) }
var darkModeEnabled by remember { mutableStateOf(AppState.darkMode) }
- // 菜单背景色 #FAF9FB
- val menuBackgroundColor = Color(0xFFFAF9FB)
+ // 同步暗色模式状态
+ LaunchedEffect(AppState.darkMode) {
+ darkModeEnabled = AppState.darkMode
+ }
+
+ // 菜单背景色 - 根据暗色模式适配
+ val menuBackgroundColor = if (darkModeEnabled) {
+ appColors.secondaryBackground // 暗色模式:深灰色
+ } else {
+ Color(0xFFFAF9FB) // 亮色模式:浅灰色
+ }
// 遮罩颜色 黑色透明度0.6
val overlayColor = Color.Black.copy(alpha = 0.6f)
- // 卡片背景色 白色
- val cardBackgroundColor = Color.White
- // 跟随系统文字颜色 #979499
- val followSystemTextColor = Color(0xFF979499)
+ // 卡片背景色 - 根据暗色模式适配
+ val cardBackgroundColor = if (darkModeEnabled) {
+ appColors.background // 暗色模式:深色背景
+ } else {
+ Color.White // 亮色模式:白色
+ }
+ // 文字颜色 - 根据暗色模式适配
+ val textColor = appColors.text
+ // 图标颜色 - 根据暗色模式适配
+ val iconColor = appColors.text
+ // 跟随系统文字颜色 - 根据暗色模式适配
+ val followSystemTextColor = appColors.secondaryText
// 开关开启颜色 #7C45ED
val switchActiveColor = Color(0xFF7C45ED)
@@ -579,14 +596,14 @@ fun SideMenuContent(
painter = painterResource(id = R.mipmap.sao),
contentDescription = null,
modifier = Modifier.size(24.dp),
- colorFilter = ColorFilter.tint(Color.Black)
+ colorFilter = ColorFilter.tint(iconColor)
)
}
// 绝对定位的"扫一扫"文字:上方71.5dp,右侧66dp
Text(
text = stringResource(R.string.scan_qr),
fontSize = 14.sp,
- color = Color.Black,
+ color = textColor,
modifier = Modifier
.align(Alignment.TopEnd)
.offset(x = (-66).dp, y = 91.5.dp)
@@ -602,7 +619,7 @@ fun SideMenuContent(
.noRippleClickable {
// TODO: 实现QR码功能
},
- colorFilter = ColorFilter.tint(Color.Black)
+ colorFilter = ColorFilter.tint(iconColor)
)
// 菜单选项卡片组 - 第一组卡片上方距离上方108pt(绝对定位)
@@ -616,6 +633,8 @@ fun SideMenuContent(
// 第一组卡片:编辑资料、账号安全、收藏
MenuCard(
backgroundColor = cardBackgroundColor,
+ textColor = textColor,
+ iconColor = iconColor,
width = 270.dp,
height = 164.dp,
items = listOf(
@@ -655,6 +674,8 @@ fun SideMenuContent(
// 第二组卡片:暗色模式、消息通知
MenuCard(
backgroundColor = cardBackgroundColor,
+ textColor = textColor,
+ iconColor = iconColor,
width = 270.dp,
height = 112.dp, // 根据设计图,第二组卡片高度为112dp
items = listOf(
@@ -709,6 +730,8 @@ fun SideMenuContent(
// 第三组卡片:关于派派、反馈、退出登录
MenuCard(
backgroundColor = cardBackgroundColor,
+ textColor = textColor,
+ iconColor = iconColor,
width = 270.dp,
height = 164.dp,
items = listOf(
@@ -776,6 +799,8 @@ data class MenuItem(
@Composable
fun MenuCard(
backgroundColor: Color,
+ textColor: Color,
+ iconColor: Color,
items: List