package pxds.hpls.xkxo

import android.view.View
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.test.basd.supercleanermax.R
import com.test.basd.supercleanermax.databinding.MbpkjwBinding
import pxds.dlpf.buoz.fico.Ipnk.inflate
import pxds.vazp.Mrzg

class Fkee : RecyclerView.Adapter<Fkee.CCCC>() {

    private val permissionBeans = arrayListOf<Mrzg>()

    override fun onBindViewHolder(holder: CCCC, position: Int) {
        val context = holder.itemView.context
        val data = permissionBeans[position]

        holder.binding.xijyvon.text = context.getString(data.permissionTittle)
        holder.binding.iiyuoks.text = context.getString(data.permissionDesc)

        if (data.isAuthorized) {
            holder.binding.gkscgyg.visibility = View.VISIBLE
            if (data.isSensitive) {
                holder.binding.gkscgyg.background = ContextCompat.getDrawable(context, R.drawable.fpgsklhv)
                holder.binding.gkscgyg.setTextColor(ContextCompat.getColor(context, R.color.ށޖވފވ))
            } else {
                holder.binding.gkscgyg.background = ContextCompat.getDrawable(context, R.drawable.gnnsixtl)
                holder.binding.gkscgyg.setTextColor(ContextCompat.getColor(context, R.color.ޑޟޡތޢ))
            }
        } else {
            holder.binding.gkscgyg.visibility = View.GONE
        }

    }

    inner class CCCC(view: View) : ViewHolder(view) {
        val binding = MbpkjwBinding.bind(view)
    }

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

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

    fun setData(permissions: List<Mrzg>) {
        permissionBeans.clear()
        permissionBeans.addAll(permissions)
        notifyDataSetChanged()
    }
}