fix 充值界面
This commit is contained in:
parent
c0b7d7e9d0
commit
73f81c0965
|
|
@ -67,15 +67,15 @@ class VIPRechargeAdapter : RecyclerView.Adapter<VIPRechargeAdapter.VIPRechargeVi
|
||||||
holder.cyn.text = context!!.resources.getString(R.string.everyDay)
|
holder.cyn.text = context!!.resources.getString(R.string.everyDay)
|
||||||
|
|
||||||
if (rechargeInfo.grade!![position].days != null) {
|
if (rechargeInfo.grade!![position].days != null) {
|
||||||
val giftDay = rechargeInfo.grade!![position].giftDay ?: 0
|
val giftDay = rechargeInfo.grade?.getOrNull(position)?.giftDay ?: 0
|
||||||
val firstPayGiftDay = rechargeInfo.firstPayGiftDay!!.toInt()
|
val firstPayGiftDay = rechargeInfo.firstPayGiftDay?.toInt()?:0
|
||||||
val notFirstPayGiftDay = rechargeInfo.notFirstPayGiftDay!!.toInt()
|
val notFirstPayGiftDay = rechargeInfo.notFirstPayGiftDay?.toInt()?:0
|
||||||
val totalGiftAmount = giftDay + firstPayGiftDay + notFirstPayGiftDay
|
val totalGiftAmount = giftDay + firstPayGiftDay + notFirstPayGiftDay
|
||||||
when (rechargeInfo.grade!![position].days) {
|
when (rechargeInfo.grade?.getOrNull(position)?.days) {
|
||||||
30 -> {
|
30 -> {
|
||||||
holder.tvDayTxt.text = context!!.resources.getString(R.string.price30)
|
holder.tvDayTxt.text = context!!.resources.getString(R.string.price30)
|
||||||
if (rechargeInfo.grade!![position].amount != null) {
|
if (rechargeInfo.grade?.getOrNull(position)?.amount != null) {
|
||||||
val data = rechargeInfo.grade!![position].amount!!.toDouble()
|
val data = rechargeInfo.grade?.getOrNull(position)?.amount!!.toDouble()
|
||||||
.div(30 + totalGiftAmount)
|
.div(30 + totalGiftAmount)
|
||||||
val tempStr = String.format("%.2f", data)
|
val tempStr = String.format("%.2f", data)
|
||||||
holder.tvDayAverage.text =
|
holder.tvDayAverage.text =
|
||||||
|
|
@ -86,8 +86,8 @@ class VIPRechargeAdapter : RecyclerView.Adapter<VIPRechargeAdapter.VIPRechargeVi
|
||||||
|
|
||||||
90 -> {
|
90 -> {
|
||||||
holder.tvDayTxt.text = context!!.resources.getString(R.string.price90)
|
holder.tvDayTxt.text = context!!.resources.getString(R.string.price90)
|
||||||
if (rechargeInfo.grade!![position].amount != null) {
|
if (rechargeInfo.grade?.getOrNull(position)?.amount != null) {
|
||||||
val data = rechargeInfo.grade!![position].amount!!.toDouble()
|
val data = rechargeInfo.grade?.getOrNull(position)?.amount!!.toDouble()
|
||||||
.div(90 + totalGiftAmount)
|
.div(90 + totalGiftAmount)
|
||||||
val tempStr = String.format("%.2f", data)
|
val tempStr = String.format("%.2f", data)
|
||||||
holder.tvDayAverage.text =
|
holder.tvDayAverage.text =
|
||||||
|
|
@ -97,8 +97,8 @@ class VIPRechargeAdapter : RecyclerView.Adapter<VIPRechargeAdapter.VIPRechargeVi
|
||||||
|
|
||||||
180 -> {
|
180 -> {
|
||||||
holder.tvDayTxt.text = context!!.resources.getString(R.string.price180)
|
holder.tvDayTxt.text = context!!.resources.getString(R.string.price180)
|
||||||
if (rechargeInfo.grade!![position].amount != null) {
|
if (rechargeInfo.grade?.getOrNull(position)?.amount != null) {
|
||||||
val data = rechargeInfo.grade!![position].amount!!.toDouble()
|
val data = rechargeInfo.grade?.getOrNull(position)?.amount!!.toDouble()
|
||||||
.div(180 + totalGiftAmount)
|
.div(180 + totalGiftAmount)
|
||||||
val tempStr = String.format("%.2f", data)
|
val tempStr = String.format("%.2f", data)
|
||||||
holder.tvDayAverage.text =
|
holder.tvDayAverage.text =
|
||||||
|
|
@ -108,8 +108,8 @@ class VIPRechargeAdapter : RecyclerView.Adapter<VIPRechargeAdapter.VIPRechargeVi
|
||||||
|
|
||||||
365 -> {
|
365 -> {
|
||||||
holder.tvDayTxt.text = context!!.resources.getString(R.string.price365)
|
holder.tvDayTxt.text = context!!.resources.getString(R.string.price365)
|
||||||
if (rechargeInfo.grade!![position].amount != null) {
|
if (rechargeInfo.grade?.getOrNull(position)?.amount != null) {
|
||||||
val data = rechargeInfo.grade!![position].amount!!.toDouble()
|
val data = rechargeInfo.grade?.getOrNull(position)?.amount!!.toDouble()
|
||||||
.div(365 + totalGiftAmount)
|
.div(365 + totalGiftAmount)
|
||||||
val tempStr = String.format("%.2f", data)
|
val tempStr = String.format("%.2f", data)
|
||||||
holder.tvDayAverage.text =
|
holder.tvDayAverage.text =
|
||||||
|
|
@ -118,10 +118,10 @@ class VIPRechargeAdapter : RecyclerView.Adapter<VIPRechargeAdapter.VIPRechargeVi
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
val days = rechargeInfo.grade!![position].days
|
val days = rechargeInfo.grade?.getOrNull(position)?.days
|
||||||
holder.tvDayTxt.text = "$days" + context!!.resources.getString(R.string.day)
|
holder.tvDayTxt.text = "$days" + context!!.resources.getString(R.string.day)
|
||||||
if (rechargeInfo.grade!![position].amount != null) {
|
if (rechargeInfo.grade?.getOrNull(position)?.amount != null) {
|
||||||
val data = rechargeInfo.grade!![position].amount!!.toDouble()
|
val data = rechargeInfo.grade?.getOrNull(position)?.amount!!.toDouble()
|
||||||
.div(days!! + totalGiftAmount)
|
.div(days!! + totalGiftAmount)
|
||||||
val tempStr = String.format("%.2f", data)
|
val tempStr = String.format("%.2f", data)
|
||||||
holder.tvDayAverage.text =
|
holder.tvDayAverage.text =
|
||||||
|
|
@ -133,19 +133,19 @@ class VIPRechargeAdapter : RecyclerView.Adapter<VIPRechargeAdapter.VIPRechargeVi
|
||||||
if (selectorPosition == position) {
|
if (selectorPosition == position) {
|
||||||
holder.rechargeItemRl.isSelected = true
|
holder.rechargeItemRl.isSelected = true
|
||||||
if (selectorPosition == 0) {
|
if (selectorPosition == 0) {
|
||||||
listener?.onItemClick(rechargeInfo.grade!![position])
|
listener?.onItemClick(rechargeInfo.grade?.getOrNull(position))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
holder.rechargeItemRl.isSelected = false
|
holder.rechargeItemRl.isSelected = false
|
||||||
}
|
}
|
||||||
holder.rechargeItemRl.setOnClickListener {
|
holder.rechargeItemRl.setOnClickListener {
|
||||||
Log.i("TESSS position:${position}")
|
Log.i("TESSS position:${position}")
|
||||||
listener?.onItemClick(rechargeInfo.grade!![position])
|
listener?.onItemClick(rechargeInfo.grade?.getOrNull(position))
|
||||||
selectorPosition = position
|
selectorPosition = position
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rechargeInfo.grade!![position].giftDay != null && rechargeInfo.firstPayGiftDay != null && rechargeInfo.notFirstPayGiftDay != null) {
|
if (rechargeInfo.grade?.getOrNull(position)?.giftDay != null && rechargeInfo.firstPayGiftDay != null && rechargeInfo.notFirstPayGiftDay != null) {
|
||||||
if (totalGiftAmount > 0) {
|
if (totalGiftAmount > 0) {
|
||||||
holder.clRandomlySend.visibility = View.VISIBLE
|
holder.clRandomlySend.visibility = View.VISIBLE
|
||||||
holder.tvRandomlySend.text =
|
holder.tvRandomlySend.text =
|
||||||
|
|
@ -161,11 +161,11 @@ class VIPRechargeAdapter : RecyclerView.Adapter<VIPRechargeAdapter.VIPRechargeVi
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(rechargeInfo.grade!=null){
|
// if(rechargeInfo.grade!=null){
|
||||||
// holder.tvDayAverage.text=" ¥${rechargeInfo.grade!![position].amount}"
|
// holder.tvDayAverage.text=" ¥${rechargeInfo.grade?.getOrNull(position)?.amount}"
|
||||||
// if(rechargeInfo.grade!![position].days!=null){
|
// if(rechargeInfo.grade?.getOrNull(position)?.days!=null){
|
||||||
// holder.tvDiscount.text=" ¥"+context!!.resources.getString(R.string.Discount).replace("$","${rechargeInfo.grade!![position].monthlyAmount}")
|
// holder.tvDiscount.text=" ¥"+context!!.resources.getString(R.string.Discount).replace("$","${rechargeInfo.grade?.getOrNull(position)?.monthlyAmount}")
|
||||||
// if(context!=null){
|
// if(context!=null){
|
||||||
// when(rechargeInfo.grade!![position].days){
|
// when(rechargeInfo.grade?.getOrNull(position)?.days){
|
||||||
// 30->{
|
// 30->{
|
||||||
// holder.tvDayTxt.text=context!!.resources.getString(R.string.price30)
|
// holder.tvDayTxt.text=context!!.resources.getString(R.string.price30)
|
||||||
// }
|
// }
|
||||||
|
|
@ -179,7 +179,7 @@ class VIPRechargeAdapter : RecyclerView.Adapter<VIPRechargeAdapter.VIPRechargeVi
|
||||||
// holder.tvDayTxt.text=context!!.resources.getString(R.string.price365)
|
// holder.tvDayTxt.text=context!!.resources.getString(R.string.price365)
|
||||||
// }
|
// }
|
||||||
// else->{
|
// else->{
|
||||||
// holder.tvDayTxt.text="${rechargeInfo.grade!![position].days}"+ context!!.resources.getString(R.string.day)
|
// holder.tvDayTxt.text="${rechargeInfo.grade?.getOrNull(position)?.days}"+ context!!.resources.getString(R.string.day)
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
@ -188,19 +188,19 @@ class VIPRechargeAdapter : RecyclerView.Adapter<VIPRechargeAdapter.VIPRechargeVi
|
||||||
// if(selectorPosition == position){
|
// if(selectorPosition == position){
|
||||||
// holder.rechargeItemRl.isSelected = true
|
// holder.rechargeItemRl.isSelected = true
|
||||||
// if(selectorPosition==0){
|
// if(selectorPosition==0){
|
||||||
// listener?.onItemClick(rechargeInfo.grade!![position])
|
// listener?.onItemClick(rechargeInfo.grade?.getOrNull(position))
|
||||||
// }
|
// }
|
||||||
// }else{
|
// }else{
|
||||||
// holder.rechargeItemRl.isSelected = false
|
// holder.rechargeItemRl.isSelected = false
|
||||||
// }
|
// }
|
||||||
// holder.rechargeItemRl.setOnClickListener {
|
// holder.rechargeItemRl.setOnClickListener {
|
||||||
// Log.i("TESSS position:${position}")
|
// Log.i("TESSS position:${position}")
|
||||||
// listener?.onItemClick(rechargeInfo.grade!![position])
|
// listener?.onItemClick(rechargeInfo.grade?.getOrNull(position))
|
||||||
// selectorPosition=position
|
// selectorPosition=position
|
||||||
// notifyDataSetChanged()
|
// notifyDataSetChanged()
|
||||||
// }
|
// }
|
||||||
// if(rechargeInfo.grade!![position].giftDay!=null&&rechargeInfo.firstPayGiftDay!=null&&rechargeInfo.notFirstPayGiftDay!=null){
|
// if(rechargeInfo.grade?.getOrNull(position)?.giftDay!=null&&rechargeInfo.firstPayGiftDay!=null&&rechargeInfo.notFirstPayGiftDay!=null){
|
||||||
// val giftDay =rechargeInfo.grade!![position].giftDay?:0
|
// val giftDay =rechargeInfo.grade?.getOrNull(position)?.giftDay?:0
|
||||||
// val firstPayGiftDay =rechargeInfo.firstPayGiftDay!!.toInt()
|
// val firstPayGiftDay =rechargeInfo.firstPayGiftDay!!.toInt()
|
||||||
// val notFirstPayGiftDay =rechargeInfo.notFirstPayGiftDay!!.toInt()
|
// val notFirstPayGiftDay =rechargeInfo.notFirstPayGiftDay!!.toInt()
|
||||||
// val totalGiftAmount=giftDay+firstPayGiftDay+notFirstPayGiftDay
|
// val totalGiftAmount=giftDay+firstPayGiftDay+notFirstPayGiftDay
|
||||||
|
|
@ -219,6 +219,6 @@ class VIPRechargeAdapter : RecyclerView.Adapter<VIPRechargeAdapter.VIPRechargeVi
|
||||||
* 内置监听回调
|
* 内置监听回调
|
||||||
* */
|
* */
|
||||||
interface VIPRechargeItemClickListener {
|
interface VIPRechargeItemClickListener {
|
||||||
fun onItemClick(noteItem: Grade)
|
fun onItemClick(noteItem: Grade?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue