package com.cariad.cea.aircondition

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.cariad.cea.aircondition.databinding.ActivityMainBinding
import com.cariad.cea.aircondition.fragments.AirConditionFragment

class MainActivity : AppCompatActivity() {
    private val bindView by lazy { ActivityMainBinding.inflate(layoutInflater) }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(bindView.main)
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }

        // 显示空调手势调节的Fragment
        val transaction = supportFragmentManager.beginTransaction()
        transaction.add(bindView.layoutAirConditionFragment.id, AirConditionFragment.newInstance())
        transaction.commit()
    }
}