更新个人主页及其他页面
- 个人主页UI更新,支持工具栏滚动 - 调整个人主页背景颜色 - 更新个人主页为空时的 UI - 更新用户信息编辑页面样式 - 更新点赞和收藏通知页面的文案 - 更新点赞和收藏通知页面的国际化 - 修复 UserContentPageIndicator 的滚动问题 - 更新评论通知页面的标题文案 - 更新评论通知页面的国际化
This commit is contained in:
@@ -161,7 +161,7 @@ fun AccountEditScreen2() {
|
||||
}
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize(),
|
||||
.fillMaxSize().background(Color.White),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
StatusBarSpacer()
|
||||
@@ -210,13 +210,13 @@ fun AccountEditScreen2() {
|
||||
.size(32.dp)
|
||||
.clip(CircleShape)
|
||||
.background(AppColors.mainColor)
|
||||
.align(Alignment.BottomEnd).noRippleClickable {
|
||||
.align(Alignment.BottomEnd)
|
||||
.noRippleClickable {
|
||||
Intent(Intent.ACTION_PICK).apply {
|
||||
type = "image/*"
|
||||
pickImageLauncher.launch(this)
|
||||
}
|
||||
}
|
||||
,
|
||||
},
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Icon(
|
||||
@@ -229,14 +229,16 @@ fun AccountEditScreen2() {
|
||||
}
|
||||
Spacer(modifier = Modifier.height(46.dp))
|
||||
Column(
|
||||
modifier = Modifier.padding(horizontal = 24.dp).border(
|
||||
width = 1.dp,
|
||||
color = Color(0xFFEBEBEB),
|
||||
)
|
||||
modifier = Modifier
|
||||
.padding(horizontal = 16.dp)
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.padding(16.dp),
|
||||
modifier = Modifier
|
||||
.clip(RoundedCornerShape(24.dp))
|
||||
.background(Color(0xfff8f8f8))
|
||||
.padding(16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.nickname),
|
||||
@@ -263,15 +265,12 @@ fun AccountEditScreen2() {
|
||||
.padding(start = 16.dp)
|
||||
)
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(1.dp)
|
||||
.padding(horizontal = 16.dp)
|
||||
.background(Color(0xFFEBEBEB))
|
||||
)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Row(
|
||||
modifier = Modifier.padding(16.dp),
|
||||
modifier = Modifier
|
||||
.clip(RoundedCornerShape(16.dp))
|
||||
.background(Color(0xfff8f8f8))
|
||||
.padding(16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Text(
|
||||
|
||||
@@ -22,6 +22,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
@@ -32,6 +33,7 @@ import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import androidx.paging.LoadState
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.entity.CommentEntity
|
||||
import com.aiosman.riderpro.exp.timeAgo
|
||||
import com.aiosman.riderpro.ui.NavigationRoute
|
||||
@@ -68,7 +70,7 @@ fun CommentNoticeScreen() {
|
||||
.fillMaxWidth()
|
||||
.padding(16.dp)
|
||||
) {
|
||||
NoticeScreenHeader("Comment", moreIcon = false)
|
||||
NoticeScreenHeader(stringResource(R.string.comment), moreIcon = false)
|
||||
}
|
||||
|
||||
LazyColumn(
|
||||
|
||||
@@ -22,7 +22,13 @@
|
||||
|
||||
package com.aiosman.riderpro.ui.composables.toolbar
|
||||
|
||||
import androidx.compose.foundation.ScrollState
|
||||
import androidx.compose.foundation.gestures.ScrollableDefaults
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.Stable
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
@@ -35,7 +41,9 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||
import androidx.compose.ui.layout.Layout
|
||||
import androidx.compose.ui.layout.ParentDataModifier
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.platform.LocalLayoutDirection
|
||||
import androidx.compose.ui.unit.Constraints
|
||||
import androidx.compose.ui.unit.Density
|
||||
import androidx.compose.ui.unit.IntSize
|
||||
import kotlin.math.max
|
||||
@@ -87,6 +95,7 @@ fun CollapsingToolbarScaffold(
|
||||
enabled: Boolean = true,
|
||||
toolbarModifier: Modifier = Modifier,
|
||||
toolbarClipToBounds: Boolean = true,
|
||||
toolbarScrollable: Boolean = false,
|
||||
toolbar: @Composable CollapsingToolbarScope.() -> Unit,
|
||||
body: @Composable CollapsingToolbarScaffoldScope.() -> Unit
|
||||
) {
|
||||
@@ -98,6 +107,7 @@ fun CollapsingToolbarScaffold(
|
||||
}
|
||||
|
||||
val toolbarState = state.toolbarState
|
||||
val toolbarScrollState = rememberScrollState()
|
||||
|
||||
Layout(
|
||||
content = {
|
||||
@@ -106,6 +116,12 @@ fun CollapsingToolbarScaffold(
|
||||
clipToBounds = toolbarClipToBounds,
|
||||
collapsingToolbarState = toolbarState,
|
||||
) {
|
||||
ToolbarScrollableBox(
|
||||
enabled,
|
||||
toolbarScrollable,
|
||||
toolbarState,
|
||||
toolbarScrollState
|
||||
)
|
||||
toolbar()
|
||||
}
|
||||
|
||||
@@ -181,6 +197,24 @@ fun CollapsingToolbarScaffold(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ToolbarScrollableBox(
|
||||
enabled: Boolean,
|
||||
toolbarScrollable: Boolean,
|
||||
toolbarState: CollapsingToolbarState,
|
||||
toolbarScrollState: ScrollState
|
||||
) {
|
||||
val toolbarScrollableEnabled = enabled && toolbarScrollable
|
||||
if (toolbarScrollableEnabled && toolbarState.height != Constraints.Infinity) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(with(LocalDensity.current) { toolbarState.height.toDp() })
|
||||
.verticalScroll(state = toolbarScrollState)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
internal object CollapsingToolbarScaffoldScopeInstance: CollapsingToolbarScaffoldScope {
|
||||
@ExperimentalToolbarApi
|
||||
override fun Modifier.align(alignment: Alignment): Modifier =
|
||||
|
||||
@@ -15,6 +15,7 @@ fun ToolbarWithFabScaffold(
|
||||
toolbarModifier: Modifier = Modifier,
|
||||
toolbarClipToBounds: Boolean = true,
|
||||
toolbar: @Composable CollapsingToolbarScope.() -> Unit,
|
||||
toolbarScrollable: Boolean = false,
|
||||
fab: @Composable () -> Unit,
|
||||
fabPosition: FabPosition = FabPosition.End,
|
||||
body: @Composable CollapsingToolbarScaffoldScope.() -> Unit
|
||||
@@ -37,7 +38,8 @@ fun ToolbarWithFabScaffold(
|
||||
toolbarModifier = toolbarModifier,
|
||||
toolbarClipToBounds = toolbarClipToBounds,
|
||||
toolbar = toolbar,
|
||||
body = body
|
||||
body = body,
|
||||
toolbarScrollable = toolbarScrollable
|
||||
)
|
||||
}.map { it.measure(toolbarScaffoldConstraints) }
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import androidx.activity.compose.rememberLauncherForActivityResult
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.ScrollState
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
@@ -33,6 +34,7 @@ import androidx.compose.foundation.pager.HorizontalPager
|
||||
import androidx.compose.foundation.pager.rememberPagerState
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Add
|
||||
@@ -48,8 +50,12 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.shadow
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
|
||||
import androidx.compose.ui.input.nestedscroll.NestedScrollSource
|
||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
@@ -58,8 +64,11 @@ 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.media3.common.util.Log
|
||||
import androidx.media3.common.util.UnstableApi
|
||||
import androidx.paging.PagingData
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.aiosman.riderpro.AppState
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.entity.AccountProfileEntity
|
||||
@@ -122,9 +131,12 @@ fun ProfileV3(
|
||||
|
||||
Box {
|
||||
CollapsingToolbarScaffold(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.background(Color(0xfff8f8f8)),
|
||||
state = state,
|
||||
scrollStrategy = ScrollStrategy.ExitUntilCollapsed,
|
||||
toolbarScrollable = true,
|
||||
enabled = enabled,
|
||||
toolbar = {
|
||||
Column(
|
||||
@@ -133,8 +145,6 @@ fun ProfileV3(
|
||||
// 保持在最低高度和当前高度之间
|
||||
.background(Color(0xfff8f8f8))
|
||||
.padding(horizontal = 16.dp)
|
||||
|
||||
|
||||
) {
|
||||
StatusBarSpacer()
|
||||
|
||||
@@ -161,20 +171,6 @@ fun ProfileV3(
|
||||
}
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
}
|
||||
// Column(
|
||||
// modifier = Modifier.fillMaxWidth()
|
||||
//
|
||||
// ) {
|
||||
// StatusBarSpacer()
|
||||
// Box(
|
||||
// modifier = Modifier
|
||||
// .background(Color.White)
|
||||
// .fillMaxWidth()
|
||||
// .height(64.dp)
|
||||
// ) {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.parallax(0.5f)
|
||||
@@ -333,6 +329,7 @@ fun ProfileV3(
|
||||
navController.navigate(NavigationRoute.AccountEdit.route)
|
||||
}
|
||||
} else {
|
||||
if (it.id != AppState.UserId) {
|
||||
OtherProfileAction(
|
||||
it,
|
||||
onFollow = {
|
||||
@@ -345,6 +342,8 @@ fun ProfileV3(
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// collapsed bar
|
||||
@@ -414,7 +413,7 @@ fun ProfileV3(
|
||||
}
|
||||
items(moments.itemCount) { idx ->
|
||||
val moment = moments[idx] ?: return@items
|
||||
GalleryItem(moment,idx)
|
||||
GalleryItem(moment, idx)
|
||||
}
|
||||
items(2) {
|
||||
Spacer(modifier = Modifier.height(120.dp))
|
||||
@@ -426,7 +425,7 @@ fun ProfileV3(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
) {
|
||||
if (moments.itemCount == 0) {
|
||||
if (moments.itemCount == 0 && isSelf) {
|
||||
item {
|
||||
EmptyMomentPostUnit()
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
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.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
@@ -33,6 +35,7 @@ fun UserContentPageIndicator(
|
||||
val scope = rememberCoroutineScope()
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.verticalScroll(rememberScrollState())
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
) {
|
||||
|
||||
@@ -114,7 +114,6 @@ fun LikeNoticeScreen() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Composable
|
||||
fun ActionPostNoticeItem(
|
||||
avatar: String,
|
||||
@@ -165,8 +164,8 @@ fun ActionPostNoticeItem(
|
||||
Text(nickName, fontWeight = FontWeight.Bold, fontSize = 16.sp)
|
||||
Spacer(modifier = Modifier.height(2.dp))
|
||||
when (action) {
|
||||
"like" -> Text("Like your post")
|
||||
"favourite" -> Text("Favourite your post")
|
||||
"like" -> Text(stringResource(R.string.like_your_post))
|
||||
"favourite" -> Text(stringResource(R.string.favourite_your_post))
|
||||
}
|
||||
Spacer(modifier = Modifier.height(2.dp))
|
||||
Row {
|
||||
@@ -190,7 +189,9 @@ fun LikeCommentNoticeItem(
|
||||
val navController = LocalNavController.current
|
||||
val context = LocalContext.current
|
||||
Box(
|
||||
modifier = Modifier.padding(vertical = 16.dp).noRippleClickable {
|
||||
modifier = Modifier
|
||||
.padding(vertical = 16.dp)
|
||||
.noRippleClickable {
|
||||
item.comment?.postId.let {
|
||||
navController.navigateToPost(
|
||||
id = it ?: 0,
|
||||
@@ -213,7 +214,7 @@ fun LikeCommentNoticeItem(
|
||||
modifier = Modifier
|
||||
.size(48.dp)
|
||||
.clip(CircleShape),
|
||||
contentDescription = "Like your comment"
|
||||
contentDescription = stringResource(R.string.like_your_comment)
|
||||
)
|
||||
Spacer(modifier = Modifier.width(12.dp))
|
||||
Column(
|
||||
@@ -222,7 +223,7 @@ fun LikeCommentNoticeItem(
|
||||
) {
|
||||
Text(item.user.nickName, fontWeight = FontWeight.Bold, fontSize = 16.sp)
|
||||
Spacer(modifier = Modifier.height(2.dp))
|
||||
Text("Like your comment")
|
||||
Text(stringResource(R.string.like_your_comment))
|
||||
Spacer(modifier = Modifier.height(2.dp))
|
||||
Row {
|
||||
Text(
|
||||
|
||||
@@ -76,4 +76,7 @@
|
||||
<string name="private_policy_keyword">用户协议</string>
|
||||
<string name="gallery">图片</string>
|
||||
<string name="chat_upper">私信</string>
|
||||
<string name="like_your_post">喜欢了你的动态</string>
|
||||
<string name="favourite_your_post">收藏了你的动态</string>
|
||||
<string name="like_your_comment">喜欢了你的评论</string>
|
||||
</resources>
|
||||
@@ -75,4 +75,7 @@
|
||||
<string name="private_policy_keyword">Rider Pro’s Privacy Policy</string>
|
||||
<string name="gallery">Gallery</string>
|
||||
<string name="chat_upper">CHAT</string>
|
||||
<string name="like_your_post">Like your post</string>
|
||||
<string name="favourite_your_post">Favourite your post</string>
|
||||
<string name="like_your_comment">Like your comment</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user