package com.xyzshell.myphoneinfo.dashboard

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import com.xyzshell.myphoneinfo.adapter.CpuListAdapter
import com.xyzshell.myphoneinfo.databinding.ActivityCpuStatusBinding
import com.xyzshell.myphoneinfo.dialog.CustomPopView


class CpuStatusActivity : AppCompatActivity() {
    private lateinit var binding : ActivityCpuStatusBinding
    private lateinit var customPopView: CustomPopView
    private lateinit var popSleepView: CustomPopView
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityCpuStatusBinding.inflate(layoutInflater)
        setContentView(binding.root)
        customPopView =CustomPopView(this,0,callback = {text->
            binding.popText.text = text
        })
        popSleepView = CustomPopView(this,1,callback = {text->

        })
        binding.popClick.setOnClickListener {
            customPopView.show(binding.topTitle)
        }
        binding.moreBtn.setOnClickListener {
            popSleepView.show(binding.moreBtn)
        }
        binding.cpuList.adapter= CpuListAdapter()
        binding.cpuList.layoutManager= LinearLayoutManager(this)
        binding.backBtn.setOnClickListener { finish() }
    }
    override fun onDestroy() {
        if (customPopView.isShowing()) {
            customPopView.dismiss();
        }
        super.onDestroy()}
}