package com.xyzshell.myphoneinfo.dashboard

import android.os.Bundle
import android.view.Gravity
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.recyclerview.widget.LinearLayoutManager
import com.xyzshell.myphoneinfo.R
import com.xyzshell.myphoneinfo.adapter.OnTempClickListener
import com.xyzshell.myphoneinfo.adapter.TempAdapter
import com.xyzshell.myphoneinfo.databinding.ActivityTemperatureBinding
import com.xyzshell.myphoneinfo.dialog.CustomPopView
import com.xyzshell.myphoneinfo.dialog.TempDialogFragment

class TemperatureActivity : AppCompatActivity(),OnTempClickListener {
    private lateinit var binding: ActivityTemperatureBinding
    private lateinit var customPopView: CustomPopView
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityTemperatureBinding.inflate(layoutInflater)
        setContentView(binding.root)
        binding.imageBack.setOnClickListener {
            finish()
        }
        val tempAdapter = TempAdapter()
        tempAdapter.setListener(this)
        binding.rvTemperature.adapter = tempAdapter
        binding.rvTemperature.layoutManager =LinearLayoutManager(this)
        customPopView =CustomPopView(this,3,callback = {text->

        })
        binding.imageTool.setOnClickListener {
            customPopView.show(binding.imageTool)
        }
    }

    override fun onTempClick(position: Int) {
        val tempDialog = TempDialogFragment()
        tempDialog.show(supportFragmentManager, "tempDialog")
    }
}