package com.zxhyis.toolss.ui.page

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.zxhyis.toolss.base.TopActivity
import com.zxhyis.toolss.databinding.ActivityLayoutSpeakerCleanBinding
import com.zxhyis.toolss.logic.setOnClick

class SpeakerCleanerActivity : TopActivity<ActivityLayoutSpeakerCleanBinding>() {
    override fun getViewBinding1(): ActivityLayoutSpeakerCleanBinding {
        return ActivityLayoutSpeakerCleanBinding.inflate(layoutInflater)
    }

    override fun init() {
        BarUtils.setStatusBarLightMode(this, true)
        BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
        vb.root.updatePadding(top = BarUtils.getStatusBarHeight())
        initListener()
    }
    private fun initListener() {
        vb.idBackSpeakCleaner.setOnClick(javaClass.simpleName) {
            onBackPressedDispatcher.onBackPressed()
        }
        onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) {
            override fun handleOnBackPressed() {
                finishToMain()
            }
        })
        vb.idCleanDust.setOnClick(javaClass.simpleName) {
            startActivity(Intent(this, SpeakCleaningActivity::class.java))
        }
    }
}