package com.bjzc.bhzhgd.activity.zhgd

import android.Manifest
import android.content.pm.PackageManager
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.bjzc.bhzhgd.R
import com.bjzc.bhzhgd.adapter.DeviceThreeLevelAdapter
import com.bjzc.bhzhgd.adapter.DeviceTwoLevelAdapter
import com.bjzc.bhzhgd.bean.DeviceZhgdBean
import com.bjzc.bhzhgd.databinding.ActivityDeviceListBinding
import com.bjzc.bhzhgd.databinding.ActivityDeviceThreeLevelBinding
import com.bjzc.bhzhgd.utils.GsonUtils
import com.bjzc.bhzhgd.utils.OAToolbar
import com.rehome.scbaxj.base.BaseActivityOaToolbarViewBinding

class DeviceThreeLevelActivity :
    BaseActivityOaToolbarViewBinding<ActivityDeviceThreeLevelBinding>() {

    private var datas: MutableList<DeviceZhgdBean.DataBean> = mutableListOf()
    private lateinit var adapter: DeviceThreeLevelAdapter

    override fun getViewBinding() = ActivityDeviceThreeLevelBinding.inflate(layoutInflater)

    override fun getToolbar() = binding.toolbarView.toolbar

    override fun initView() {
        initToolbar("三级电箱", "", {finish() }, {

        })


        val dataList = intent.getParcelableArrayListExtra<DeviceZhgdBean.DataBean>("data")
        if (dataList != null && dataList.size > 0) {
            showLog("data is not null")
            datas.clear()
            datas.addAll(dataList)
        } else {
            showLog("data is null")
        }

        binding.lv.emptyView = binding.tvNodata

        adapter = DeviceThreeLevelAdapter(context, datas)
        binding.lv.adapter = adapter

        if (datas != null && datas.size > 0) {
            binding.tvNodata.visibility = View.GONE
            binding.lv.visibility = View.VISIBLE
        } else {
            binding.tvNodata.visibility = View.VISIBLE
            binding.lv.visibility = View.GONE
        }
    }

    override fun initData() {

    }

}