package com.future.dispatch.ui.adapter
|
|
import android.view.View
|
import com.future.dispatch.R
|
import com.future.dispatch.base.BaseRvAdapter
|
import com.future.dispatch.base.BaseViewHolder
|
import com.future.dispatch.bean.ApplyReassignBean
|
import com.future.dispatch.ui.order.change_order.RightAwayActivity
|
import com.future.dispatch.utils.clickDelay
|
import kotlinx.android.synthetic.main.item_change_order.view.*
|
import org.jetbrains.anko.startActivity
|
|
class ChangeOrderAdapter: BaseRvAdapter<ApplyReassignBean.DataBean>() {
|
override fun getLayoutResId(viewType: Int): Int {
|
return R.layout.item_change_order
|
}
|
|
override fun onBindItem(holder: BaseViewHolder?, view: View?, item: ApplyReassignBean.DataBean?) {
|
holder?.let {
|
it.itemView.tv_time.text = item!!.applyTime
|
it.itemView.tv_start.text = item!!.startAddress
|
it.itemView.tv_end.text = item!!.endAddress
|
it.itemView.tv_driver.text = item!!.applyDriver
|
it.itemView.tv_shen_car_type.text = getOrderType(item.orderType)
|
if(item!!.applyDriver.isNullOrEmpty()){
|
it.itemView.tv_driver.text = "无"
|
}
|
it.itemView.tv_now.clickDelay {
|
context.startActivity<RightAwayActivity>("id" to item.id.toString(),"type" to "1")
|
}
|
}
|
}
|
|
private fun getOrderType(orderType: Int): String {
|
when(orderType){
|
1 -> {
|
return "专车订单"
|
}
|
2 -> {
|
return "出租车订单"
|
}
|
3 -> {
|
return "跨城订单"
|
}
|
4 -> {
|
return "同城小件订单"
|
}
|
5 -> {
|
return "跨城小件订单"
|
}
|
7 -> {
|
return "接送机/站订单"
|
}
|
}
|
return ""
|
}
|
|
}
|