From ac5998d8405a849325420d01171da44e7f9c88b9 Mon Sep 17 00:00:00 2001 From: HuanCheng65 <22636177+HuanCheng65@users.noreply.github.com> Date: Sat, 11 Mar 2023 00:12:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E7=89=88=E8=B4=B4=E5=AD=90=20?= =?UTF-8?q?-=20=E7=9C=8B=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tieba/post/ui/utils/PhotoViewUtils.kt | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/utils/PhotoViewUtils.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/utils/PhotoViewUtils.kt index 5ab1b52a..62a08c1b 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/utils/PhotoViewUtils.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/utils/PhotoViewUtils.kt @@ -1,11 +1,44 @@ package com.huanchengfly.tieba.post.ui.utils +import com.huanchengfly.tieba.post.api.models.protos.Post import com.huanchengfly.tieba.post.api.models.protos.ThreadInfo import com.huanchengfly.tieba.post.models.protos.LoadPicPageData import com.huanchengfly.tieba.post.models.protos.PhotoViewData import com.huanchengfly.tieba.post.models.protos.PicItem import com.huanchengfly.tieba.post.utils.ImageUtil +fun getPhotoViewData( + post: Post, + picId: String, + picUrl: String, + originUrl: String, + showOriginBtn: Boolean, + originSize: Int +): PhotoViewData? { + if (post.from_forum == null) return null + return PhotoViewData( + data_ = LoadPicPageData( + forumId = post.from_forum.id, + forumName = post.from_forum.name, + threadId = post.tid, + postId = post.id, + objType = "pb", + picId = picId, + picIndex = 1 + ), + picItems = listOf( + PicItem( + picId = picId, + picIndex = 1, + url = picUrl, + originUrl = originUrl, + showOriginBtn = showOriginBtn, + originSize = originSize + ) + ) + ) +} + fun getPhotoViewData( threadInfo: ThreadInfo, index: Int