首页UI
This commit is contained in:
@@ -22,7 +22,7 @@ sealed class NavigationItem(
|
||||
)
|
||||
|
||||
data object Ai : NavigationItem("Ai",
|
||||
icon = { R.drawable.dynamic },
|
||||
icon = { R.mipmap.bars_x_buttons_discover_bold},
|
||||
selectedIcon = { R.mipmap.dynamic_hl },
|
||||
label = { stringResource(R.string.index_dynamic) }
|
||||
)
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
BIN
app/src/main/res/mipmap-hdpi/bars_x_buttons_discover_bold.png
Normal file
BIN
app/src/main/res/mipmap-hdpi/bars_x_buttons_discover_bold.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 551 B |
BIN
app/src/main/res/mipmap-mdpi/bars_x_buttons_discover_bold.png
Normal file
BIN
app/src/main/res/mipmap-mdpi/bars_x_buttons_discover_bold.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 418 B |
BIN
app/src/main/res/mipmap-xhdpi/bars_x_buttons_discover_bold.png
Normal file
BIN
app/src/main/res/mipmap-xhdpi/bars_x_buttons_discover_bold.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 695 B |
BIN
app/src/main/res/mipmap-xxhdpi/bars_x_buttons_discover_bold.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/bars_x_buttons_discover_bold.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 935 B |
BIN
app/src/main/res/mipmap-xxxhdpi/bars_x_buttons_discover_bold.png
Normal file
BIN
app/src/main/res/mipmap-xxxhdpi/bars_x_buttons_discover_bold.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Reference in New Issue
Block a user