package com.zxhyis.toolss.ui.page

import android.graphics.Color
import com.blankj.utilcode.util.BarUtils
import com.zxhyis.toolss.ad.ConfigHelper
import com.zxhyis.toolss.base.TopActivity
import com.zxhyis.toolss.databinding.ActivityLayoutGuestBinding
import com.zxhyis.toolss.logic.startActivity
import kotlin.random.Random

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

    override fun init() {

        BarUtils.setStatusBarLightMode(this, true)
        BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
        ConfigHelper.ifGuest = true
        vb.idLottie.imageAssetsFolder = "saomiao/images/"
        vb.idLottie.setAnimation("saomiao/data.json")
        vb.idLottie.playAnimation()
        loadPro()
    }

    private var mProgress = 0
    private fun loadPro() {
        if (mProgress >= 100) {
            vb.idSJindu.progress = mProgress
            startActivity<CleanGuestActivity>()
            return
        }
        vb.idSJindu.postDelayed(Runnable {
            mProgress += Random.nextInt(5)
            vb.idSJindu.progress = mProgress
            loadPro()
        }, 80)

    }
}