refs #6574 feat:ui

This commit is contained in:
Sergio De la torre 2024-03-28 08:54:35 +01:00
parent ea305d5812
commit b91712ea9e
1 changed files with 19 additions and 12 deletions

View File

@ -14,7 +14,6 @@ class HistoricoAdapter (
private val items: List<ItemHistoricoVO>
) : RecyclerView.Adapter<HistoricoAdapter.ItemHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
return ItemHolder(
ItemHistoricoRowBinding.inflate(LayoutInflater.from(parent.context), parent, false)
@ -38,14 +37,22 @@ class HistoricoAdapter (
val sdf = SimpleDateFormat(res.getString(R.string.dateFormat))
val currentDate = sdf.format(Date())
historicoDate.setBackgroundColor(ContextCompat.getColor(historicoDate.context, if (currentDate == item.shipped){R.color.verdnatura_pumpkin_orange}else{
historicoDate.setBackgroundColor(
ContextCompat.getColor(
historicoDate.context, if (currentDate == item.shipped) {
R.color.verdnatura_pumpkin_orange
} else {
R.color.verdnatura_black_5
}))
item?.invalue?.let {
inQuantity.setBackgroundColor(ContextCompat.getColor(historicoDate.context,
if (it > 0) R.color.verdnatura_dark_green_verdnatura else R.color.verdnatura_white))
}
)
)
val color = if (item.invalue != null && item.invalue!! > 0) {
R.color.verdnatura_dark_green_verdnatura
} else {
R.color.verdnatura_black_5
}
inQuantity.setBackgroundColor(ContextCompat.getColor(historicoDate.context, color))
}
}