fix(creator): 탭 ViewPager 높이 계산을 보정한다
This commit is contained in:
@@ -731,10 +731,12 @@ class CreatorChannelActivity :
|
|||||||
val heightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)
|
val heightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)
|
||||||
currentPage.measure(widthSpec, heightSpec)
|
currentPage.measure(widthSpec, heightSpec)
|
||||||
val measuredHeight = currentPage.measuredHeight
|
val measuredHeight = currentPage.measuredHeight
|
||||||
if (measuredHeight <= 0 || binding.viewPager.layoutParams.height == measuredHeight) return@post
|
val viewPagerVerticalPadding = binding.viewPager.paddingTop + binding.viewPager.paddingBottom
|
||||||
|
val targetHeight = measuredHeight + viewPagerVerticalPadding
|
||||||
|
if (measuredHeight <= 0 || binding.viewPager.layoutParams.height == targetHeight) return@post
|
||||||
|
|
||||||
binding.viewPager.updateLayoutParams {
|
binding.viewPager.updateLayoutParams {
|
||||||
height = measuredHeight
|
height = targetHeight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -382,6 +382,24 @@ class CreatorChannelActivitySourceTest {
|
|||||||
assertFalse(source.contains("private fun createTabView"))
|
assertFalse(source.contains("private fun createTabView"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `ViewPager 높이 계산은 자체 vertical padding을 포함해 탭 하단 컨텐츠를 자르지 않는다`() {
|
||||||
|
val source = projectFile(
|
||||||
|
"app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/CreatorChannelActivity.kt"
|
||||||
|
).readText()
|
||||||
|
|
||||||
|
assertTrue(
|
||||||
|
source.contains(
|
||||||
|
"val viewPagerVerticalPadding = binding.viewPager.paddingTop + binding.viewPager.paddingBottom"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
assertTrue(source.contains("val targetHeight = measuredHeight + viewPagerVerticalPadding"))
|
||||||
|
assertTrue(source.contains("binding.viewPager.layoutParams.height == targetHeight"))
|
||||||
|
assertTrue(source.contains("height = targetHeight"))
|
||||||
|
assertFalse(source.contains("binding.viewPager.layoutParams.height == measuredHeight"))
|
||||||
|
assertFalse(source.contains("height = measuredHeight"))
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `tab source는 기존 custom tab no op 정책을 제거한다`() {
|
fun `tab source는 기존 custom tab no op 정책을 제거한다`() {
|
||||||
val source = projectFile(
|
val source = projectFile(
|
||||||
|
|||||||
Reference in New Issue
Block a user