WallpaperGallery-com.galler.../app/src/main/java/com/gallery/free/wallpaper/SplaActivity.kt
2026-01-04 15:23:26 +08:00

55 lines
1.7 KiB
Kotlin

package com.gallery.free.wallpaper
import android.annotation.SuppressLint
import android.content.Intent
import android.os.Bundle
import android.os.CountDownTimer
import androidx.appcompat.app.AppCompatActivity
import com.ad.tradpluslibrary.TPAdManager
import com.gallery.free.wallpaper.databinding.ActivitySplaBinding
class SplaActivity : AppCompatActivity() {
private var countDownTimer: CountDownTimer? = null
private var vb: ActivitySplaBinding? = null
private val totalTime: Long = 15000
@SuppressLint("MissingInflatedId")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
vb = ActivitySplaBinding.inflate(layoutInflater)
Utils_com.initFull(this, true)
setContentView(vb?.getRoot())
TPAdManager.init(
this,
"ocean",
"EF4D3DDD83B3D1EF16ED3E6995AF0E11",
"58E5429FFDD5BDF2034D6D78B157C012",
"8DB63FE93F30FEA99D2D275BFC974C12",
"09E55308FBBE7CD2C0C5571EFCEB8312"
) {
}
countDownTimer = TPAdManager.showWelcomeAd(this, totalTime, { millisUntilFinished ->
val progressPercentage = ((100 * millisUntilFinished) / totalTime).toInt()
val countdownPercentage = 100 - progressPercentage
vb?.progressbar?.progress = countdownPercentage
}) {
vb?.progressbar?.progress = 100
val intent = Intent(this@SplaActivity, MainActivity::class.java)
startActivity(intent)
finish()
}
countDownTimer?.start()
}
override fun onDestroy() {
super.onDestroy()
if (countDownTimer != null) {
countDownTimer!!.cancel()
countDownTimer = null
}
}
}