package com.base.appzxhy.ui.start

import android.annotation.SuppressLint
import android.content.Intent
import android.graphics.Color
import androidx.activity.SystemBarStyle
import androidx.activity.enableEdgeToEdge
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.lifecycle.ViewModelProvider
import com.base.appzxhy.R
import com.base.appzxhy.ads.AdsMgr
import com.base.appzxhy.databinding.ActivityStartBinding
import com.koko.batteryinfo.BatteryInfoActivity
import com.koko.drouter.base.BaseActivity

class StartActivity : BaseActivity<ActivityStartBinding>(ActivityStartBinding::inflate) {


    private val viewModel by lazy(LazyThreadSafetyMode.NONE) {
        ViewModelProvider(this)[StartViewModel::class.java]
    }

    override fun initView() {
        super.initView()
    }

    @SuppressLint("SetTextI18n")
    override fun initListener() {
        super.initListener()
        binding.tv.setOnClickListener {
//            if (isContinuousTimesClick()) {
//                val sb = StringBuilder()
//                val gson = Gson()
//                sb.append("ut:${ConfigBean.configBean.ut}").append("\n")
//                val adLog = gson.toJson(ConfigBean.configBean.adConfigBean).replace(",", ",\n")
//                sb.append(adLog).append("\n")
//                val popupLog = gson.toJson(ConfigBean.configBean.popupConfigBean).replace(",", ",\n")
//                sb.append(popupLog)
//                showLogDialog(sb.toString())
//            }

            startActivity(Intent(this, BatteryInfoActivity::class.java))
        }
    }


    override fun onResumeOneShoot() {
        super.onResumeOneShoot()
        viewModel.startJumpCountdown()
    }

    override fun onStop() {
        super.onStop()
        viewModel.cancelJumpCountDown()
    }


    override fun useDefaultImmersive() {
//        enableEdgeToEdge(SystemBarStyle.light(Color.TRANSPARENT, Color.TRANSPARENT))
        enableEdgeToEdge(SystemBarStyle.dark(Color.TRANSPARENT))
        ViewCompat.setOnApplyWindowInsetsListener(binding.root) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, 0, systemBars.right, systemBars.bottom)
            insets
        }

    }

}