package com.test.basd.smartjunkcleaner.activity.speed

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

class SpeedFinishActivity : BaseActivity<ActivityLayoutSpeedFinishBinding>() {


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

    override fun initView() {
        BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
        val type=intent.getStringExtra("type")
        binding.root.updatePadding(top = BarUtils.getStatusBarHeight())

        binding.idSpeedFinish.addAnimatorListener(object : Animator.AnimatorListener {
            override fun onAnimationStart(p0: Animator) {

            }

            override fun onAnimationEnd(p0: Animator) {
                AdmobUtils.showInterstitialAd(this@SpeedFinishActivity) {
                    startActivity(
                        Intent(
                            this@SpeedFinishActivity,
                            ResultActivity::class.java
                        ).putExtra("from", type)
                    )
                    finish()
                }

            }

            override fun onAnimationCancel(p0: Animator) {

            }

            override fun onAnimationRepeat(p0: Animator) {

            }

        })
    }

}