fix:修复已解锁后文案展示问题

This commit is contained in:
Max
2024-01-31 16:16:49 +08:00
parent c2cdd5d6f1
commit e2cf045ab7

View File

@@ -68,20 +68,7 @@ class GiftUnLockInfoAdapter(list: List<UnlockItem>) :
} else {
helper.setBackgroundRes(R.id.layout_root, R.drawable.shape_14ffffff_4dp)
}
var unlockItem: UnLockGiftInfo? = null
if (item is UnLockGiftInfo) {
unlockItem = item
}
val total = unlockItem?.condition ?: 0
helper.getView<ImageView>(R.id.iv_cover).load(giftInfo?.giftUrl)
val nameView = helper.getView<TextView>(R.id.tv_name)
SpannableTextBuilder(nameView)
.appendText("送出")
.appendText(
" ${total}",
textColor = nameView.context.getColorById(R.color.color_FFDA24)
)
.appendText("${baseGiftName ?: ""}可解锁").apply()
convertChildState(helper, item)
}
}
@@ -100,13 +87,24 @@ class GiftUnLockInfoAdapter(list: List<UnlockItem>) :
helper.setText(R.id.tv_count, "$progress/$total")
val lockIconView = helper.getView<View>(R.id.iv_lock)
val alpha: Float
val lockText: String
if (unlockItem?.unlocked == true) {
alpha = 1f
lockIconView.isVisible = false
lockText = "已解锁"
} else {
alpha = 0.5f
lockIconView.isVisible = true
lockText = "可解锁"
}
val nameView = helper.getView<TextView>(R.id.tv_name)
SpannableTextBuilder(nameView)
.appendText("送出")
.appendText(
" ${total}",
textColor = nameView.context.getColorById(R.color.color_FFDA24)
)
.appendText("${baseGiftName ?: ""}${lockText}").apply()
helper.setAlpha(R.id.tv_name, alpha)
helper.setAlpha(R.id.iv_cover, alpha)
helper.setAlpha(R.id.tv_count, alpha)