merge conflict

This commit is contained in:
2025-09-09 17:57:28 +08:00
28 changed files with 528 additions and 373 deletions

View File

@@ -13,7 +13,7 @@
android:allowBackup="false"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/rider_pro_logo_next"
android:icon="@mipmap/invalid_name"
android:label="@string/app_name"
android:roundIcon="@mipmap/rider_pro_logo_next_round"
android:supportsRtl="true"

View File

@@ -3,9 +3,9 @@ package com.aiosman.ravenow
object ConstVars {
// api 地址
// const val BASE_SERVER = "http://192.168.31.131:8088"
// const val BASE_SERVER = "http://192.168.142.141:8088"
const val BASE_SERVER = "http://192.168.0.201:8088"
// const val BASE_SERVER = "http://192.168.0.228:8088"
const val BASE_SERVER = "https://rider-pro.aiosman.com/beta_api"
// const val BASE_SERVER = "https://rider-pro.aiosman.com/beta_api"
const val MOMENT_LIKE_CHANNEL_ID = "moment_like"
const val MOMENT_LIKE_CHANNEL_NAME = "Moment Like"

View File

@@ -160,7 +160,7 @@ fun EditCommentBottomModal(
painter = painterResource(id = R.mipmap.rider_pro_moment_post),
contentDescription = "Send",
modifier = Modifier
.size(25.dp)
.size(20.dp)
.align(Alignment.Top)
.noRippleClickable {
if (text.isNotEmpty()) {
@@ -168,7 +168,7 @@ fun EditCommentBottomModal(
text = ""
}
},
tint = if (isNotEmpty) AppColors.main else AppColors.nonActive
tint = if (isNotEmpty) Color.Unspecified else AppColors.nonActive
)
}
}

View File

@@ -37,12 +37,12 @@ fun TabItem(
) {
Text(
text = text,
fontSize = 14.sp,
fontSize = 15.sp,
color = if (isSelected) AppColors.tabSelectedText else AppColors.tabUnselectedText,
modifier = Modifier
.clip(RoundedCornerShape(8.dp))
.clip(RoundedCornerShape(12.dp))
.background(if (isSelected) AppColors.tabSelectedBackground else AppColors.tabUnselectedBackground)
.padding(horizontal = 11.dp, vertical = 4.dp)
.padding(horizontal = 16.dp, vertical = 8.dp)
)
}
}

View File

@@ -18,7 +18,11 @@ import com.aiosman.ravenow.data.AccountService
import com.aiosman.ravenow.data.AccountServiceImpl
import com.aiosman.ravenow.data.UserService
import com.aiosman.ravenow.data.UserServiceImpl
import com.aiosman.ravenow.entity.CommentEntity
import com.aiosman.ravenow.exp.formatChatTime
import com.aiosman.ravenow.ui.NavigationRoute
import com.aiosman.ravenow.ui.navigateToChat
import com.aiosman.ravenow.utils.TrtcHelper
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch

View File

@@ -91,6 +91,7 @@ fun IndexScreen() {
val navController = LocalNavController.current
val item = listOf(
NavigationItem.Home,
//NavigationItem.Dynamic,
NavigationItem.Ai,
NavigationItem.Add,
NavigationItem.Notification,
@@ -378,8 +379,8 @@ fun IndexScreen() {
userScrollEnabled = false
) { page ->
when (page) {
0 -> Home()
1 -> Agent()
0 -> Agent()
1 -> Home()
2 -> Add()
3 -> Notifications()
4 -> Profile()

View File

@@ -22,10 +22,15 @@ sealed class NavigationItem(
)
data object Ai : NavigationItem("Ai",
icon = { R.drawable.rider_pro_nav_ai },
selectedIcon = { R.mipmap.rider_pro_nav_ai_hl },
label = { stringResource(R.string.main_ai) }
icon = { R.mipmap.bars_x_buttons_discover_bold},
selectedIcon = { R.mipmap.dynamic_hl },
label = { stringResource(R.string.index_dynamic) }
)
// data object Ai : NavigationItem("Ai",
// icon = { R.drawable.rider_pro_nav_ai },
// selectedIcon = { R.mipmap.rider_pro_nav_ai_hl },
// label = { stringResource(R.string.main_ai) }
// )
data object Add : NavigationItem("Add",
icon = { R.drawable.ic_nav_add },

View File

@@ -43,6 +43,7 @@ import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.graphicsLayer
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
import androidx.lifecycle.viewmodel.compose.viewModel
@@ -60,6 +61,7 @@ import com.aiosman.ravenow.ui.index.tabs.ai.tabs.hot.HotAgent
import com.aiosman.ravenow.ui.modifiers.noRippleClickable
import com.aiosman.ravenow.ui.composables.TabItem
import com.aiosman.ravenow.ui.composables.TabSpacer
import com.aiosman.ravenow.ui.index.tabs.moment.CustomTabItem
import com.aiosman.ravenow.ui.index.tabs.moment.tabs.expolre.AgentItem
import com.aiosman.ravenow.ui.index.tabs.moment.tabs.expolre.ExploreViewModel
import com.aiosman.ravenow.utils.DebounceUtils
@@ -101,7 +103,7 @@ fun Agent() {
modifier = Modifier
.fillMaxSize()
.padding(
top = statusBarPaddingValues.calculateTopPadding()+18.dp,
top = statusBarPaddingValues.calculateTopPadding(),
bottom = navigationBarPaddings,
start = 16.dp,
end = 16.dp
@@ -111,92 +113,178 @@ fun Agent() {
Row(
modifier = Modifier
.wrapContentHeight()
.height(44.dp)
.fillMaxWidth(),
horizontalArrangement = Arrangement.Start,
verticalAlignment = Alignment.CenterVertically
) {
// 搜索框
Row(
androidx.compose.material3.Text(
text = "Rave AI",
fontSize = 20.sp,
fontWeight = FontWeight.W900,
color = AppColors.text,
modifier = Modifier
.height(36.dp)
.weight(1f)
.clip(shape = RoundedCornerShape(8.dp))
.background(AppColors.inputBackground)
.padding(horizontal = 8.dp, vertical = 0.dp)
.noRippleClickable {
// 搜索框点击事件
},
verticalAlignment = Alignment.CenterVertically
) {
Icon(
painter = painterResource(id = R.drawable.rider_pro_nav_search),
contentDescription = null,
tint = AppColors.inputHint
)
Box {
Text(
text = stringResource(R.string.search),
modifier = Modifier.padding(start = 8.dp),
color = AppColors.inputHint,
fontSize = 17.sp
)
}
}
Spacer(modifier = Modifier.width(16.dp))
// 新增
Icon(
.align(Alignment.CenterVertically)
)
Spacer(modifier = Modifier.weight(1f))
Image(
painter = painterResource(id = R.drawable.rider_pro_nav_search),
contentDescription = "search",
modifier = Modifier
.size(36.dp)
.size(24.dp)
.noRippleClickable {
if (DebounceUtils.simpleDebounceClick(lastClickTime, 500L) {
// 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.CREATE_AGENT)) {
navController.navigate(NavigationRoute.Login.route)
} else {
// 导航到添加智能体页面
navController.navigate(
NavigationRoute.AddAgent.route
)
}
}) {
lastClickTime = System.currentTimeMillis()
}
navController.navigate(NavigationRoute.Search.route)
},
painter = painterResource(id = R.drawable.rider_pro_new_post_add_pic),
contentDescription = null,
tint = AppColors.text
colorFilter = ColorFilter.tint(AppColors.text)
)
}
// 推荐Agent
Spacer(modifier = Modifier.height(15.dp))
// // 搜索框
// Row(
// modifier = Modifier
// .height(36.dp)
// .weight(1f)
// .clip(shape = RoundedCornerShape(8.dp))
// .background(AppColors.inputBackground)
// .padding(horizontal = 8.dp, vertical = 0.dp)
// .noRippleClickable {
// // 搜索框点击事件
// },
// verticalAlignment = Alignment.CenterVertically
// ) {
// Icon(
// painter = painterResource(id = R.drawable.rider_pro_nav_search),
// contentDescription = null,
// tint = AppColors.inputHint
// )
// Box {
// Text(
// text = stringResource(R.string.search),
// modifier = Modifier.padding(start = 8.dp),
// color = AppColors.inputHint,
// fontSize = 17.sp
// )
// }
// }
// Spacer(modifier = Modifier.width(16.dp))
// // 创建智能体
// Icon(
// modifier = Modifier
// .size(36.dp)
// .noRippleClickable {
// if (DebounceUtils.simpleDebounceClick(lastClickTime, 500L) {
// // 检查游客模式,如果是游客则跳转登录
// if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.CREATE_AGENT)) {
// navController.navigate(NavigationRoute.Login.route)
// } else {
// // 导航到添加智能体页面
// navController.navigate(
// NavigationRoute.AddAgent.route
// )
// }
// }) {
// lastClickTime = System.currentTimeMillis()
// }
// },
// painter = painterResource(id = R.drawable.rider_pro_new_post_add_pic),
// contentDescription = null,
// tint = AppColors.text
// )
Column(
modifier = Modifier
.fillMaxWidth()
.height(260.dp)
.height(400.dp)
.padding(vertical = 8.dp)
) {
// 标题
// // 标题
// Row(
// verticalAlignment = Alignment.CenterVertically,
// modifier = Modifier.padding(bottom = 12.dp)
// ) {
// Image(
// painter = painterResource(R.mipmap.rider_pro_agent2),
// contentDescription = "agent",
// modifier = Modifier.size(28.dp),
//
// )
// Spacer(modifier = Modifier.width(4.dp))
// androidx.compose.material3.Text(
// text = stringResource(R.string.agent_recommend_agent),
// fontSize = 16.sp,
// fontWeight = androidx.compose.ui.text.font.FontWeight.W600,
// color = AppColors.text
// )
// }
// 标签页
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.padding(bottom = 12.dp)
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
.padding( bottom = 16.dp),
horizontalArrangement = Arrangement.Start,
verticalAlignment = Alignment.Bottom
) {
Image(
painter = painterResource(R.mipmap.rider_pro_agent2),
contentDescription = "agent",
modifier = Modifier.size(28.dp),
)
Spacer(modifier = Modifier.width(4.dp))
androidx.compose.material3.Text(
text = stringResource(R.string.agent_recommend_agent),
fontSize = 16.sp,
fontWeight = androidx.compose.ui.text.font.FontWeight.W600,
color = AppColors.text
// 推荐标签(默认选中)
CustomTabItem(
text = stringResource(R.string.agent_recommend),
isSelected = true,
onClick = {
// TODO: 实现点击切换逻辑
}
)
}
TabSpacer()
// Scenes标签
CustomTabItem(
text = "scenes",
isSelected = false,
onClick = {
// TODO: 实现点击切换逻辑
}
)
TabSpacer()
// Voices标签
CustomTabItem(
text = "voices",
isSelected = false,
onClick = {
// TODO: 实现点击切换逻辑
}
)
TabSpacer()
// Anime标签
CustomTabItem(
text = "anime",
isSelected = false,
onClick = {
// TODO: 实现点击切换逻辑
}
)
// TabSpacer()
//
// // Assist标签
// CustomTabItem(
// text = "assist",
// isSelected = false,
// onClick = {
// // TODO: 实现点击切换逻辑
// }
// )
}
// Agent ViewPager
AgentViewPagerSection(agentItems = viewModel.agentItems.take(9),viewModel)
AgentViewPagerSection(agentItems = viewModel.agentItems.take(15),viewModel)
}
Spacer(modifier = Modifier.height(0.dp))
@@ -312,8 +400,8 @@ fun Agent() {
fun AgentViewPagerSection(agentItems: List<AgentItem>,viewModel: AgentViewModel) {
val AppColors = LocalAppTheme.current
// 每页显示3个agent
val itemsPerPage = 3
// 每页显示5个agent
val itemsPerPage = 5
val totalPages = (agentItems.size + itemsPerPage - 1) / itemsPerPage
if (totalPages > 0) {
@@ -323,7 +411,7 @@ fun AgentViewPagerSection(agentItems: List<AgentItem>,viewModel: AgentViewModel)
// Agent内容
Box(
modifier = Modifier
.height(180.dp)
.height(300.dp)
) {
HorizontalPager(
state = pagerState,
@@ -344,7 +432,8 @@ fun AgentViewPagerSection(agentItems: List<AgentItem>,viewModel: AgentViewModel)
viewModel = viewModel,
agentItems = agentItems.drop(page * itemsPerPage).take(itemsPerPage),
page = page,
modifier = Modifier.height(180.dp)
modifier = Modifier
.height(300.dp)
.graphicsLayer {
scaleX = scale
scaleY = scale
@@ -368,7 +457,9 @@ fun AgentViewPagerSection(agentItems: List<AgentItem>,viewModel: AgentViewModel)
.padding(horizontal = 4.dp)
.size(3.dp)
.background(
color = if (pagerState.currentPage == index) AppColors.text else AppColors.secondaryText.copy(alpha = 0.3f),
color = if (pagerState.currentPage == index) AppColors.text else AppColors.secondaryText.copy(
alpha = 0.3f
),
shape = androidx.compose.foundation.shape.CircleShape
)
)
@@ -416,8 +507,8 @@ fun AgentCard2(viewModel: AgentViewModel,agentItem: AgentItem,navController: Nav
.background(Color(0xFFF5F5F5), RoundedCornerShape(24.dp))
.clickable {
if (DebounceUtils.simpleDebounceClick(lastClickTime, 500L) {
viewModel.goToProfile(agentItem.openId, navController)
}) {
viewModel.goToProfile(agentItem.openId, navController)
}) {
lastClickTime = System.currentTimeMillis()
}
},
@@ -482,14 +573,17 @@ fun AgentCard2(viewModel: AgentViewModel,agentItem: AgentItem,navController: Nav
)
.clickable {
if (DebounceUtils.simpleDebounceClick(lastClickTime, 500L) {
// 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.CHAT_WITH_AGENT)) {
navController.navigate(NavigationRoute.Login.route)
} else {
viewModel.createSingleChat(agentItem.openId)
viewModel.goToChatAi(agentItem.openId, navController = navController)
}
}) {
// 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.CHAT_WITH_AGENT)) {
navController.navigate(NavigationRoute.Login.route)
} else {
viewModel.createSingleChat(agentItem.openId)
viewModel.goToChatAi(
agentItem.openId,
navController = navController
)
}
}) {
lastClickTime = System.currentTimeMillis()
}
},

View File

@@ -140,143 +140,183 @@ fun NotificationsScreen() {
Column(
modifier = Modifier.fillMaxSize(),
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 15.dp),
verticalAlignment = Alignment.CenterVertically
) {
Box(
Row(
modifier = Modifier
.size(24.dp)
)
Column(
modifier = Modifier
.weight(1f)
.align(Alignment.CenterVertically),
horizontalAlignment = Alignment.CenterHorizontally
.fillMaxWidth()
.height(44.dp)
.padding(horizontal = 16.dp),
horizontalArrangement = Arrangement.Start,
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = stringResource(R.string.main_message),
fontSize = 17.sp,
fontWeight = FontWeight.W700,
fontSize = 20.sp,
fontWeight = FontWeight.W900,
color = AppColors.text
)
}
Image(
painter = painterResource(id = R.drawable.rider_pro_group),
contentDescription = "add",
modifier = Modifier
.size(24.dp)
.noRippleClickable {
debouncer {
navController.navigate(NavigationRoute.CreateGroupChat.route)
}
},
colorFilter = ColorFilter.tint(AppColors.text)
)
Spacer(modifier = Modifier.weight(1f))
}
// 搜索栏//
Box(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 8.dp)
.height(40.dp)
.noRippleClickable {
},
contentAlignment = Alignment.CenterStart
) {
Row(
modifier = Modifier
.height(36.dp)
.fillMaxWidth()
.clip(shape = RoundedCornerShape(8.dp))
.background(AppColors.inputBackground)
.padding(horizontal = 8.dp, vertical = 0.dp)
.noRippleClickable {
// 搜索框点击事件
},
verticalAlignment = Alignment.CenterVertically
) {
Icon(
Image(
painter = painterResource(id = R.drawable.rider_pro_nav_search),
contentDescription = null,
tint = AppColors.inputHint
contentDescription = "search",
modifier = Modifier
.size(24.dp)
.noRippleClickable {
// TODO: 实现搜索功能
},
colorFilter = ColorFilter.tint(AppColors.text)
)
Spacer(modifier = Modifier.width(16.dp))
Box {
androidx.compose.material.Text(
text = stringResource(R.string.search),
modifier = Modifier.padding(start = 8.dp),
color = AppColors.inputHint,
fontSize = 17.sp
Image(
painter = painterResource(id = R.drawable.rider_pro_notification),
contentDescription = "notifications",
modifier = Modifier
.size(24.dp)
.noRippleClickable {
// TODO: 实现通知功能
},
colorFilter = ColorFilter.tint(AppColors.text)
)
}
}
}
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp),
horizontalArrangement = Arrangement.SpaceBetween,
) {
val likeDebouncer = rememberDebouncer()
val followDebouncer = rememberDebouncer()
val commentDebouncer = rememberDebouncer()
// 通知红点
val totalNoticeCount = MessageListViewModel.likeNoticeCount +
MessageListViewModel.followNoticeCount +
MessageListViewModel.commentNoticeCount +
MessageListViewModel.favouriteNoticeCount
NotificationIndicator(
MessageListViewModel.likeNoticeCount,
R.mipmap.rider_pro_like,
stringResource(R.string.like_upper),
Color(0xFFFAFD5D)
) {
likeDebouncer {
if (MessageListViewModel.likeNoticeCount > 0) {
// 刷新点赞消息列表
LikeNoticeViewModel.isFirstLoad = true
// 清除点赞消息数量
MessageListViewModel.clearLikeNoticeCount()
if (totalNoticeCount > 0) {
Box(
modifier = Modifier
.size(8.dp)
.background(
color = Color(0xFFFF3B30),
shape = CircleShape
)
.align(Alignment.TopEnd)
.offset(x = 8.dp, y = (-4).dp)
)
}
navController.navigate(NavigationRoute.Likes.route)
}
}
NotificationIndicator(
MessageListViewModel.followNoticeCount,
R.mipmap.rider_pro_followers,
stringResource(R.string.followers_upper),
Color(0xFFF470FE)
) {
followDebouncer {
if (MessageListViewModel.followNoticeCount > 0) {
// 刷新关注消息列表
FollowerNoticeViewModel.isFirstLoad = true
MessageListViewModel.clearFollowNoticeCount()
}
navController.navigate(NavigationRoute.Followers.route)
}
}
NotificationIndicator(
MessageListViewModel.commentNoticeCount,
R.mipmap.rider_pro_comment,
stringResource(R.string.comment).uppercase(),
Color(0xFF6246FF)
) {
commentDebouncer {
navController.navigate(NavigationRoute.CommentNoticeScreen.route)
}
}
}
//创建群聊//
// Image(
// painter = painterResource(id = R.drawable.rider_pro_group),
// contentDescription = "add",
// modifier = Modifier
// .size(24.dp)
// .noRippleClickable {
// debouncer {
// navController.navigate(NavigationRoute.CreateGroupChat.route)
// }
// },
// colorFilter = ColorFilter.tint(AppColors.text)
// )
// // 搜索栏//
// Box(
// modifier = Modifier
// .fillMaxWidth()
// .padding(horizontal = 16.dp, vertical = 8.dp)
// .height(40.dp)
//
// .noRippleClickable {
// },
// contentAlignment = Alignment.CenterStart
// )
// {
// Row(
// modifier = Modifier
// .height(36.dp)
// .fillMaxWidth()
// .clip(shape = RoundedCornerShape(8.dp))
// .background(AppColors.inputBackground)
// .padding(horizontal = 8.dp, vertical = 0.dp)
// .noRippleClickable {
// // 搜索框点击事件
// },
// verticalAlignment = Alignment.CenterVertically
// ) {
// Icon(
// painter = painterResource(id = R.drawable.rider_pro_nav_search),
// contentDescription = null,
// tint = AppColors.inputHint
// )
// Box {
// androidx.compose.material.Text(
// text = stringResource(R.string.search),
// modifier = Modifier.padding(start = 8.dp),
// color = AppColors.inputHint,
// fontSize = 17.sp
// )
// }
// }
// }
//赞、粉丝、评论//
// Row(
// modifier = Modifier
// .fillMaxWidth()
// .padding(horizontal = 16.dp),
// horizontalArrangement = Arrangement.SpaceBetween,
// ) {
// val likeDebouncer = rememberDebouncer()
// val followDebouncer = rememberDebouncer()
// val commentDebouncer = rememberDebouncer()
//
// NotificationIndicator(
// MessageListViewModel.likeNoticeCount,
// R.mipmap.rider_pro_like,
// stringResource(R.string.like_upper),
// Color(0xFFFAFD5D)
// ) {
// likeDebouncer {
// if (MessageListViewModel.likeNoticeCount > 0) {
// // 刷新点赞消息列表
// LikeNoticeViewModel.isFirstLoad = true
// // 清除点赞消息数量
// MessageListViewModel.clearLikeNoticeCount()
// }
// navController.navigate(NavigationRoute.Likes.route)
// }
// }
// NotificationIndicator(
// MessageListViewModel.followNoticeCount,
// R.mipmap.rider_pro_followers,
// stringResource(R.string.followers_upper),
// Color(0xFFF470FE)
// ) {
// followDebouncer {
// if (MessageListViewModel.followNoticeCount > 0) {
// // 刷新关注消息列表
// FollowerNoticeViewModel.isFirstLoad = true
// MessageListViewModel.clearFollowNoticeCount()
// }
// navController.navigate(NavigationRoute.Followers.route)
// }
// }
// NotificationIndicator(
// MessageListViewModel.commentNoticeCount,
// R.mipmap.rider_pro_comment,
// stringResource(R.string.comment).uppercase(),
// Color(0xFF6246FF)
// ) {
// commentDebouncer {
// navController.navigate(NavigationRoute.CommentNoticeScreen.route)
// }
// }
// }
Spacer(modifier = Modifier.height(23.dp))
Row(
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
.padding(start = 16.dp,bottom = 16.dp),
// center the tabs
horizontalArrangement = Arrangement.Start,
verticalAlignment = Alignment.Bottom
) {

View File

@@ -30,9 +30,6 @@ 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.graphics.vector.ImageVector
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
@@ -51,6 +48,12 @@ import com.aiosman.ravenow.ui.index.tabs.moment.tabs.timeline.TimelineMomentsLis
import com.aiosman.ravenow.ui.index.tabs.search.SearchViewModel
import com.aiosman.ravenow.ui.modifiers.noRippleClickable
import kotlinx.coroutines.launch
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.ColorFilter
import com.aiosman.ravenow.ui.composables.TabItem
import com.aiosman.ravenow.ui.composables.TabSpacer
import com.aiosman.ravenow.ui.composables.rememberDebouncer
/**
* 动态列表
@@ -63,8 +66,8 @@ fun MomentsList() {
val navigationBarPaddings =
WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding() + 48.dp
val statusBarPaddingValues = WindowInsets.systemBars.asPaddingValues()
// 游客模式下不显示timeline只显示3个tabExplore、Dynamic、Hot
val tabCount = if (AppStore.isGuest) 3 else 4
// 游客模式下不显示timeline只显示2个tabDynamic、Hot // 游客模式下不显示timeline只显示3个tabExplore、Dynamic、Hot
val tabCount = if (AppStore.isGuest) 2 else 3 // val tabCount = if (AppStore.isGuest) 3 else 4
var pagerState = rememberPagerState { tabCount }
var scope = rememberCoroutineScope()
Column(
@@ -79,154 +82,143 @@ fun MomentsList() {
Row(
modifier = Modifier
.fillMaxWidth()
.height(44.dp),
.height(44.dp)
.padding(horizontal = 16.dp),
// center the tabs
horizontalArrangement = Arrangement.Start,
verticalAlignment = Alignment.CenterVertically
) {
Column(
//原探索//
// Column(
// modifier = Modifier
// .noRippleClickable {
// scope.launch {
// pagerState.animateScrollToPage(0)
// }
// }.padding(start = 16.dp),
// verticalArrangement = Arrangement.Center,
// horizontalAlignment = Alignment.CenterHorizontally
//
// ) {
// Text(
// text = stringResource(R.string.index_worldwide),
// fontSize = if (pagerState.currentPage == 0)18.sp else 16.sp,
// color = if (pagerState.currentPage == 0) AppColors.text else AppColors.nonActiveText,
// fontWeight = FontWeight.W600)
// Spacer(modifier = Modifier.height(4.dp))
//
// Image(
// painter = painterResource(
// if (pagerState.currentPage == 0) R.mipmap.tab_indicator_selected
// else R.drawable.tab_indicator_unselected
// ),
// contentDescription = "tab indicator",
// modifier = Modifier
// .width(34.dp)
// .height(4.dp)
// )
//
// }
// Spacer(modifier = Modifier.width(16.dp))
Text(
text = stringResource(R.string.moment),
fontSize = 20.sp,
fontWeight = FontWeight.W900,
color = AppColors.text,
modifier = Modifier
.noRippleClickable {
scope.launch {
pagerState.animateScrollToPage(0)
}
}.padding(start = 16.dp),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
.align(Alignment.CenterVertically)
)
) {
Text(
text = stringResource(R.string.index_worldwide),
fontSize = if (pagerState.currentPage == 0)18.sp else 16.sp,
color = if (pagerState.currentPage == 0) AppColors.text else AppColors.nonActiveText,
fontWeight = FontWeight.W600)
Spacer(modifier = Modifier.height(4.dp))
Spacer(modifier = Modifier.weight(1f))
Image(
painter = painterResource(
if (pagerState.currentPage == 0) R.mipmap.tab_indicator_selected
else R.drawable.tab_indicator_unselected
),
contentDescription = "tab indicator",
modifier = Modifier
.width(34.dp)
.height(4.dp)
)
}
Spacer(modifier = Modifier.width(16.dp))
Column(
Image(
painter = painterResource(id = R.drawable.rider_pro_nav_search),
contentDescription = "search",
modifier = Modifier
.size(24.dp)
.noRippleClickable {
scope.launch {
pagerState.animateScrollToPage(1)
}
navController.navigate(NavigationRoute.Search.route)
},
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
text = stringResource(R.string.index_dynamic),
fontSize = if (pagerState.currentPage == 1)18.sp else 16.sp,
color = if (pagerState.currentPage == 1) AppColors.text else AppColors.nonActiveText,
fontWeight = FontWeight.W600)
Spacer(modifier = Modifier.height(4.dp))
colorFilter = ColorFilter.tint(AppColors.text)
)
}
Image(
painter = painterResource(
if (pagerState.currentPage == 1) R.mipmap.tab_indicator_selected
else R.drawable.tab_indicator_unselected
),
contentDescription = "tab indicator",
modifier = Modifier
.width(34.dp)
.height(4.dp)
Spacer(modifier = Modifier.height(23.dp))
Row(
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
.padding(start = 16.dp, bottom = 16.dp),
horizontalArrangement = Arrangement.Start,
verticalAlignment = Alignment.Bottom
) {
val tabDebouncer = rememberDebouncer()
// 新探索标签
Box {
CustomTabItem(
text = stringResource(R.string.index_worldwide),
isSelected = pagerState.currentPage == 0,
onClick = {
tabDebouncer {
scope.launch {
pagerState.animateScrollToPage(0)
}
}
}
)
}
TabSpacer()
// 只有非游客用户才显示"关注"tab
if (!AppStore.isGuest) {
//关注tab
Spacer(modifier = Modifier.width(16.dp))
Column(
modifier = Modifier
.noRippleClickable {
scope.launch {
pagerState.animateScrollToPage(2)
}
},
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
Box {
CustomTabItem(
text = stringResource(R.string.index_following),
fontSize = if (pagerState.currentPage == 2)18.sp else 16.sp,
color = if (pagerState.currentPage == 2) AppColors.text else AppColors.nonActiveText,
fontWeight = FontWeight.W600)
Spacer(modifier = Modifier.height(4.dp))
Image(
painter = painterResource(
if (pagerState.currentPage == 2) R.mipmap.tab_indicator_selected
else R.drawable.tab_indicator_unselected
),
contentDescription = "tab indicator",
modifier = Modifier
.width(34.dp)
.height(4.dp)
isSelected = pagerState.currentPage == 1,
onClick = {
tabDebouncer {
scope.launch {
pagerState.animateScrollToPage(1)
}
}
}
)
}
}
//热门tab
Spacer(modifier = Modifier.width(16.dp))
Column(
modifier = Modifier
.noRippleClickable {
scope.launch {
val targetPage = if (AppStore.isGuest) 2 else 3
pagerState.animateScrollToPage(targetPage)
}
},
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
text = stringResource(R.string.index_hot),
fontSize = if ((AppStore.isGuest && pagerState.currentPage == 2) || (!AppStore.isGuest && pagerState.currentPage == 3)) 18.sp else 16.sp,
color = if ((AppStore.isGuest && pagerState.currentPage == 2) || (!AppStore.isGuest && pagerState.currentPage == 3)) AppColors.text else AppColors.nonActiveText,
fontWeight = FontWeight.W600)
Spacer(modifier = Modifier.height(4.dp))
Image(
painter = painterResource(
if ((AppStore.isGuest && pagerState.currentPage == 2) || (!AppStore.isGuest && pagerState.currentPage == 3)) R.mipmap.tab_indicator_selected
else R.drawable.tab_indicator_unselected
),
contentDescription = "tab indicator",
modifier = Modifier
.width(34.dp)
.height(4.dp)
)
TabSpacer()
}
//搜索按钮
Column(
modifier = Modifier
.padding(bottom = 8.dp, end = 16.dp)
.fillMaxWidth(),
horizontalAlignment = Alignment.End
) {
Icon(
ImageVector.vectorResource(R.drawable.rider_pro_nav_search),
contentDescription = "Clickable Icon",
tint = AppColors.text,
modifier = Modifier.size(24.dp)
.noRippleClickable {
navController.navigate(NavigationRoute.Search.route)
// 热门标签
Box {
CustomTabItem(
text = stringResource(R.string.index_hot),
isSelected = pagerState.currentPage == 2,
onClick = {
tabDebouncer {
scope.launch {
pagerState.animateScrollToPage(2)
}
}
}
)
)
}
} else {
// 热门标签 (游客模式)
Box {
CustomTabItem(
text = stringResource(R.string.index_hot),
isSelected = pagerState.currentPage == 1,
onClick = {
tabDebouncer {
scope.launch {
pagerState.animateScrollToPage(1)
}
}
}
)
}
}
}
@@ -237,31 +229,25 @@ fun MomentsList() {
.weight(1f)
) {
if (AppStore.isGuest) {
// 游客模式:Explore(0), Dynamic(1), Hot(2)
// 游客模式Dynamic(0), Hot(1)
when (it) {
0 -> {
Explore()
}
1 -> {
Dynamic()
}
2 -> {
1 -> {
HotMomentsList()
}
}
} else {
// 正常用户:Explore(0), Dynamic(1), Timeline(2), Hot(3)
// 正常用户Dynamic(0), Timeline(1), Hot(2)
when (it) {
0 -> {
Explore()
}
1 -> {
Dynamic()
}
2 -> {
1 -> {
TimelineMomentsList()
}
3 -> {
2 -> {
HotMomentsList()
}
}
@@ -269,5 +255,30 @@ fun MomentsList() {
}
}
}
@Composable
fun CustomTabItem(
text: String,
isSelected: Boolean,
onClick: () -> Unit,
modifier: Modifier = Modifier
) {
val AppColors = LocalAppTheme.current
Column(
modifier = modifier
.noRippleClickable { onClick() },
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
text = text,
fontSize = 15.sp,
color = if (isSelected) AppColors.tabSelectedText else AppColors.tabUnselectedText,
modifier = Modifier
.clip(RoundedCornerShape(12.dp))
.background(if (isSelected) AppColors.tabSelectedBackground else AppColors.tabUnselectedBackground)
.padding(horizontal = 16.dp, vertical = 8.dp)
)
}
}

View File

@@ -93,7 +93,7 @@ fun GalleryItem(
Text(
text = "故事还没开始",
fontSize = 12.sp,
fontSize = 16.sp,
color = AppColors.text,
fontWeight = FontWeight.W600
)
@@ -150,7 +150,7 @@ fun GalleryGrid(
Text(
text = "故事还没开始",
fontSize = 12.sp,
fontSize = 16.sp,
color = AppColors.text,
fontWeight = FontWeight.W600
)

View File

@@ -275,7 +275,7 @@ fun LoginPage() {
) {
Spacer(modifier = Modifier.weight(1f))
Image(
painter = painterResource(id = R.mipmap.rider_pro_color_logo_next),
painter = painterResource(id = R.mipmap.invalid_name),
contentDescription = "Rave Now",
modifier = Modifier
.size(52.dp)

View File

@@ -96,7 +96,7 @@ fun NewPostScreen() {
var isAiEnabled by remember { mutableStateOf(false) }
var isRotating by remember { mutableStateOf(false) }
var isRequesting by remember { mutableStateOf(false) }
val keyboardController = LocalSoftwareKeyboardController.current // 添加这行
val keyboardController = LocalSoftwareKeyboardController.current
val model = NewPostViewModel
val systemUiController = rememberSystemUiController()

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 707 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 935 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB