From dca06cdc3c8f450125b330866dd1164a8c689376 Mon Sep 17 00:00:00 2001 From: klaus Date: Fri, 5 Jun 2026 13:16:59 +0900 Subject: [PATCH] =?UTF-8?q?feat(home):=20=EC=9D=B8=EA=B8=B0=20=EC=BB=A4?= =?UTF-8?q?=EB=AE=A4=EB=8B=88=ED=8B=B0=20=EC=84=B9=EC=85=98=EC=9D=84=20?= =?UTF-8?q?=EB=B0=94=EC=9D=B8=EB=94=A9=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sodalive/v2/main/HomeMainFragment.kt | 75 ++++++++++++++++++- .../main/res/layout/fragment_v2_main_home.xml | 7 +- 2 files changed, 78 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/kr/co/vividnext/sodalive/v2/main/HomeMainFragment.kt b/app/src/main/java/kr/co/vividnext/sodalive/v2/main/HomeMainFragment.kt index d18dab87..0cf3939f 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/v2/main/HomeMainFragment.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/v2/main/HomeMainFragment.kt @@ -19,7 +19,9 @@ import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationGenreCreato import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationGenreCreatorSection import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationLiveSection import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationLiveUiModel +import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationPaidStatus import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationPopularCommunityPostSection +import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationPopularCommunityPostUiModel import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationRecentlyActiveCreatorSection import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationRecentlyActiveCreatorUiModel import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationRecentDebutCreatorSection @@ -32,10 +34,12 @@ import kr.co.vividnext.sodalive.v2.main.home.ui.HomeCheerCreatorAdapter import kr.co.vividnext.sodalive.v2.main.home.ui.HomeFirstAudioAdapter import kr.co.vividnext.sodalive.v2.main.home.ui.HomeGenreCreatorAdapter import kr.co.vividnext.sodalive.v2.main.home.ui.HomeLiveAdapter +import kr.co.vividnext.sodalive.v2.main.home.ui.HomePopularCommunityAdapter import kr.co.vividnext.sodalive.v2.main.home.ui.HomeRecentActivityCreatorAdapter import kr.co.vividnext.sodalive.v2.main.home.ui.HomeRecentDebutCreatorAdapter import kr.co.vividnext.sodalive.v2.widget.AudioContentTag import kr.co.vividnext.sodalive.v2.widget.characterchatthumbnail.CharacterChatThumbnailItem +import kr.co.vividnext.sodalive.v2.widget.feed.FeedItem class HomeMainFragment : BaseFragment( FragmentV2MainHomeBinding::inflate @@ -47,6 +51,7 @@ class HomeMainFragment : BaseFragment( private val aiCharacterAdapter = HomeAiCharacterAdapter() private val genreCreatorAdapter = HomeGenreCreatorAdapter { creatorIds -> onGenreFollowAllClick(creatorIds) } private val cheerCreatorAdapter = HomeCheerCreatorAdapter { creatorIds -> onCheerFollowAllClick(creatorIds) } + private val popularCommunityAdapter = HomePopularCommunityAdapter { } private var bannerBinder: HomeBannerBinder? = null private var onGenreFollowAllClick: (List) -> Unit = {} private var onCheerFollowAllClick: (List) -> Unit = {} @@ -82,6 +87,10 @@ class HomeMainFragment : BaseFragment( layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) adapter = cheerCreatorAdapter } + binding.rvHomePopularCommunityPosts.apply { + layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) + adapter = popularCommunityAdapter + } } private fun bindHomeRecommendationContent(content: HomeRecommendationUiState.Content) { @@ -139,6 +148,7 @@ class HomeMainFragment : BaseFragment( private fun bindPopularCommunitySection(section: HomeRecommendationPopularCommunityPostSection) { binding.llHomePopularCommunitySection.visibility = section.items.toSectionVisibility() + popularCommunityAdapter.submitSection(section) } private fun setUpSectionTitles() { @@ -241,9 +251,72 @@ class HomeMainFragment : BaseFragment( ) ), cheerCreators = HomeRecommendationCheerCreatorSection(sampleCreators(701L, count = 8)), - popularCommunityPosts = HomeRecommendationPopularCommunityPostSection(emptyList()) + popularCommunityPosts = HomeRecommendationPopularCommunityPostSection(samplePopularCommunityPosts()) ) + private fun samplePopularCommunityPosts(): List { + return listOf( + samplePopularCommunityPost( + id = 801L, + creatorName = "소다", + bodyText = "무료 커뮤니티 게시글 샘플입니다. 이미지 영역과 본문, 댓글/좋아요 영역을 함께 확인합니다.", + imageUrl = "https://picsum.photos/seed/sodalive-community-free/692/472", + price = 0, + existOrdered = false, + paidStatus = HomeRecommendationPaidStatus.Free + ), + samplePopularCommunityPost( + id = 802L, + creatorName = "라임", + bodyText = "유료 미구매 커뮤니티 게시글 샘플입니다. 원본 이미지는 로드하지 않고 lock overlay와 가격만 표시합니다.", + imageUrl = "https://picsum.photos/seed/sodalive-community-locked/692/472", + price = 30, + existOrdered = false, + paidStatus = HomeRecommendationPaidStatus.Paid(30) + ), + samplePopularCommunityPost( + id = 803L, + creatorName = "하루", + bodyText = "구매 완료 커뮤니티 게시글 샘플입니다. 유료지만 overlay 없이 이미지를 표시합니다.", + imageUrl = "https://picsum.photos/seed/sodalive-community-purchased/692/472", + price = 50, + existOrdered = true, + paidStatus = HomeRecommendationPaidStatus.Purchased + ) + ) + } + + private fun samplePopularCommunityPost( + id: Long, + creatorName: String, + bodyText: String, + imageUrl: String, + price: Int, + existOrdered: Boolean, + paidStatus: HomeRecommendationPaidStatus + ): HomeRecommendationPopularCommunityPostUiModel { + return HomeRecommendationPopularCommunityPostUiModel( + item = FeedItem.Community( + feedId = "sample-community-$id", + creatorId = "sample-creator-$id", + creatorName = creatorName, + creatorImageUrl = "", + postId = id.toString(), + bodyText = bodyText, + keywordText = "", + createdAtText = "방금", + commentCount = 5, + likeCount = 12, + imageUrl = imageUrl, + audioUrl = "https://example.com/sample-community-$id.m4a", + price = price, + existOrdered = existOrdered, + showKeyword = false + ), + paidStatus = paidStatus + ) + } + private fun sampleCreators(startId: Long, count: Int = 3): List { return List(count) { index -> HomeRecommendationCreatorUiModel(startId + index, "크리에이터${index + 1}", null) diff --git a/app/src/main/res/layout/fragment_v2_main_home.xml b/app/src/main/res/layout/fragment_v2_main_home.xml index e97d1d10..39ea7ca3 100644 --- a/app/src/main/res/layout/fragment_v2_main_home.xml +++ b/app/src/main/res/layout/fragment_v2_main_home.xml @@ -210,9 +210,10 @@