saplsh 界面 动画
This commit is contained in:
parent
92e073062e
commit
e325c00546
|
|
@ -1,10 +1,14 @@
|
||||||
package com.gamedog.vididin.features.splash
|
package com.gamedog.vididin.features.splash
|
||||||
|
|
||||||
|
import android.animation.ObjectAnimator
|
||||||
|
import android.animation.ValueAnimator
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
import android.view.animation.LinearInterpolator
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.ama.core.architecture.appBase.AppViewsEmptyViewModelActivity
|
import com.ama.core.architecture.appBase.AppViewsEmptyViewModelActivity
|
||||||
|
import com.gamedog.vididin.di.Dispatcher
|
||||||
import com.gamedog.vididin.main.interfaces.OnTabStyleListener
|
import com.gamedog.vididin.main.interfaces.OnTabStyleListener
|
||||||
import com.gamedog.vididin.router.Router
|
import com.gamedog.vididin.router.Router
|
||||||
import com.remax.base.report.DataReportManager
|
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.remax.bill.ads.log.AdLogger
|
||||||
import com.vididin.real.money.game.R
|
import com.vididin.real.money.game.R
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.async
|
import kotlinx.coroutines.async
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
@ -49,6 +54,7 @@ class SplashActivity : AppViewsEmptyViewModelActivity<ViewBinding>(), OnTabStyle
|
||||||
|
|
||||||
override fun ViewBinding.initListeners() {
|
override fun ViewBinding.initListeners() {
|
||||||
startJumpTimer()
|
startJumpTimer()
|
||||||
|
startLoadingAnim()
|
||||||
initializeApp()
|
initializeApp()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,7 +74,7 @@ class SplashActivity : AppViewsEmptyViewModelActivity<ViewBinding>(), OnTabStyle
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initializeApp() {
|
private fun initializeApp() {
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch(Dispatchers.IO) {
|
||||||
try {
|
try {
|
||||||
async { performOtherInitializations() }
|
async { performOtherInitializations() }
|
||||||
val adMobInitDeferred = async { initializeAd() }
|
val adMobInitDeferred = async { initializeAd() }
|
||||||
|
|
@ -188,6 +194,16 @@ class SplashActivity : AppViewsEmptyViewModelActivity<ViewBinding>(), OnTabStyle
|
||||||
finish()
|
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 {
|
companion object {
|
||||||
const val MAX_SPLASH_TIME = 10 * 1000L
|
const val MAX_SPLASH_TIME = 10 * 1000L
|
||||||
const val MIN_SPLASH_TIME = 2 * 1000L
|
const val MIN_SPLASH_TIME = 2 * 1000L
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="450dp"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
android:src="@drawable/bg_splash"
|
android:src="@drawable/bg_splash"
|
||||||
/>
|
/>
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
android:src="@mipmap/ic_launcher"
|
android:src="@mipmap/splash_app_icon"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
|
@ -39,6 +39,7 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/iv_anim"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="78dp"
|
android:layout_marginTop="78dp"
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Loading…
Reference in New Issue