This commit is contained in:
2025-09-18 18:19:19 +08:00
parent 6d2133545f
commit a200d00587
5 changed files with 72 additions and 22 deletions

View File

@@ -92,16 +92,22 @@ fun MomentCard(
showFollowButton = showFollowButton showFollowButton = showFollowButton
) )
} }
val lastClickTime = remember { mutableStateOf(0L) }
val clickDelay = 500L
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.noRippleClickable { .noRippleClickable {
val currentTime = System.currentTimeMillis()
if (currentTime - lastClickTime.value > clickDelay) {
lastClickTime.value = currentTime
navController.navigateToPost( navController.navigateToPost(
momentEntity.id, momentEntity.id,
highlightCommentId = 0, highlightCommentId = 0,
initImagePagerIndex = imageIndex initImagePagerIndex = imageIndex
) )
} }
}
) { ) {
MomentContentGroup( MomentContentGroup(
momentEntity = momentEntity, momentEntity = momentEntity,
@@ -213,7 +219,6 @@ fun MomentPostLocation(location: String) {
text = location, text = location,
color = AppColors.secondaryText, color = AppColors.secondaryText,
fontSize = 12.sp, fontSize = 12.sp,
) )
} }
@@ -238,6 +243,8 @@ fun MomentTopRowGroup(
Row( Row(
modifier = Modifier modifier = Modifier
) { ) {
val lastClickTime = remember { mutableStateOf(0L) }
val clickDelay = 500L
CustomAsyncImage( CustomAsyncImage(
context, context,
momentEntity.avatar, momentEntity.avatar,
@@ -246,12 +253,16 @@ fun MomentTopRowGroup(
.size(40.dp) .size(40.dp)
.clip(RoundedCornerShape(40.dp)) .clip(RoundedCornerShape(40.dp))
.noRippleClickable { .noRippleClickable {
val currentTime = System.currentTimeMillis()
if (currentTime - lastClickTime.value > clickDelay) {
lastClickTime.value = currentTime
navController.navigate( navController.navigate(
NavigationRoute.AccountProfile.route.replace( NavigationRoute.AccountProfile.route.replace(
"{id}", "{id}",
momentEntity.authorId.toString() momentEntity.authorId.toString()
) )
) )
}
}, },
contentScale = ContentScale.Crop contentScale = ContentScale.Crop
) )
@@ -267,7 +278,19 @@ fun MomentTopRowGroup(
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
MomentName( MomentName(
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f)
.noRippleClickable {
val currentTime = System.currentTimeMillis()
if (currentTime - lastClickTime.value > clickDelay) {
lastClickTime.value = currentTime
navController.navigate(
NavigationRoute.AccountProfile.route.replace(
"{id}",
momentEntity.authorId.toString()
)
)
}
},
name = momentEntity.nickname name = momentEntity.nickname
) )
Spacer(modifier = Modifier.width(16.dp)) Spacer(modifier = Modifier.width(16.dp))
@@ -416,6 +439,8 @@ fun MomentBottomOperateRowGroup(
momentEntity: MomentEntity, momentEntity: MomentEntity,
imageIndex: Int = 0 imageIndex: Int = 0
) { ) {
val lastClickTime = remember { mutableStateOf(0L) }
val clickDelay = 500L
var showCommentModal by remember { mutableStateOf(false) } var showCommentModal by remember { mutableStateOf(false) }
if (showCommentModal) { if (showCommentModal) {
ModalBottomSheet( ModalBottomSheet(
@@ -454,7 +479,6 @@ fun MomentBottomOperateRowGroup(
Column( Column(
modifier = Modifier.fillMaxSize() modifier = Modifier.fillMaxSize()
) { ) {
// 图片指示器放在操作按钮上方
if (momentEntity.images.size > 1) { if (momentEntity.images.size > 1) {
Row( Row(
modifier = Modifier modifier = Modifier
@@ -507,7 +531,11 @@ fun MomentBottomOperateRowGroup(
.wrapContentWidth() .wrapContentWidth()
.fillMaxHeight() .fillMaxHeight()
.noRippleClickable { .noRippleClickable {
val currentTime = System.currentTimeMillis()
if (currentTime - lastClickTime.value > clickDelay) {
lastClickTime.value = currentTime
onCommentClick() onCommentClick()
}
}, },
contentAlignment = Alignment.CenterEnd contentAlignment = Alignment.CenterEnd
) { ) {

View File

@@ -362,7 +362,7 @@ fun IndexScreen() {
Text( Text(
text = it.label(), text = it.label(),
fontSize = 10.sp, fontSize = 10.sp,
color = if (isSelected) AppColors.brandColorsColor else AppColors.text, color = if (isSelected) Color.Blue else AppColors.text,
fontWeight = if (isSelected) FontWeight.W600 else FontWeight.Normal fontWeight = if (isSelected) FontWeight.W600 else FontWeight.Normal
) )
} }

View File

@@ -49,6 +49,8 @@ import com.aiosman.ravenow.ui.index.tabs.search.SearchViewModel
import com.aiosman.ravenow.ui.modifiers.noRippleClickable import com.aiosman.ravenow.ui.modifiers.noRippleClickable
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.graphics.ColorFilter
import com.aiosman.ravenow.ui.composables.TabItem import com.aiosman.ravenow.ui.composables.TabItem
@@ -120,6 +122,8 @@ fun MomentsList() {
// //
// } // }
// Spacer(modifier = Modifier.width(16.dp)) // Spacer(modifier = Modifier.width(16.dp))
val lastClickTime = remember { mutableStateOf(0L) }
val clickDelay = 500L
Text( Text(
text = stringResource(R.string.moment), text = stringResource(R.string.moment),
fontSize = 20.sp, fontSize = 20.sp,
@@ -137,7 +141,11 @@ fun MomentsList() {
modifier = Modifier modifier = Modifier
.size(24.dp) .size(24.dp)
.noRippleClickable { .noRippleClickable {
val currentTime = System.currentTimeMillis()
if (currentTime - lastClickTime.value > clickDelay) {
lastClickTime.value = currentTime
navController.navigate(NavigationRoute.Search.route) navController.navigate(NavigationRoute.Search.route)
}
}, },
colorFilter = ColorFilter.tint(AppColors.text) colorFilter = ColorFilter.tint(AppColors.text)
) )

View File

@@ -279,6 +279,7 @@ fun LoginPage() {
contentDescription = "Rave Now", contentDescription = "Rave Now",
modifier = Modifier modifier = Modifier
.size(52.dp) .size(52.dp)
.clip(RoundedCornerShape(10.dp))
) )
Spacer(modifier = Modifier.height(8.dp)) Spacer(modifier = Modifier.height(8.dp))
Text( Text(

View File

@@ -917,7 +917,20 @@ fun Header(
Text( Text(
text = nickname ?: "", text = nickname ?: "",
fontWeight = FontWeight.Bold, fontWeight = FontWeight.Bold,
modifier = Modifier.weight(1f), modifier = Modifier
.weight(1f)
.debouncedClickable(debounceTime = 1000L) {
userId?.let {
debouncedNavigation {
navController.navigate(
NavigationRoute.AccountProfile.route.replace(
"{id}",
userId.toString()
)
)
}
}
},
color = AppColors.text, color = AppColors.text,
fontSize = 17.sp fontSize = 17.sp
) )
@@ -1196,7 +1209,7 @@ fun PostImageView(
) )
} }
// Navigation and Indicator container // 图片导航控件
if (images.size > 1) { if (images.size > 1) {
Row( Row(
modifier = Modifier modifier = Modifier