package com.zxhy.fastfilemanagerpro.kokodup

import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.zxhy.fastfilemanagerpro.R
import com.zxhy.fastfilemanagerpro.databinding.ItemKokoDupFileBinding
import com.zxhy.fastfilemanagerpro.databinding.ItemKokoDupImageBinding
import com.zxhy.fastfilemanagerpro.kokoadapter.CommonAdapter
import com.zxhy.fastfilemanagerpro.kokotools.XmlEx.inflate

class KoDupFilekoAdapter : RecyclerView.Adapter<KoDupFilekoAdapter.KoDupFilekoViewHolder>() {

    private var dupFileList = arrayListOf<KoDupFileDatako>()

    inner class KoDupFilekoViewHolder(view: View) : ViewHolder(view) {
        val binding = ItemKokoDupFileBinding.bind(view)
    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): KoDupFilekoViewHolder {
        return KoDupFilekoViewHolder(R.layout.item_koko_dup_file.inflate(parent))
    }

    override fun getItemCount(): Int {
        return dupFileList.size
    }

    override fun onBindViewHolder(holder: KoDupFilekoViewHolder, position: Int) {
    }

    override fun onBindViewHolder(
        holder: KoDupFilekoViewHolder,
        position: Int,
        payloads: MutableList<Any>
    ) {
        val context = holder.binding.root.context
        if (payloads.isEmpty()) {

        } else {
            super.onBindViewHolder(holder, position, payloads)
        }
    }

    inner class DupImageAdapter : CommonAdapter<DupImageAdapter.DupImageViewHolder>() {
        inner class DupImageViewHolder(view: View) : ViewHolder(view) {
            val binding = ItemKokoDupImageBinding.bind(view)
        }

        override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DupImageViewHolder {
            return DupImageViewHolder(R.layout.item_koko_dup_image.inflate(parent))
        }

        override fun onBindViewHolder(holder: DupImageViewHolder, position: Int) {
        }

        override fun onBindViewHolder(
            holder: DupImageViewHolder,
            position: Int,
            payloads: MutableList<Any>
        ) {
            val content = holder.binding.root.context
            if (payloads.isEmpty()) {

            } else {
                super.onBindViewHolder(holder, position, payloads)
            }
        }
    }
}