feat(widget): 랭킹 카드 순위 변동 숨김을 적용한다

This commit is contained in:
2026-06-08 15:22:10 +09:00
parent 4a21827b47
commit 6d980e319b
4 changed files with 119 additions and 6 deletions

View File

@@ -77,6 +77,9 @@ class CreatorRankingCompactCardView @JvmOverloads constructor(
}
private fun bindDelta(item: CreatorRankingItem) {
requireNotNull(deltaGroup).visibility = if (item.showRankChange) View.VISIBLE else View.GONE
if (!item.showRankChange) return
val presentation = CreatorRankingDeltaPresentation.from(item.rankChangeType, item.rankChangeAmount)
applyDeltaContainer(presentation)
requireNotNull(deltaIcon).apply {
@@ -130,7 +133,10 @@ class CreatorRankingCompactCardView @JvmOverloads constructor(
leftMargin = (10 * scale).roundToInt()
topMargin = (70 * scale).roundToInt()
}
requireNotNull(nameText).layoutParams = LayoutParams((165 * scale).roundToInt(), ViewGroup.LayoutParams.WRAP_CONTENT).apply {
requireNotNull(nameText).layoutParams = LayoutParams(
(165 * scale).roundToInt(),
ViewGroup.LayoutParams.WRAP_CONTENT
).apply {
leftMargin = ((size.widthPx - (165 * scale)) / 2f).roundToInt()
topMargin = (145 * scale).roundToInt()
}
@@ -138,7 +144,10 @@ class CreatorRankingCompactCardView @JvmOverloads constructor(
private fun positionSmall(size: CreatorRankingCardSize) {
val scale = size.widthPx / 122f
requireNotNull(rankText).layoutParams = LayoutParams((42 * scale).roundToInt(), (56 * scale).roundToInt()).apply {
requireNotNull(rankText).layoutParams = LayoutParams(
(42 * scale).roundToInt(),
(56 * scale).roundToInt()
).apply {
leftMargin = (8 * scale).roundToInt()
}
findViewById<View>(R.id.ll_creator_ranking_delta).layoutParams = LayoutParams(
@@ -148,7 +157,10 @@ class CreatorRankingCompactCardView @JvmOverloads constructor(
leftMargin = (10 * scale).roundToInt()
topMargin = (49 * scale).roundToInt()
}
requireNotNull(nameText).layoutParams = LayoutParams((102 * scale).roundToInt(), ViewGroup.LayoutParams.WRAP_CONTENT).apply {
requireNotNull(nameText).layoutParams = LayoutParams(
(102 * scale).roundToInt(),
ViewGroup.LayoutParams.WRAP_CONTENT
).apply {
leftMargin = ((size.widthPx - (102 * scale)) / 2f).roundToInt()
topMargin = (98 * scale).roundToInt()
}

View File

@@ -69,6 +69,10 @@ class CreatorRankingHorizontalCardView @JvmOverloads constructor(
}
private fun bindDelta(item: CreatorRankingItem) {
val deltaGroup = findViewById<View>(R.id.ll_creator_ranking_delta)
deltaGroup.visibility = if (item.showRankChange) View.VISIBLE else View.GONE
if (!item.showRankChange) return
val presentation = CreatorRankingDeltaPresentation.from(item.rankChangeType, item.rankChangeAmount)
applyDeltaContainer(presentation)
requireNotNull(deltaIcon).apply {
@@ -101,7 +105,10 @@ class CreatorRankingHorizontalCardView @JvmOverloads constructor(
private fun positionViews(size: CreatorRankingCardSize) {
val scale = size.widthPx / 374f
requireNotNull(rankGroup).layoutParams = LayoutParams((49 * scale).roundToInt(), ViewGroup.LayoutParams.WRAP_CONTENT).apply {
requireNotNull(rankGroup).layoutParams = LayoutParams(
(49 * scale).roundToInt(),
ViewGroup.LayoutParams.WRAP_CONTENT
).apply {
leftMargin = (14 * scale).roundToInt()
topMargin = (14 * scale).roundToInt()
}
@@ -110,7 +117,10 @@ class CreatorRankingHorizontalCardView @JvmOverloads constructor(
leftMargin = (77 * scale).roundToInt()
topMargin = (10 * scale).roundToInt()
}
requireNotNull(nameText).layoutParams = LayoutParams((189 * scale).roundToInt(), ViewGroup.LayoutParams.WRAP_CONTENT).apply {
requireNotNull(nameText).layoutParams = LayoutParams(
(189 * scale).roundToInt(),
ViewGroup.LayoutParams.WRAP_CONTENT
).apply {
leftMargin = (171 * scale).roundToInt()
topMargin = (39 * scale).roundToInt()
}

View File

@@ -77,6 +77,9 @@ class CreatorRankingLargeCardView @JvmOverloads constructor(
}
private fun bindDelta(item: CreatorRankingItem) {
requireNotNull(deltaGroup).visibility = if (item.showRankChange) View.VISIBLE else View.GONE
if (!item.showRankChange) return
val presentation = CreatorRankingDeltaPresentation.from(item.rankChangeType, item.rankChangeAmount)
applyDeltaContainer(presentation)
requireNotNull(deltaIcon).apply {
@@ -114,7 +117,10 @@ class CreatorRankingLargeCardView @JvmOverloads constructor(
topMargin = 0
}
requireNotNull(rankText).applyCreatorRankingRankGradient()
requireNotNull(nameText).layoutParams = LayoutParams((334 * scale).roundToInt(), ViewGroup.LayoutParams.WRAP_CONTENT).apply {
requireNotNull(nameText).layoutParams = LayoutParams(
(334 * scale).roundToInt(),
ViewGroup.LayoutParams.WRAP_CONTENT
).apply {
leftMargin = ((size.widthPx - (334 * scale)) / 2f).roundToInt()
topMargin = (305 * scale).roundToInt()
}