feat(SearchPost): 显示原贴图片

This commit is contained in:
HuanCheng65 2024-01-29 16:38:46 +08:00
parent 7087984b57
commit 972025344d
No known key found for this signature in database
GPG Key ID: 5EC9DD60A32C7360
1 changed files with 9 additions and 2 deletions

View File

@ -63,6 +63,7 @@ import com.huanchengfly.tieba.post.utils.StringUtil
import com.huanchengfly.tieba.post.utils.StringUtil.buildAnnotatedStringWithUser import com.huanchengfly.tieba.post.utils.StringUtil.buildAnnotatedStringWithUser
import com.huanchengfly.tieba.post.utils.appPreferences import com.huanchengfly.tieba.post.utils.appPreferences
import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList import kotlinx.collections.immutable.toImmutableList
import kotlin.math.min import kotlin.math.min
@ -71,6 +72,7 @@ fun QuotePostCard(
quotePostInfo: SearchThreadBean.PostInfo, quotePostInfo: SearchThreadBean.PostInfo,
mainPost: SearchThreadBean.MainPost, mainPost: SearchThreadBean.MainPost,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
medias: ImmutableList<SearchThreadBean.MediaInfo> = persistentListOf(),
keyword: String? = null, keyword: String? = null,
) { ) {
val quoteContentString = remember(quotePostInfo) { val quoteContentString = remember(quotePostInfo) {
@ -93,12 +95,13 @@ fun QuotePostCard(
highlightKeywords = (keyword?.split(" ") ?: emptyList()).toImmutableList() highlightKeywords = (keyword?.split(" ") ?: emptyList()).toImmutableList()
) )
MainPostCard( MainPostCard(
keyword = keyword,
mainPost = mainPost, mainPost = mainPost,
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.clip(RoundedCornerShape(6.dp)) .clip(RoundedCornerShape(6.dp))
.background(ExtendedTheme.colors.card) .background(ExtendedTheme.colors.card),
medias = medias,
keyword = keyword
) )
} }
} }
@ -107,6 +110,7 @@ fun QuotePostCard(
fun MainPostCard( fun MainPostCard(
mainPost: SearchThreadBean.MainPost, mainPost: SearchThreadBean.MainPost,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
medias: ImmutableList<SearchThreadBean.MediaInfo> = persistentListOf(),
keyword: String? = null, keyword: String? = null,
) { ) {
val titleString = remember(mainPost) { val titleString = remember(mainPost) {
@ -137,6 +141,7 @@ fun MainPostCard(
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
) )
} }
SearchMedia(medias = medias)
} }
} }
@ -254,6 +259,7 @@ fun SearchThreadItem(
.clickable { .clickable {
onQuotePostClick(item.postInfo) onQuotePostClick(item.postInfo)
}, },
medias = item.media.toImmutableList(),
keyword = searchKeyword keyword = searchKeyword
) )
} else { } else {
@ -266,6 +272,7 @@ fun SearchThreadItem(
.clickable { .clickable {
onMainPostClick(item.mainPost) onMainPostClick(item.mainPost)
}, },
medias = item.media.toImmutableList(),
keyword = searchKeyword keyword = searchKeyword
) )
} }