package com.kuanzhai.driver.ui.adapter
|
|
import android.view.View
|
import cn.sinata.xldutils.utils.clickDelay
|
import cn.sinata.xldutils.utils.gone
|
import cn.sinata.xldutils.utils.visible
|
import com.kuanzhai.driver.R
|
import com.kuanzhai.driver.base.BaseRvAdapter
|
import com.kuanzhai.driver.base.BaseViewHolder
|
import com.kuanzhai.driver.utils.glide.GlideUtil
|
import kotlinx.android.synthetic.main.item_up_phone_two.view.*
|
|
class UpPhotoTwoAdapter: BaseRvAdapter<String>() {
|
|
var isShowClose = true
|
|
override fun getLayoutResId(viewType: Int): Int {
|
return R.layout.item_up_phone_two
|
}
|
|
override fun onBindItem(holder: BaseViewHolder?, view: View?, item: String?) {
|
holder?.itemView?.let {
|
it.iv_close.gone()
|
if (item.isNullOrEmpty()){
|
it.iv_imgs.setImageResource(R.mipmap.photo_update)
|
}else{
|
if (isShowClose){
|
it.iv_close.visible()
|
}
|
GlideUtil.load(context,item,it.iv_imgs,1)
|
}
|
|
it.iv_close.clickDelay {
|
data.removeAt(holder.adapterPosition)
|
notifyDataSetChanged()
|
}
|
}
|
}
|
|
fun getImg():String{
|
var imgs = ""
|
for (item in data){
|
if (!item.isNullOrEmpty()){
|
if (imgs.isEmpty()){
|
imgs = item
|
}else{
|
imgs= "$imgs,$item"
|
}
|
}
|
}
|
return imgs
|
}
|
}
|