18034727885
2026-06-26 253f680fb9666751e0f9a8e5e8f2f9e3eb1894e3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.example.smart.ui.project.check.adapter
 
import androidx.databinding.DataBindingUtil
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.smart.MyApp
import com.example.smart.R
import com.example.smart.databinding.ItemCheckViewBinding
import com.example.smart.oss.ImageRemotePathProvider
import com.example.smart.ui.project.check.bean.CheckBean
 
class CheckAdapter(
    var block: (CheckBean) -> Unit
) : BaseQuickAdapter<CheckBean, BaseViewHolder>(R.layout.item_check_view) {
 
    override fun convert(holder: BaseViewHolder, item: CheckBean) {
        val binding: ItemCheckViewBinding? = DataBindingUtil.bind(holder.itemView)
        binding?.let {
            it.tv.text = item.title?:""
 
            it.root.setOnClickListener {
                block.invoke(item)
            }
 
            if (item.safetySlip.isNullOrEmpty()) {
                Glide.with(MyApp.app).load(R.mipmap.ic_issue_img).transform(RoundedCorners(6))
                    .into(it.img)
            } else {
                val str = ImageRemotePathProvider.IMAGE_BASE_URL + item.safetySlip!!.split(",")[0]
 
                Glide.with(MyApp.app).asBitmap()
                    .load(str)
                    .transform(RoundedCorners(6))
                    .into(it.img)
            }
        }
    }
 
}