From ea0bcc938415f51267d7f6870ec83dbe45c92b27 Mon Sep 17 00:00:00 2001 From: HuanCheng65 <22636177+HuanCheng65@users.noreply.github.com> Date: Mon, 17 Jul 2023 14:15:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A5=BC=E4=B8=AD=E6=A5=BC=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=98=B5=E7=A7=B0=E7=82=B9=E5=87=BB=E6=89=93=E5=BC=80?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=B5=84=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tieba/post/ui/page/thread/ThreadPage.kt | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/thread/ThreadPage.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/thread/ThreadPage.kt index 64695eea..88825ab0 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/thread/ThreadPage.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/thread/ThreadPage.kt @@ -77,10 +77,13 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.AnnotatedString +import androidx.compose.ui.text.ExperimentalTextApi import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.buildAnnotatedString 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.text.withAnnotation import androidx.compose.ui.text.withStyle import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp @@ -1238,6 +1241,7 @@ private fun BottomBar( } } +@OptIn(ExperimentalTextApi::class) @Composable fun PostCard( postHolder: ImmutableHolder, @@ -1296,14 +1300,16 @@ fun PostCard( fontWeight = FontWeight.Bold ) ) { - append( - StringUtil.getUsernameAnnotatedString( - context, - subPostList.author?.name ?: "", - subPostList.author?.nameShow + withAnnotation("user", "${subPostList.author?.id}") { + append( + StringUtil.getUsernameAnnotatedString( + context, + subPostList.author?.name ?: "", + subPostList.author?.nameShow + ) ) - ) - append(": ") + append(": ") + } } } val contentStrings = subPostList.content.renders.map { it.toAnnotationString() } @@ -1389,7 +1395,9 @@ fun PostCard( color = ExtendedTheme.colors.text, fontSize = 13.sp, style = MaterialTheme.typography.body2, - emoticonSize = 0.9f + emoticonSize = 0.9f, + overflow = TextOverflow.Ellipsis, + maxLines = 4, ) }