| | |
| | | import com.xw.common.viewAdapter.ViewAdapter |
| | | import com.xw.yunwei.R |
| | | import com.xw.yunwei.databinding.ItemWorkManageCarBinding |
| | | import com.xw.yunwei.extension.colorIdToColorValue |
| | | import com.xw.yunwei.model.CarModel |
| | | |
| | | class CarAdapter(var listener: OnItemClickListener<CarModel>) : |
| | |
| | | ) |
| | | ) |
| | | binding.batteryView.setLevel(item.currentElectricity ?: 0) |
| | | |
| | | val setStatus: (Int, Int) -> Unit = { text, bg -> |
| | | binding.status.setTextColor(text) |
| | | binding.status.setBackgroundResource(bg) |
| | | } |
| | | |
| | | // 1=运营中 2=维修中 3=已收车 4=车辆异常 |
| | | when (item.operatingStatus) { |
| | | 1 -> { |
| | | setStatus( |
| | | getResColor(com.xw.common.R.color.blue_5), |
| | | com.xw.common.R.color.blue_1 |
| | | ) |
| | | binding.status.text = "运营中" |
| | | } |
| | | |
| | | 2 -> { |
| | | setStatus( |
| | | getResColor(com.xw.common.R.color.red_5), |
| | | com.xw.common.R.color.red_1 |
| | | ) |
| | | binding.status.text = "维修中" |
| | | } |
| | | |
| | | 3 -> { |
| | | setStatus( |
| | | getResColor(com.xw.common.R.color.gray_7), |
| | | com.xw.common.R.color.gray_3 |
| | | ) |
| | | binding.status.text = "已收车" |
| | | } |
| | | |
| | | 4 -> { |
| | | setStatus( |
| | | getResColor(com.xw.common.R.color.orange_5), |
| | | com.xw.common.R.color.orange_1 |
| | | ) |
| | | binding.status.text = "车辆异常" |
| | | } |
| | | } |
| | | binding.status.setBackgroundResource(item.getShowStatusBgResource()) |
| | | binding.status.setTextColor(item.getShowStatusTextColor().colorIdToColorValue(it.root.context)) |
| | | binding.status.text=item.getShowStatus() |
| | | } |
| | | } |
| | | |