saplsh 界面 动画

This commit is contained in:
renhaoting 2025-12-18 17:41:02 +08:00
parent 92e073062e
commit e325c00546
3 changed files with 20 additions and 3 deletions

View File

@ -1,10 +1,14 @@
package com.gamedog.vididin.features.splash
import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.app.Activity
import android.content.Intent
import android.view.LayoutInflater
import android.view.animation.LinearInterpolator
import androidx.lifecycle.lifecycleScope
import com.ama.core.architecture.appBase.AppViewsEmptyViewModelActivity
import com.gamedog.vididin.di.Dispatcher
import com.gamedog.vididin.main.interfaces.OnTabStyleListener
import com.gamedog.vididin.router.Router
import com.remax.base.report.DataReportManager
@ -16,6 +20,7 @@ import com.remax.bill.ads.ext.AdShowExt
import com.remax.bill.ads.log.AdLogger
import com.vididin.real.money.game.R
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
@ -49,6 +54,7 @@ class SplashActivity : AppViewsEmptyViewModelActivity<ViewBinding>(), OnTabStyle
override fun ViewBinding.initListeners() {
startJumpTimer()
startLoadingAnim()
initializeApp()
}
@ -68,7 +74,7 @@ class SplashActivity : AppViewsEmptyViewModelActivity<ViewBinding>(), OnTabStyle
}
private fun initializeApp() {
lifecycleScope.launch {
lifecycleScope.launch(Dispatchers.IO) {
try {
async { performOtherInitializations() }
val adMobInitDeferred = async { initializeAd() }
@ -188,6 +194,16 @@ class SplashActivity : AppViewsEmptyViewModelActivity<ViewBinding>(), OnTabStyle
finish()
}
private fun startLoadingAnim() {
val imageView = binding.ivAnim
ObjectAnimator.ofFloat(imageView, "rotation", 0f, 360f).apply {
duration = 2000L
interpolator = LinearInterpolator()
repeatCount = ValueAnimator.INFINITE
start()
}
}
companion object {
const val MAX_SPLASH_TIME = 10 * 1000L
const val MIN_SPLASH_TIME = 2 * 1000L

View File

@ -7,7 +7,7 @@
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="450dp"
android:scaleType="centerCrop"
android:src="@drawable/bg_splash"
/>
@ -24,7 +24,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="center"
android:src="@mipmap/ic_launcher"
android:src="@mipmap/splash_app_icon"
/>
<androidx.appcompat.widget.AppCompatTextView
@ -39,6 +39,7 @@
/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_anim"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="78dp"

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB