fix: vip 时间
This commit is contained in:
@@ -46,26 +46,33 @@ class VipCenterBannerAdapter(
|
||||
override fun onBindView(holder: BannerViewHolder, data: VipInfo, position: Int, size: Int) {
|
||||
//todo do 旧bug 买完VIP不刷新item
|
||||
holder.dueText.visibility = View.GONE
|
||||
myVipInfo?.let {
|
||||
if (it.vipLevel >= data.vipLevel) {
|
||||
var result = getString(R.string.vip_center_8)
|
||||
if (data.remainSeconds>0){
|
||||
val calendar = Calendar.getInstance()
|
||||
calendar.add(Calendar.SECOND, data.remainSeconds)
|
||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH)
|
||||
val formattedDate = dateFormat.format(calendar.time)
|
||||
result = "${getString(R.string.vip_center_2)}$formattedDate"
|
||||
|
||||
if (myVipInfo != null) {
|
||||
myVipInfo.let {
|
||||
if (it.vipLevel >= data.vipLevel) {
|
||||
var result = getString(R.string.vip_center_8)
|
||||
if (data.remainSeconds>0){
|
||||
val calendar = Calendar.getInstance()
|
||||
calendar.add(Calendar.SECOND, data.remainSeconds)
|
||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH)
|
||||
val formattedDate = dateFormat.format(calendar.time)
|
||||
result = "${getString(R.string.vip_center_2)}$formattedDate"
|
||||
}
|
||||
holder.dueText.text = result
|
||||
holder.dueText.visibility = View.VISIBLE
|
||||
} else if (it.vipLevel < data.vipLevel) {
|
||||
holder.dueText.text = getString(R.string.vip_center_8)
|
||||
holder.dueText.visibility = View.VISIBLE
|
||||
} else {
|
||||
holder.dueText.visibility = View.GONE
|
||||
}
|
||||
holder.dueText.text = result
|
||||
holder.dueText.visibility = View.VISIBLE
|
||||
} else if (it.vipLevel < data.vipLevel) {
|
||||
holder.dueText.text = getString(R.string.vip_center_8)
|
||||
holder.dueText.visibility = View.VISIBLE
|
||||
} else {
|
||||
holder.dueText.visibility = View.GONE
|
||||
}
|
||||
}else{
|
||||
holder.dueText.text = getString(R.string.vip_center_8)
|
||||
holder.dueText.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
|
||||
when(position) {
|
||||
0-> {
|
||||
holder.dueText.setTextColor(context.resources.getColor(R.color.color_3A4D14))
|
||||
|
Reference in New Issue
Block a user