fix(creator): 라이브 empty 배치를 보정한다
This commit is contained in:
@@ -30,7 +30,6 @@ class CreatorChannelLiveFragment : BaseFragment<FragmentCreatorChannelLiveBindin
|
|||||||
private var lastContentLayoutKey: CreatorChannelLiveContentLayoutKey? = null
|
private var lastContentLayoutKey: CreatorChannelLiveContentLayoutKey? = null
|
||||||
private var sortPopup: CreatorChannelSortPopup? = null
|
private var sortPopup: CreatorChannelSortPopup? = null
|
||||||
private var currentContentState: CreatorChannelLiveUiState.Content? = null
|
private var currentContentState: CreatorChannelLiveUiState.Content? = null
|
||||||
private var emptyMinHeight: Int = 0
|
|
||||||
private val creatorId: Long by lazy { arguments?.getLong(ARG_CREATOR_ID) ?: 0L }
|
private val creatorId: Long by lazy { arguments?.getLong(ARG_CREATOR_ID) ?: 0L }
|
||||||
private val host: Host
|
private val host: Host
|
||||||
get() = requireActivity() as Host
|
get() = requireActivity() as Host
|
||||||
@@ -66,10 +65,8 @@ class CreatorChannelLiveFragment : BaseFragment<FragmentCreatorChannelLiveBindin
|
|||||||
viewModel.loadMore()
|
viewModel.loadMore()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onCreatorChannelLiveViewportHeightChanged(minHeight: Int) {
|
@Suppress("UNUSED_PARAMETER")
|
||||||
emptyMinHeight = minHeight.coerceAtLeast(0)
|
fun onCreatorChannelLiveViewportHeightChanged(minHeight: Int) = Unit
|
||||||
applyEmptyMinHeight()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun onCreatorChannelLiveOwnerCtaVisibilityChanged(isVisible: Boolean) = with(binding) {
|
fun onCreatorChannelLiveOwnerCtaVisibilityChanged(isVisible: Boolean) = with(binding) {
|
||||||
val bottomPadding = if (isVisible) {
|
val bottomPadding = if (isVisible) {
|
||||||
@@ -119,16 +116,11 @@ class CreatorChannelLiveFragment : BaseFragment<FragmentCreatorChannelLiveBindin
|
|||||||
layoutCreatorChannelLiveCurrentCard.isVisible = false
|
layoutCreatorChannelLiveCurrentCard.isVisible = false
|
||||||
rvCreatorChannelLiveReplays.isVisible = false
|
rvCreatorChannelLiveReplays.isVisible = false
|
||||||
layoutCreatorChannelLiveEmpty.isVisible = true
|
layoutCreatorChannelLiveEmpty.isVisible = true
|
||||||
applyEmptyMinHeight()
|
|
||||||
tvCreatorChannelLiveErrorMessage.isVisible = false
|
tvCreatorChannelLiveErrorMessage.isVisible = false
|
||||||
btnCreatorChannelLiveRetry.isVisible = false
|
btnCreatorChannelLiveRetry.isVisible = false
|
||||||
host.onCreatorChannelLiveContentChanged()
|
host.onCreatorChannelLiveContentChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun applyEmptyMinHeight() = with(binding) {
|
|
||||||
layoutCreatorChannelLiveEmpty.minimumHeight = emptyMinHeight
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun bindError(state: CreatorChannelLiveUiState.Error) = with(binding) {
|
private fun bindError(state: CreatorChannelLiveUiState.Error) = with(binding) {
|
||||||
currentContentState = null
|
currentContentState = null
|
||||||
lastContentLayoutKey = null
|
lastContentLayoutKey = null
|
||||||
|
|||||||
@@ -199,7 +199,8 @@
|
|||||||
android:id="@+id/layout_creator_channel_live_empty"
|
android:id="@+id/layout_creator_channel_live_empty"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:paddingTop="@dimen/spacing_48"
|
||||||
|
android:paddingBottom="@dimen/spacing_32"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
@@ -211,7 +212,7 @@
|
|||||||
style="@style/Typography.Body3"
|
style="@style/Typography.Body3"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="top|center_horizontal"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/creator_channel_live_empty_message"
|
android:text="@string/creator_channel_live_empty_message"
|
||||||
android:textColor="@color/gray_500" />
|
android:textColor="@color/gray_500" />
|
||||||
|
|||||||
@@ -65,16 +65,33 @@ class CreatorChannelLiveFragmentLayoutTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `라이브 empty container 최소 높이는 Activity가 전달한 viewport 높이를 사용한다`() {
|
fun `라이브 empty 상태는 추가 스크롤 영역을 만들지 않도록 minimumHeight를 사용하지 않는다`() {
|
||||||
val fragment = projectFile(
|
val fragment = projectFile(
|
||||||
"app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/live/CreatorChannelLiveFragment.kt"
|
"app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/live/CreatorChannelLiveFragment.kt"
|
||||||
).readText()
|
).readText()
|
||||||
|
|
||||||
assertTrue(fragment.contains("private var emptyMinHeight: Int = 0"))
|
|
||||||
assertTrue(fragment.contains("fun onCreatorChannelLiveViewportHeightChanged(minHeight: Int)"))
|
assertTrue(fragment.contains("fun onCreatorChannelLiveViewportHeightChanged(minHeight: Int)"))
|
||||||
assertTrue(fragment.contains("emptyMinHeight = minHeight.coerceAtLeast(0)"))
|
assertTrue(fragment.contains("@Suppress(\"UNUSED_PARAMETER\")"))
|
||||||
assertTrue(fragment.contains("layoutCreatorChannelLiveEmpty.minimumHeight = emptyMinHeight"))
|
assertFalse(fragment.contains("private var emptyMinHeight: Int = 0"))
|
||||||
assertTrue(fragment.contains("applyEmptyMinHeight()"))
|
assertFalse(fragment.contains("layoutCreatorChannelLiveEmpty.minimumHeight"))
|
||||||
|
assertFalse(fragment.contains("applyEmptyMinHeight()"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `라이브 empty 문구는 스크롤 없이 보이도록 상단 가시 영역에 배치한다`() {
|
||||||
|
val layout = projectFile("app/src/main/res/layout/fragment_creator_channel_live.xml").readText()
|
||||||
|
|
||||||
|
assertTrue(layout.contains("android:id=\"@+id/layout_creator_channel_live_empty\""))
|
||||||
|
assertTrue(layout.contains("android:paddingTop=\"@dimen/spacing_48\""))
|
||||||
|
assertTrue(layout.contains("android:layout_gravity=\"top|center_horizontal\""))
|
||||||
|
assertFalse(
|
||||||
|
layout.contains(
|
||||||
|
"android:id=\"@+id/layout_creator_channel_live_empty\"" +
|
||||||
|
"\n android:layout_width=\"0dp\"" +
|
||||||
|
"\n android:layout_height=\"wrap_content\"" +
|
||||||
|
"\n android:gravity=\"center\""
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user