feat(home): 최근 데뷔 크리에이터 카드를 정리한다

This commit is contained in:
2026-06-02 17:28:40 +09:00
parent 089e980832
commit 3028288bb3
5 changed files with 74 additions and 14 deletions

View File

@@ -20,7 +20,7 @@ class HomeRecentDebutCreatorAdapter : RecyclerView.Adapter<HomeRecentDebutCreato
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CreatorViewHolder {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_home_recent_debut_creator, parent, false)
view.layoutParams = recyclerItemLayoutParams(parent)
view.layoutParams = recentDebutItemLayoutParams(parent)
return CreatorViewHolder(view)
}
@@ -39,4 +39,11 @@ class HomeRecentDebutCreatorAdapter : RecyclerView.Adapter<HomeRecentDebutCreato
nicknameText.text = item.nickname
}
}
private fun recentDebutItemLayoutParams(parent: ViewGroup): RecyclerView.LayoutParams {
return RecyclerView.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
).apply { marginEnd = parent.resources.getDimensionPixelSize(R.dimen.spacing_4) }
}
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/gray_900" />
<corners android:radius="@dimen/radius_14" />
</shape>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="270"
android:startColor="#00000000"
android:centerColor="#00000000"
android:centerY="0.64"
android:endColor="#B3000000" />
<corners android:radius="@dimen/radius_14" />
</shape>

View File

@@ -1,30 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="112dp"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
android:layout_width="205dp"
android:layout_height="259dp"
android:background="@drawable/bg_home_recent_debut_card"
android:outlineProvider="background">
<ImageView
android:id="@+id/iv_home_recent_debut_creator_profile"
android:layout_width="88dp"
android:layout_height="88dp"
android:background="@drawable/bg_round_corner_999_263238"
android:layout_width="205dp"
android:layout_height="259dp"
android:contentDescription="@null"
android:scaleType="centerCrop"
tools:src="@drawable/ic_launcher_background" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_home_recent_debut_dim_gradient" />
<TextView
android:id="@+id/tv_home_recent_debut_creator_nickname"
style="@style/Typography.Body5"
style="@style/Typography.Heading1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_8"
android:layout_gravity="bottom"
android:layout_marginHorizontal="@dimen/spacing_14"
android:layout_marginBottom="31dp"
android:ellipsize="end"
android:gravity="center"
android:includeFontPadding="false"
android:lineSpacingMultiplier="1.45"
android:maxLines="1"
android:textAlignment="center"
android:textColor="@color/white"
tools:text="신규 크리에이터" />
</LinearLayout>
</FrameLayout>

View File

@@ -3,6 +3,7 @@ package kr.co.vividnext.sodalive.v2.main.home
import android.app.Application
import android.content.Context
import android.graphics.drawable.ColorDrawable
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -16,6 +17,7 @@ import androidx.test.core.app.ApplicationProvider
import kr.co.vividnext.sodalive.R
import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationLiveUiModel
import kr.co.vividnext.sodalive.v2.main.home.ui.HomeLiveAdapter
import kr.co.vividnext.sodalive.v2.main.home.ui.HomeRecentDebutCreatorAdapter
import kr.co.vividnext.sodalive.v2.widget.TextTabBarView
import kr.co.vividnext.sodalive.v2.widget.banner.BannerView
import org.junit.Assert.assertEquals
@@ -116,6 +118,34 @@ class HomeMainFragmentLayoutTest {
assertEquals(52.dpToPx(), profileImage.layoutParams.height)
}
@Test
fun `recent debut creator item matches figma card dimensions`() {
val recentDebut = inflateViewWithParent(R.layout.item_home_recent_debut_creator)
val profileImage = recentDebut.findViewById<ImageView>(R.id.iv_home_recent_debut_creator_profile)
val nicknameText = recentDebut.findViewById<TextView>(R.id.tv_home_recent_debut_creator_nickname)
assertEquals(205.dpToPx(), recentDebut.layoutParams.width)
assertEquals(259.dpToPx(), recentDebut.layoutParams.height)
assertEquals(205.dpToPx(), profileImage.layoutParams.width)
assertEquals(259.dpToPx(), profileImage.layoutParams.height)
assertEquals(24f, nicknameText.textSize / nicknameText.resources.displayMetrics.scaledDensity)
assertEquals(Gravity.CENTER, nicknameText.gravity)
}
@Test
fun `home recent debut section matches figma list spacing`() {
val root = inflateView(R.layout.fragment_v2_main_home)
val recentDebutList = root.findViewById<RecyclerView>(R.id.rv_home_recent_debut_creators)
val context = ApplicationProvider.getApplicationContext<Context>()
val parent = RecyclerView(context)
parent.layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
val viewHolder = HomeRecentDebutCreatorAdapter().onCreateViewHolder(parent, 0)
val layoutParams = viewHolder.itemView.layoutParams as ViewGroup.MarginLayoutParams
assertEquals(14.dpToPx(), recentDebutList.paddingStart)
assertEquals(4.dpToPx(), layoutParams.marginEnd)
}
@Test
fun `popular community section is hidden until phase7 binding is implemented`() {
val root = inflateView(R.layout.fragment_v2_main_home)
@@ -125,12 +155,12 @@ class HomeMainFragmentLayoutTest {
}
@Test
fun `home live section matches figma row dimensions`() {
fun `home live section height follows its items`() {
val root = inflateView(R.layout.fragment_v2_main_home)
val liveList = root.findViewById<RecyclerView>(R.id.rv_home_lives)
assertNotNull(liveList)
assertEquals(102.dpToPx(), liveList.layoutParams.height)
assertEquals(ViewGroup.LayoutParams.WRAP_CONTENT, liveList.layoutParams.height)
assertEquals(20.dpToPx(), liveList.paddingStart)
}