fix(home): 팔로잉 empty 문구를 중앙 표시한다
This commit is contained in:
@@ -313,9 +313,9 @@ class HomeMainFragment : BaseFragment<FragmentV2MainHomeBinding>(
|
|||||||
homeFollowingViewModel.followingStateLiveData.observe(viewLifecycleOwner) { state ->
|
homeFollowingViewModel.followingStateLiveData.observe(viewLifecycleOwner) { state ->
|
||||||
when (state) {
|
when (state) {
|
||||||
is HomeFollowingUiState.Content -> bindHomeFollowingContent(state)
|
is HomeFollowingUiState.Content -> bindHomeFollowingContent(state)
|
||||||
|
HomeFollowingUiState.Empty -> bindHomeFollowingEmpty(showEmptyMessage = true)
|
||||||
HomeFollowingUiState.LoginRequired,
|
HomeFollowingUiState.LoginRequired,
|
||||||
HomeFollowingUiState.Empty,
|
is HomeFollowingUiState.Error -> bindHomeFollowingEmpty(showEmptyMessage = false)
|
||||||
is HomeFollowingUiState.Error -> bindHomeFollowingEmpty()
|
|
||||||
|
|
||||||
HomeFollowingUiState.Loading -> Unit
|
HomeFollowingUiState.Loading -> Unit
|
||||||
}
|
}
|
||||||
@@ -378,6 +378,7 @@ class HomeMainFragment : BaseFragment<FragmentV2MainHomeBinding>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun bindHomeFollowingContent(content: HomeFollowingUiState.Content) {
|
private fun bindHomeFollowingContent(content: HomeFollowingUiState.Content) {
|
||||||
|
binding.tvHomeFollowingEmpty.visibility = View.GONE
|
||||||
bindFollowingCreatorSection(content.followingCreators)
|
bindFollowingCreatorSection(content.followingCreators)
|
||||||
bindFollowingLiveSection(content.onAirLives)
|
bindFollowingLiveSection(content.onAirLives)
|
||||||
bindFollowingChatSection(content.recentChats)
|
bindFollowingChatSection(content.recentChats)
|
||||||
@@ -385,7 +386,8 @@ class HomeMainFragment : BaseFragment<FragmentV2MainHomeBinding>(
|
|||||||
bindFollowingNewsSection(content.recentNews)
|
bindFollowingNewsSection(content.recentNews)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun bindHomeFollowingEmpty() {
|
private fun bindHomeFollowingEmpty(showEmptyMessage: Boolean) {
|
||||||
|
binding.tvHomeFollowingEmpty.visibility = if (showEmptyMessage) View.VISIBLE else View.GONE
|
||||||
binding.llHomeFollowingCreatorsSection.visibility = View.GONE
|
binding.llHomeFollowingCreatorsSection.visibility = View.GONE
|
||||||
binding.llHomeFollowingOnAirSection.visibility = View.GONE
|
binding.llHomeFollowingOnAirSection.visibility = View.GONE
|
||||||
binding.llHomeFollowingRecentChatsSection.visibility = View.GONE
|
binding.llHomeFollowingRecentChatsSection.visibility = View.GONE
|
||||||
|
|||||||
@@ -236,6 +236,17 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="@dimen/spacing_28">
|
android:paddingBottom="@dimen/spacing_28">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_home_following_empty"
|
||||||
|
style="@style/Typography.Body3"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/screen_home_following_empty"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="@color/gray_500"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/ll_home_following_creators_section"
|
android:id="@+id/ll_home_following_creators_section"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -82,9 +82,9 @@ class HomeFollowingFragmentSourceTest {
|
|||||||
|
|
||||||
assertTrue(source.contains("followingStateLiveData.observe(viewLifecycleOwner)"))
|
assertTrue(source.contains("followingStateLiveData.observe(viewLifecycleOwner)"))
|
||||||
assertTrue(source.contains("is HomeFollowingUiState.Content -> bindHomeFollowingContent(state)"))
|
assertTrue(source.contains("is HomeFollowingUiState.Content -> bindHomeFollowingContent(state)"))
|
||||||
|
assertTrue(source.contains("HomeFollowingUiState.Empty -> bindHomeFollowingEmpty(showEmptyMessage = true)"))
|
||||||
assertTrue(source.contains("HomeFollowingUiState.LoginRequired,"))
|
assertTrue(source.contains("HomeFollowingUiState.LoginRequired,"))
|
||||||
assertTrue(source.contains("HomeFollowingUiState.Empty,"))
|
assertTrue(source.contains("is HomeFollowingUiState.Error -> bindHomeFollowingEmpty(showEmptyMessage = false)"))
|
||||||
assertTrue(source.contains("is HomeFollowingUiState.Error -> bindHomeFollowingEmpty()"))
|
|
||||||
assertTrue(source.contains("followingCreatorAdapter.submitItems(emptyList())"))
|
assertTrue(source.contains("followingCreatorAdapter.submitItems(emptyList())"))
|
||||||
assertTrue(source.contains("followingLiveAdapter.submitItems(emptyList())"))
|
assertTrue(source.contains("followingLiveAdapter.submitItems(emptyList())"))
|
||||||
assertTrue(source.contains("followingChatAdapter.submitItems(emptyList())"))
|
assertTrue(source.contains("followingChatAdapter.submitItems(emptyList())"))
|
||||||
@@ -97,6 +97,34 @@ class HomeFollowingFragmentSourceTest {
|
|||||||
assertTrue(source.contains("bindFollowingNewsSection(content.recentNews)"))
|
assertTrue(source.contains("bindFollowingNewsSection(content.recentNews)"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `following empty state shows centered reusable empty string only for all empty content`() {
|
||||||
|
val layout = homeMainLayoutSource()
|
||||||
|
val emptyText = layout.substringAfter("@+id/tv_home_following_empty")
|
||||||
|
.substringBefore("@+id/ll_home_following_creators_section")
|
||||||
|
val source = homeMainFragmentSource()
|
||||||
|
val strings = projectFile("app/src/main/res/values/strings.xml").readText()
|
||||||
|
val stringsEn = projectFile("app/src/main/res/values-en/strings.xml").readText()
|
||||||
|
val stringsJa = projectFile("app/src/main/res/values-ja/strings.xml").readText()
|
||||||
|
|
||||||
|
assertTrue(layout.contains("@+id/tv_home_following_empty"))
|
||||||
|
assertTrue(emptyText.contains("android:layout_width=\"match_parent\""))
|
||||||
|
assertTrue(emptyText.contains("android:layout_height=\"match_parent\""))
|
||||||
|
assertTrue(emptyText.contains("android:gravity=\"center\""))
|
||||||
|
assertTrue(emptyText.contains("android:textAlignment=\"center\""))
|
||||||
|
assertTrue(emptyText.contains("android:text=\"@string/screen_home_following_empty\""))
|
||||||
|
assertTrue(emptyText.contains("android:visibility=\"gone\""))
|
||||||
|
|
||||||
|
assertTrue(strings.contains("<string name=\"screen_home_following_empty\">아직 팔로잉 소식이 없어요.\\n관심 있는 크리에이터를 팔로우해 보세요.</string>"))
|
||||||
|
assertTrue(stringsEn.contains("<string name=\"screen_home_following_empty\">No following updates yet.\\nFollow creators you are interested in.</string>"))
|
||||||
|
assertTrue(stringsJa.contains("<string name=\"screen_home_following_empty\">フォロー中のお知らせはまだありません。\\n気になるクリエイターをフォローしてみましょう。</string>"))
|
||||||
|
|
||||||
|
assertTrue(source.contains("binding.tvHomeFollowingEmpty.visibility = View.GONE"))
|
||||||
|
assertTrue(source.contains("binding.tvHomeFollowingEmpty.visibility = if (showEmptyMessage) View.VISIBLE else View.GONE"))
|
||||||
|
assertTrue(source.contains("HomeFollowingUiState.Empty -> bindHomeFollowingEmpty(showEmptyMessage = true)"))
|
||||||
|
assertTrue(source.contains("is HomeFollowingUiState.Error -> bindHomeFollowingEmpty(showEmptyMessage = false)"))
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `following adapters bind figma required item fields`() {
|
fun `following adapters bind figma required item fields`() {
|
||||||
val liveAdapter = projectFile(
|
val liveAdapter = projectFile(
|
||||||
|
|||||||
Reference in New Issue
Block a user