| | |
| | | import com.driver.igotrip.ui.DialogUtil |
| | | import org.jetbrains.anko.find |
| | | |
| | | class CardListAdapter:BaseRvAdapter<CardListBean.DataBean>() { |
| | | class CardListAdapter : BaseRvAdapter<CardListBean.DataBean>() { |
| | | |
| | | var itemClick: ((CardListBean.DataBean) -> Unit)? = null |
| | | |
| | | override fun getLayoutResId(viewType: Int): Int { |
| | | return R.layout.item_card_list |
| | | } |
| | |
| | | it.itemView.find<TextView>(R.id.tv_name).text = item!!.bank |
| | | it.itemView.find<TextView>(R.id.tv_num).text = item.code.hideBankNum() |
| | | it.itemView.find<View>(R.id.cl_root).setOnLongClickListener { |
| | | DialogUtil.getDelAndSureDialog(context, context.getString(R.string.delete_this_card), {}, { |
| | | var map = getMapByAny() |
| | | map["id"] = item.id |
| | | callNet(context, Api.delBankCard,map){ |
| | | data.remove(item) |
| | | notifyDataSetChanged() |
| | | toast(context.getString(R.string.successfully_delete)) |
| | | } |
| | | }) |
| | | DialogUtil.getDelAndSureDialog( |
| | | context, |
| | | context.getString(R.string.delete_this_card), |
| | | {}, |
| | | { |
| | | var map = getMapByAny() |
| | | map["id"] = item.id |
| | | callNet(context, Api.delBankCard, map) { |
| | | data.remove(item) |
| | | notifyDataSetChanged() |
| | | toast(context.getString(R.string.successfully_delete)) |
| | | } |
| | | }) |
| | | return@setOnLongClickListener false |
| | | } |
| | | it.itemView.find<View>(R.id.cl_root).setOnClickListener { |
| | | itemClick?.invoke(item) |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |