feat(content): 랭킹 변동 숨김 처리를 추가한다

This commit is contained in:
2026-06-24 13:35:03 +09:00
parent b858003b6d
commit 8bc1ec5830
4 changed files with 116 additions and 5 deletions

View File

@@ -80,6 +80,9 @@ open class ContentRankingGridCardView @JvmOverloads constructor(
}
private fun bindDelta(item: ContentRankingItem) {
requireNotNull(deltaGroup).visibility = if (item.showRankChange) View.VISIBLE else View.GONE
if (!item.showRankChange) return
val presentation = ContentRankingDeltaPresentation.from(item.rankChangeType, item.rankChangeAmount)
applyDeltaContainer(presentation)
requireNotNull(deltaIcon).apply {
@@ -150,7 +153,10 @@ open class ContentRankingGridCardView @JvmOverloads constructor(
}
private fun placeLabel(width: Int, top: Int, scale: Float, size: ContentRankingCardSize) {
findViewById<View>(R.id.ll_content_ranking_label).layoutParams = LayoutParams((width * scale).roundToInt(), ViewGroup.LayoutParams.WRAP_CONTENT).apply {
findViewById<View>(R.id.ll_content_ranking_label).layoutParams = LayoutParams(
(width * scale).roundToInt(),
ViewGroup.LayoutParams.WRAP_CONTENT
).apply {
leftMargin = ((size.widthPx - (width * scale)) / 2f).roundToInt()
topMargin = (top * scale).roundToInt()
}

View File

@@ -79,6 +79,10 @@ class ContentRankingHorizontalCardView @JvmOverloads constructor(
}
private fun bindDelta(item: ContentRankingItem) {
val deltaGroup = findViewById<View>(R.id.ll_content_ranking_delta)
deltaGroup.visibility = if (item.showRankChange) View.VISIBLE else View.GONE
if (!item.showRankChange) return
val presentation = ContentRankingDeltaPresentation.from(item.rankChangeType, item.rankChangeAmount)
applyDeltaContainer(presentation)
requireNotNull(deltaIcon).apply {
@@ -111,7 +115,10 @@ class ContentRankingHorizontalCardView @JvmOverloads constructor(
private fun positionViews(size: ContentRankingCardSize) {
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()
}
@@ -120,11 +127,17 @@ class ContentRankingHorizontalCardView @JvmOverloads constructor(
leftMargin = (77 * scale).roundToInt()
topMargin = (10 * scale).roundToInt()
}
findViewById<View>(R.id.ll_content_ranking_label).layoutParams = LayoutParams((189 * scale).roundToInt(), ViewGroup.LayoutParams.WRAP_CONTENT).apply {
findViewById<View>(R.id.ll_content_ranking_label).layoutParams = LayoutParams(
(189 * scale).roundToInt(),
ViewGroup.LayoutParams.WRAP_CONTENT
).apply {
leftMargin = (171 * scale).roundToInt()
topMargin = (31 * scale).roundToInt()
}
requireNotNull(inaccessibleText).layoutParams = LayoutParams((189 * scale).roundToInt(), ViewGroup.LayoutParams.WRAP_CONTENT).apply {
requireNotNull(inaccessibleText).layoutParams = LayoutParams(
(189 * scale).roundToInt(),
ViewGroup.LayoutParams.WRAP_CONTENT
).apply {
leftMargin = (171 * scale).roundToInt()
topMargin = (38 * scale).roundToInt()
}

View File

@@ -84,6 +84,9 @@ class ContentRankingLargeCardView @JvmOverloads constructor(
}
private fun bindDelta(item: ContentRankingItem) {
requireNotNull(deltaGroup).visibility = if (item.showRankChange) View.VISIBLE else View.GONE
if (!item.showRankChange) return
val presentation = ContentRankingDeltaPresentation.from(item.rankChangeType, item.rankChangeAmount)
applyDeltaContainer(presentation)
requireNotNull(deltaIcon).apply {
@@ -128,7 +131,10 @@ class ContentRankingLargeCardView @JvmOverloads constructor(
leftMargin = (20 * scale).roundToInt()
topMargin = (109 * scale).roundToInt()
}
findViewById<View>(R.id.ll_content_ranking_label).layoutParams = LayoutParams((165 * scale).roundToInt(), ViewGroup.LayoutParams.WRAP_CONTENT).apply {
findViewById<View>(R.id.ll_content_ranking_label).layoutParams = LayoutParams(
(165 * scale).roundToInt(),
ViewGroup.LayoutParams.WRAP_CONTENT
).apply {
leftMargin = ((size.widthPx - (165 * scale)) / 2f).roundToInt()
topMargin = (182 * scale).roundToInt()
}