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