package com.test.basd.smartjunkcleaner.activity

import android.content.Intent
import android.graphics.Color
import androidx.activity.OnBackPressedCallback
import androidx.core.view.updatePadding
import com.blankj.utilcode.util.BarUtils
import com.test.basd.smartjunkcleaner.databinding.ActivityLayoutSpeakerCleanBinding
import com.test.basd.smartjunkcleaner.helps.BaseActivity
import com.test.basd.smartjunkcleaner.helps.ads.AdmobUtils

class SpeakerCleanerActivity : BaseActivity<ActivityLayoutSpeakerCleanBinding>() {


    override val binding: ActivityLayoutSpeakerCleanBinding by lazy {
        ActivityLayoutSpeakerCleanBinding.inflate(layoutInflater)
    }

    override fun initView() {
        BarUtils.setStatusBarLightMode(this, true)
        BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
        binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
        initListener()
    }


    override fun initListener() {
        binding.idBackSpeakCleaner.setOnClickListener {
            onBackPressedDispatcher.onBackPressed()
        }
        onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) {
            override fun handleOnBackPressed() {
                AdmobUtils.showInterstitialAd(this@SpeakerCleanerActivity){
                    finishToMain()
                }

            }
        })
        binding.idCleanDust.setOnClickListener {
            startActivity(Intent(this, SpeakCleaningActivity::class.java))
        }
    }
}