package com.audio.record.screen.test.activity

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.CountDownTimer
import com.audio.record.screen.test.R
import com.audio.record.screen.test.base.BaseActivity
import com.audio.record.screen.test.databinding.ActivityWelcomeBinding

class WelcomeActivity : BaseActivity<ActivityWelcomeBinding>() {
    private val total = 2000L
    private   var countDownTimer:CountDownTimer? = null
    override fun initBinding(): ActivityWelcomeBinding =
        ActivityWelcomeBinding.inflate(layoutInflater)

    override fun getFullColor(): Boolean = true

    override fun onCreateInit() {
        countDownTimer =object :CountDownTimer(total, 1000){
            override fun onTick(millisUntilFinished: Long) {

            }

            override fun onFinish() {
                toMain()
            }

        }
        countDownTimer?.start()

    }

    private fun toMain(){
        startActivity(Intent(this,MainActivity1::class.java))
        finish()
    }

    override fun onInitPadding(): Boolean = false


    override fun onDestroy() {
        super.onDestroy()
        countDownTimer?.cancel()
        countDownTimer = null

    }
}