package com.casic.br.fragment.add

import android.util.Log
import com.casic.br.R
import com.casic.br.adapter.DeviceTypeAdapter
import com.pengxh.kt.lite.base.KotlinBaseFragment
import kotlinx.android.synthetic.main.fragment_add_device_type.*

class DeviceTypeFragment : KotlinBaseFragment() {

    private val kTag = "DeviceTypeFragment"
    private val deviceTypes = arrayOf("热水器", "油烟机", "厨灶具", "其他产品")

    override fun initLayoutView(): Int = R.layout.fragment_add_device_type

    override fun observeRequestState() {

    }

    override fun setupTopBarLayout() {

    }

    override fun initData() {

    }

    override fun initEvent() {
        val deviceTypeAdapter =
            DeviceTypeAdapter(requireContext(), deviceTypes)
        deviceTypeRecyclerView.adapter = deviceTypeAdapter
        deviceTypeAdapter.setOnTypeItemClickListener(object :
            DeviceTypeAdapter.OnTypeItemClickListener {
            override fun onItemClick(position: Int) {
                Log.d(kTag, "onItemClick: ${deviceTypes[position]}")
            }
        })
    }
}