//package com.base.appzxhy.ui.recyclebin
//
//import android.content.Context
//import android.view.ViewGroup
//import com.base.appzxhy.R
//import com.base.appzxhy.databinding.ItemRecoveryBinBinding
//import com.base.appzxhy.ui.adapter.CommonViewHolder
//import com.base.appzxhy.ui.recyclebin.RecycleBinUtils.getImgRes
//import com.base.appzxhy.ui.recyclebin.RecycleBinUtils.mImageStr
//import com.base.appzxhy.ui.recyclebin.RecycleBinUtils.mVideoStr
//import com.base.appzxhy.utils.KotlinExt.toFormatSize
//import com.base.appzxhy.utils.XmlEx.inflate
//import com.bumptech.glide.Glide
//import com.chad.library.adapter4.BaseQuickAdapter
//import java.io.File
//
//class RecycleBinAdapter : BaseQuickAdapter<File, CommonViewHolder>() {
//
//    var clickAction: ((file: File) -> Unit)? = null
//
//    override fun onBindViewHolder(holder: CommonViewHolder, position: Int, item: File?) {
//        item ?: return
//        val binding = ItemRecoveryBinBinding.bind(holder.itemView)
//        val context = holder.itemView.context
//
//        if (mImageStr.contains("." + item.extension) || mVideoStr.contains("." + item.extension)) {
//            Glide.with(context).load(item.absoluteFile).into(binding.icon)
//        } else {
//            binding.icon.setImageResource(item.getImgRes())
//        }
//        binding.tvName.text = item.name
//        binding.tvSize.text = item.length().toFormatSize()
//        binding.root.setOnClickListener {
//            clickAction?.invoke(item)
//        }
//    }
//
//    override fun onCreateViewHolder(
//        context: Context,
//        parent: ViewGroup,
//        viewType: Int
//    ): CommonViewHolder {
//        return CommonViewHolder(R.layout.item_recovery_bin.inflate(parent))
//    }
//}