스플래시 변경
This commit is contained in:
@@ -2,10 +2,12 @@ package kr.co.vividnext.sodalive.splash
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.media.MediaPlayer
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.view.SurfaceHolder
|
||||
import android.widget.ImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.os.bundleOf
|
||||
@@ -16,6 +18,7 @@ import com.google.firebase.remoteconfig.ktx.get
|
||||
import com.google.firebase.remoteconfig.ktx.remoteConfig
|
||||
import com.google.firebase.remoteconfig.ktx.remoteConfigSettings
|
||||
import kr.co.vividnext.sodalive.BuildConfig
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.base.BaseActivity
|
||||
import kr.co.vividnext.sodalive.base.SodaDialog
|
||||
import kr.co.vividnext.sodalive.common.Constants
|
||||
@@ -26,19 +29,49 @@ import kr.co.vividnext.sodalive.onboarding.OnBoardingActivity
|
||||
import kr.co.vividnext.sodalive.user.login.LoginActivity
|
||||
|
||||
@SuppressLint("CustomSplashScreen")
|
||||
class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding::inflate) {
|
||||
class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding::inflate),
|
||||
SurfaceHolder.Callback2 {
|
||||
|
||||
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.ivText, start = 0, end = 0, top = 390, bottom = 0)
|
||||
setLayoutParams(binding.ivTextLogo, start = 0, end = 0, top = 0, bottom = 150)
|
||||
// setLayoutParams(binding.ivText, start = 0, end = 0, top = 390, bottom = 0)
|
||||
// setLayoutParams(binding.ivTextLogo, start = 0, end = 0, top = 0, bottom = 150)
|
||||
|
||||
setupRemoteConfig()
|
||||
fetchAndroidLatestVersion()
|
||||
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) {
|
||||
}
|
||||
|
||||
private fun setLayoutParams(
|
||||
|
||||
Reference in New Issue
Block a user