fix(feed): 콘텐츠 카드 레이아웃을 보완한다
This commit is contained in:
@@ -35,6 +35,8 @@ class FeedContentView @JvmOverloads constructor(
|
|||||||
titleText = findViewById(R.id.tv_feed_content_title)
|
titleText = findViewById(R.id.tv_feed_content_title)
|
||||||
categoryText = findViewById(R.id.tv_feed_content_category)
|
categoryText = findViewById(R.id.tv_feed_content_category)
|
||||||
createdAtText = findViewById(R.id.tv_feed_content_created_at)
|
createdAtText = findViewById(R.id.tv_feed_content_created_at)
|
||||||
|
clipToOutline = true
|
||||||
|
outlineProvider = roundedOutlineProvider()
|
||||||
contentImageView().clipToOutline = true
|
contentImageView().clipToOutline = true
|
||||||
contentImageView().outlineProvider = roundedOutlineProvider()
|
contentImageView().outlineProvider = roundedOutlineProvider()
|
||||||
profileImageView().clipToOutline = true
|
profileImageView().clipToOutline = true
|
||||||
@@ -105,6 +107,6 @@ class FeedContentView @JvmOverloads constructor(
|
|||||||
private fun Int.dpToPx(): Int = (this * resources.displayMetrics.density).roundToInt()
|
private fun Int.dpToPx(): Int = (this * resources.displayMetrics.density).roundToInt()
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
const val CONTENT_IMAGE_WIDTH_DP = 163
|
const val CONTENT_IMAGE_WIDTH_DP = 88
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,20 +5,19 @@
|
|||||||
android:layout_width="374dp"
|
android:layout_width="374dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/bg_feed_card"
|
android:background="@drawable/bg_feed_card"
|
||||||
android:clipToOutline="true"
|
|
||||||
android:padding="@dimen/spacing_14">
|
android:padding="@dimen/spacing_14">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/fl_feed_content_image_container"
|
android:id="@+id/fl_feed_content_image_container"
|
||||||
android:layout_width="163dp"
|
android:layout_width="88dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="88dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_feed_content_image"
|
android:id="@+id/iv_feed_content_image"
|
||||||
android:layout_width="163dp"
|
android:layout_width="88dp"
|
||||||
android:layout_height="163dp"
|
android:layout_height="88dp"
|
||||||
android:contentDescription="@string/a11y_feed_content_image"
|
android:contentDescription="@string/a11y_feed_content_image"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
tools:src="@drawable/ic_launcher_background" />
|
tools:src="@drawable/ic_launcher_background" />
|
||||||
|
|||||||
@@ -42,6 +42,38 @@ class FeedViewTest {
|
|||||||
assertSame(category.parent, time.parent)
|
assertSame(category.parent, time.parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `content layout matches figma compact upload notice dimensions`() {
|
||||||
|
val layout = projectFile("app/src/main/res/layout/view_feed_content.xml").readText()
|
||||||
|
val source = projectFile(
|
||||||
|
"app/src/main/java/kr/co/vividnext/sodalive/v2/widget/feed/FeedContentView.kt"
|
||||||
|
).readText()
|
||||||
|
val imageBlock = layout.substringAfter("@+id/iv_feed_content_image")
|
||||||
|
.substringBefore("@+id/ll_feed_content_info")
|
||||||
|
val infoBlock = layout.substringAfter("@+id/ll_feed_content_info")
|
||||||
|
.substringBefore("</kr.co.vividnext.sodalive.v2.widget.feed.FeedContentView>")
|
||||||
|
val titleBlock = layout.substringAfter("@+id/tv_feed_content_title")
|
||||||
|
.substringBefore("@+id/ll_feed_content_meta")
|
||||||
|
|
||||||
|
assertTrue(layout.contains("android:padding=\"@dimen/spacing_14\""))
|
||||||
|
assertTrue(imageBlock.contains("android:layout_width=\"88dp\""))
|
||||||
|
assertTrue(imageBlock.contains("android:layout_height=\"88dp\""))
|
||||||
|
assertTrue(infoBlock.contains("android:layout_marginStart=\"@dimen/spacing_14\""))
|
||||||
|
assertTrue(titleBlock.contains("android:layout_marginTop=\"@dimen/spacing_6\""))
|
||||||
|
assertTrue(source.contains("const val CONTENT_IMAGE_WIDTH_DP = 88"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `content root clipping is implemented in custom view code`() {
|
||||||
|
val layout = projectFile("app/src/main/res/layout/view_feed_content.xml").readText()
|
||||||
|
val source = projectFile(
|
||||||
|
"app/src/main/java/kr/co/vividnext/sodalive/v2/widget/feed/FeedContentView.kt"
|
||||||
|
).readText()
|
||||||
|
|
||||||
|
assertFalse(layout.contains("android:clipToOutline"))
|
||||||
|
assertTrue(source.contains(" clipToOutline = true\n outlineProvider = roundedOutlineProvider()"))
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `community can hide empty body row by caller policy`() {
|
fun `community can hide empty body row by caller policy`() {
|
||||||
val view = inflateView<FeedCommunityView>(R.layout.view_feed_community)
|
val view = inflateView<FeedCommunityView>(R.layout.view_feed_community)
|
||||||
|
|||||||
Reference in New Issue
Block a user