package com.example.absenkuv3.facex

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.ListAdapter
import android.widget.TextView
import com.absenku.sitepat.R

class AlertDialogAdapter(private val context: Context, private val arrayList: List<String?>) :
    BaseAdapter(), ListAdapter {
    private lateinit var num: TextView
    private lateinit var name: TextView
    override fun getCount(): Int {
        return arrayList.size
    }

    override fun getItem(position: Int): Any {
        return position
    }

    override fun getItemId(position: Int): Long {
        return position.toLong()
    }

    override fun getView(position: Int, convertView: View?, parent: ViewGroup): View? {
        var convertView = convertView
        convertView =
            LayoutInflater.from(context).inflate(R.layout.item_list_view_dialog, parent, false)
        num = convertView.findViewById(R.id.no_list)
        name = convertView.findViewById(R.id.isi_list)
        num.text = (position + 1).toString()
        name.text = arrayList[position].toString()
        return convertView
    }
}