package com.base.appzxhy.ui.guide

import android.content.Intent
import androidx.activity.addCallback
import com.base.appzxhy.R
import com.base.appzxhy.base.BaseActivity
import com.base.appzxhy.business.ads.AdsMgr
import com.base.appzxhy.databinding.ActivityGuideCleanBinding

class GuideCleanActivity : BaseActivity<ActivityGuideCleanBinding>(ActivityGuideCleanBinding::inflate) {

    override fun initView() {
        super.initView()

    }

    override fun initListener() {
        super.initListener()
        changeNative()
        binding.llPhoto.setOnClickListener {
            binding.iv1.isSelected = !binding.iv1.isSelected
            changeNative()
        }
        binding.llVideo.setOnClickListener {
            binding.iv2.isSelected = !binding.iv2.isSelected
            changeNative()
        }

        binding.llAudio.setOnClickListener {
            binding.iv3.isSelected = !binding.iv3.isSelected
            changeNative()
        }

        binding.llDocument.setOnClickListener {
            binding.iv4.isSelected = !binding.iv4.isSelected
            changeNative()
        }

        onBackPressedDispatcher.addCallback {
            finishToMain()
        }

        binding.llContinue.setOnClickListener {
            startActivity(Intent(this, GuideActivity::class.java))
            finish()
        }
    }

    private fun changeNative() {
        AdsMgr.showNative(binding.flAd, R.layout.layout_admob_native_custom)
    }
}