diff --git a/app/src/main/java/kr/co/vividnext/sodalive/v2/widget/feed/FeedContentView.kt b/app/src/main/java/kr/co/vividnext/sodalive/v2/widget/feed/FeedContentView.kt index a587aec6..ea842026 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/v2/widget/feed/FeedContentView.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/v2/widget/feed/FeedContentView.kt @@ -35,6 +35,8 @@ class FeedContentView @JvmOverloads constructor( titleText = findViewById(R.id.tv_feed_content_title) categoryText = findViewById(R.id.tv_feed_content_category) createdAtText = findViewById(R.id.tv_feed_content_created_at) + clipToOutline = true + outlineProvider = roundedOutlineProvider() contentImageView().clipToOutline = true contentImageView().outlineProvider = roundedOutlineProvider() profileImageView().clipToOutline = true @@ -105,6 +107,6 @@ class FeedContentView @JvmOverloads constructor( private fun Int.dpToPx(): Int = (this * resources.displayMetrics.density).roundToInt() private companion object { - const val CONTENT_IMAGE_WIDTH_DP = 163 + const val CONTENT_IMAGE_WIDTH_DP = 88 } } diff --git a/app/src/main/res/layout/view_feed_content.xml b/app/src/main/res/layout/view_feed_content.xml index 5095a501..fbf2da78 100644 --- a/app/src/main/res/layout/view_feed_content.xml +++ b/app/src/main/res/layout/view_feed_content.xml @@ -5,20 +5,19 @@ android:layout_width="374dp" android:layout_height="wrap_content" android:background="@drawable/bg_feed_card" - android:clipToOutline="true" android:padding="@dimen/spacing_14"> diff --git a/app/src/test/java/kr/co/vividnext/sodalive/v2/widget/feed/FeedViewTest.kt b/app/src/test/java/kr/co/vividnext/sodalive/v2/widget/feed/FeedViewTest.kt index ab2b10a2..8ea4a9d0 100644 --- a/app/src/test/java/kr/co/vividnext/sodalive/v2/widget/feed/FeedViewTest.kt +++ b/app/src/test/java/kr/co/vividnext/sodalive/v2/widget/feed/FeedViewTest.kt @@ -42,6 +42,38 @@ class FeedViewTest { 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("") + 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 fun `community can hide empty body row by caller policy`() { val view = inflateView(R.layout.view_feed_community)