package com.bjzc.bhzhgd.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import com.bjzc.bhzhgd.base.BaseAdapterViewBinding
import com.bjzc.bhzhgd.bean.DeviceZhgdBean
import com.bjzc.bhzhgd.databinding.AdapterDeviceTwoLevelBinding


class DeviceTwoLevelAdapter(var context: Context,
                              var data: MutableList<DeviceZhgdBean.DeviceBean>) : BaseAdapterViewBinding<AdapterDeviceTwoLevelBinding>(context) {
    override fun getCount(): Int {
        return data.count()
    }

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

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

    override fun getBinding(
        inflater: LayoutInflater,
        parent: ViewGroup?
    ) = AdapterDeviceTwoLevelBinding.inflate(inflater, parent, false)

    override fun handleData(position: Int, binding: AdapterDeviceTwoLevelBinding) {
        val item: DeviceZhgdBean.DeviceBean = data[position]
        binding.tvJs.text = item.js
        binding.tvDxbh.text = item.dxbh
        binding.tvMc.text = item.mc
        binding.tvGl.text = item.gl
        binding.tvGlJ.text = item.gL_J
        binding.tvBz.text = item.bz
        binding.tvNfc.text = item.nfc
        binding.tvWzms.text = item.wzms
        binding.tvZrrXm.text = item.zrR_XM
        binding.tvZrrSjhm.text = item.zrR_SJHM
    }

}