스플래시 2024/09
This commit is contained in:
@@ -29,46 +29,19 @@ import kr.co.vividnext.sodalive.onboarding.OnBoardingActivity
|
||||
import kr.co.vividnext.sodalive.user.login.LoginActivity
|
||||
|
||||
@SuppressLint("CustomSplashScreen")
|
||||
class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding::inflate),
|
||||
SurfaceHolder.Callback2 {
|
||||
class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding::inflate) {
|
||||
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private val remoteConfig = Firebase.remoteConfig
|
||||
|
||||
private var mediaPlayer: MediaPlayer? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
setLayoutParams(binding.ivTitle, start = 0, end = 0, top = 180, bottom = 0)
|
||||
setLayoutParams(binding.ivText, start = 0, end = 0, top = 0, bottom = 107)
|
||||
|
||||
setupRemoteConfig()
|
||||
binding.surfaceView.holder.addCallback(this)
|
||||
}
|
||||
|
||||
override fun surfaceCreated(holder: SurfaceHolder) {
|
||||
val uri = Uri.parse("android.resource://$packageName/${R.raw.video}")
|
||||
mediaPlayer = MediaPlayer().apply {
|
||||
setDataSource(this@SplashActivity, uri)
|
||||
setDisplay(holder)
|
||||
setOnPreparedListener {
|
||||
start()
|
||||
handler.postDelayed({
|
||||
binding.surfaceView.background = null
|
||||
}, 100)
|
||||
}
|
||||
setOnCompletionListener { fetchAndroidLatestVersion() }
|
||||
prepareAsync()
|
||||
}
|
||||
}
|
||||
|
||||
override fun surfaceChanged(p0: SurfaceHolder, p1: Int, p2: Int, p3: Int) {
|
||||
}
|
||||
|
||||
override fun surfaceDestroyed(p0: SurfaceHolder) {
|
||||
mediaPlayer?.release()
|
||||
mediaPlayer = null
|
||||
}
|
||||
|
||||
override fun surfaceRedrawNeeded(p0: SurfaceHolder) {
|
||||
fetchAndroidLatestVersion()
|
||||
}
|
||||
|
||||
private fun setLayoutParams(
|
||||
@@ -256,7 +229,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
|
||||
}
|
||||
)
|
||||
finish()
|
||||
}, 500)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
private fun showMainActivity(extras: Bundle?) {
|
||||
@@ -269,7 +242,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
|
||||
}
|
||||
)
|
||||
finish()
|
||||
}, 500)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
private fun showLoginActivity(extras: Bundle?) {
|
||||
@@ -282,7 +255,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
|
||||
}
|
||||
)
|
||||
finish()
|
||||
}, 500)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
override fun setupView() {}
|
||||
|
||||
Reference in New Issue
Block a user