Commit f23ec9ee authored by jyx's avatar jyx

代码优化

parent 4776f27b
...@@ -87,12 +87,21 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH ...@@ -87,12 +87,21 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
val adBtn = holder.getView<View>(R.id.unlock) val adBtn = holder.getView<View>(R.id.unlock)
vedioBean?.let { vedioBean?.let {
try { try {
val unlockText = String.format( val unlockText = if (it.adGiveVedioNum > 1) {
"解锁%s·第%d-%d集", String.format(
it.title, "解锁%s·第%d-%d集",
it.unlockIndex + 1, it.title,
it.unlockIndex + it.adGiveVedioNum it.unlockIndex + 1,
) it.unlockIndex + it.adGiveVedioNum
)
} else {
String.format(
"解锁%s·第%d集",
it.title,
it.unlockIndex + 1
)
}
AppConfig.detailDialogUnlockText = unlockText AppConfig.detailDialogUnlockText = unlockText
} catch (e: Exception) { } catch (e: Exception) {
......
...@@ -59,12 +59,20 @@ class NewTxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity4, BaseV ...@@ -59,12 +59,20 @@ class NewTxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity4, BaseV
val adBtn = holder.getView<View>(R.id.unlock) val adBtn = holder.getView<View>(R.id.unlock)
vedioBean?.let { vedioBean?.let {
try { try {
val unlockText = String.format( val unlockText = if (it.adGiveVedioNum > 1) {
"解锁%s·第%d-%d集", String.format(
it.title, "解锁%s·第%d-%d集",
it.unlockIndex + 1, it.title,
it.unlockIndex + it.adGiveVedioNum it.unlockIndex + 1,
) it.unlockIndex + it.adGiveVedioNum
)
} else {
String.format(
"解锁%s·第%d集",
it.title,
it.unlockIndex + 1
)
}
AppConfig.detailDialogUnlockText = unlockText AppConfig.detailDialogUnlockText = unlockText
} catch (e: Exception) { } catch (e: Exception) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment