fix(creator): 커뮤니티 탭 하단 재평가를 보정한다

This commit is contained in:
2026-06-22 14:27:53 +09:00
parent cb5d4f954d
commit 4288e7284b
2 changed files with 33 additions and 18 deletions

View File

@@ -493,8 +493,9 @@ class CreatorChannelActivity :
override fun onCreatorChannelLiveContentChanged() {
updateCreatorChannelTabViewportHeight()
updateViewPagerHeight()
postCheckCreatorChannelCurrentTabNeedsMore()
updateViewPagerHeight {
postCheckCreatorChannelCurrentTabNeedsMore()
}
}
override fun isCreatorChannelOwner(): Boolean = currentHeader?.isOwner == true
@@ -505,8 +506,9 @@ class CreatorChannelActivity :
override fun onCreatorChannelAudioContentChanged() {
updateCreatorChannelTabViewportHeight()
updateViewPagerHeight()
postCheckCreatorChannelCurrentTabNeedsMore()
updateViewPagerHeight {
postCheckCreatorChannelCurrentTabNeedsMore()
}
}
override fun onCreatorChannelSeriesClicked(seriesId: Long) {
@@ -519,13 +521,15 @@ class CreatorChannelActivity :
override fun onCreatorChannelSeriesContentChanged() {
updateCreatorChannelTabViewportHeight()
updateViewPagerHeight()
postCheckCreatorChannelCurrentTabNeedsMore()
updateViewPagerHeight {
postCheckCreatorChannelCurrentTabNeedsMore()
}
}
override fun onCreatorChannelCommunityContentChanged() {
updateViewPagerHeight()
postCheckCreatorChannelCurrentTabNeedsMore()
updateViewPagerHeight {
postCheckCreatorChannelCurrentTabNeedsMore()
}
}
override fun onCreatorChannelCommunityOwnerMoreClicked(item: CreatorChannelCommunityPostUiModel) {
@@ -894,22 +898,27 @@ class CreatorChannelActivity :
}
}
private fun updateViewPagerHeight() {
private fun updateViewPagerHeight(afterHeightUpdated: (() -> Unit)? = null) {
updateCreatorChannelTabViewportHeight()
binding.viewPager.post {
val recyclerView = binding.viewPager.getChildAt(0) as? RecyclerView ?: return@post
val currentPage = recyclerView.layoutManager?.findViewByPosition(binding.viewPager.currentItem) ?: return@post
val recyclerView = binding.viewPager.getChildAt(0) as? RecyclerView
val currentPage = recyclerView?.layoutManager?.findViewByPosition(binding.viewPager.currentItem)
if (currentPage == null) {
afterHeightUpdated?.invoke()
return@post
}
val widthSpec = MeasureSpec.makeMeasureSpec(binding.viewPager.width, MeasureSpec.EXACTLY)
val heightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)
currentPage.measure(widthSpec, heightSpec)
val measuredHeight = currentPage.measuredHeight
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 {
height = targetHeight
if (measuredHeight > 0 && binding.viewPager.layoutParams.height != targetHeight) {
binding.viewPager.updateLayoutParams {
height = targetHeight
}
}
afterHeightUpdated?.invoke()
}
}
@@ -941,12 +950,13 @@ class CreatorChannelActivity :
if (!isCreatorChannelLoadMoreTab(binding.viewPager.currentItem)) return
val contentHeight = binding.nestedScrollView.getChildAt(0)?.height ?: return
val threshold = CREATOR_CHANNEL_LOAD_MORE_THRESHOLD_DP.dpToPx().toInt()
val remainingScroll = calculateCreatorChannelRemainingScroll(
contentHeight = contentHeight,
viewportHeight = binding.nestedScrollView.height,
scrollY = binding.nestedScrollView.scrollY
)
if (remainingScroll <= 0) {
if (remainingScroll <= threshold) {
notifyCurrentCreatorChannelTabScrolledToBottom()
}
}