package com.test.basd.supercleanermax.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.supercleanermax.databinding.ActivityLayoutSpeakerCleanBinding
import com.test.basd.supercleanermax.helps.BaseActivity
import com.test.basd.supercleanermax.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, SpeakerCleaningActivity::class.java))
        }
    }
}