联合支付功能调试
This commit is contained in:
@@ -10,19 +10,21 @@ import androidx.core.view.updateLayoutParams
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.chad.library.adapter4.BaseQuickAdapter
|
||||
import com.chad.library.adapter4.viewholder.QuickViewHolder
|
||||
import com.sw.dualscreen.databinding.LayoutFoodListHeaderBinding
|
||||
import com.sw.dualscreen.databinding.ListItemFoodOrderBinding
|
||||
import com.sw.dualscreen.ext.dp
|
||||
import com.sw.dualscreen.ext.format2String
|
||||
import com.sw.dualscreen.ext.gone
|
||||
import com.sw.dualscreen.ext.visible
|
||||
import com.sw.dualscreen.model.response.FoodItem
|
||||
|
||||
class FoodOrderAdapter(var list: MutableList<FoodItem>) :
|
||||
BaseQuickAdapter<FoodItem, FoodOrderAdapter.VH>(list) {
|
||||
|
||||
inner class VH(var binding: LayoutFoodListHeaderBinding) : QuickViewHolder(binding.root)
|
||||
inner class VH(var binding: ListItemFoodOrderBinding) : QuickViewHolder(binding.root)
|
||||
|
||||
override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): VH {
|
||||
val inflater = LayoutInflater.from(context)
|
||||
val binding = LayoutFoodListHeaderBinding.inflate(inflater, parent, false)
|
||||
val binding = ListItemFoodOrderBinding.inflate(inflater, parent, false)
|
||||
return VH(binding)
|
||||
}
|
||||
|
||||
@@ -31,9 +33,20 @@ class FoodOrderAdapter(var list: MutableList<FoodItem>) :
|
||||
val binding = holder.binding
|
||||
item?.let {
|
||||
binding.tvFoodName.text = it.foodName
|
||||
binding.tvPriceNorm.text = it.foodPrice.format2String(2)
|
||||
val foodPrice = it.foodPrice.format2String(2)
|
||||
if (it.orderFrom == 2) {
|
||||
binding.tvPriceNorm.text = "${it.specName}-${it.specWeight}克"
|
||||
} else {
|
||||
binding.tvPriceNorm.text = "${foodPrice}/${it.num}克"
|
||||
}
|
||||
//if (it.specName.isNullOrBlank().not()) {
|
||||
// binding.tvPriceFlag.text = "[${it.specName}]"
|
||||
//}
|
||||
binding.tvWeight.text = "${it.num}克"
|
||||
binding.tvAmount.text = it.price.format2String(2)
|
||||
binding.tvLabel.run {
|
||||
if (it.orderFrom == 2) visible() else gone()
|
||||
}
|
||||
}
|
||||
setTextColor(binding.tvFoodName, binding.tvPriceNorm, binding.tvWeight, binding.tvAmount)
|
||||
binding.root.updateLayoutParams<RecyclerView.LayoutParams> {
|
||||
|
||||
Reference in New Issue
Block a user