스플래시 변경

This commit is contained in:
klaus 2024-07-30 21:34:15 +09:00
parent a618903f0f
commit 66cdb621ca
7 changed files with 48 additions and 41 deletions

View File

@ -2,10 +2,12 @@ package kr.co.vividnext.sodalive.splash
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Intent import android.content.Intent
import android.media.MediaPlayer
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.view.SurfaceHolder
import android.widget.ImageView import android.widget.ImageView
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.os.bundleOf 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.remoteConfig
import com.google.firebase.remoteconfig.ktx.remoteConfigSettings import com.google.firebase.remoteconfig.ktx.remoteConfigSettings
import kr.co.vividnext.sodalive.BuildConfig 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.BaseActivity
import kr.co.vividnext.sodalive.base.SodaDialog import kr.co.vividnext.sodalive.base.SodaDialog
import kr.co.vividnext.sodalive.common.Constants 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 import kr.co.vividnext.sodalive.user.login.LoginActivity
@SuppressLint("CustomSplashScreen") @SuppressLint("CustomSplashScreen")
class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding::inflate) { class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding::inflate),
SurfaceHolder.Callback2 {
private val handler = Handler(Looper.getMainLooper()) private val handler = Handler(Looper.getMainLooper())
private val remoteConfig = Firebase.remoteConfig private val remoteConfig = Firebase.remoteConfig
private var mediaPlayer: MediaPlayer? = null
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setLayoutParams(binding.ivText, start = 0, end = 0, top = 390, bottom = 0) // setLayoutParams(binding.ivText, start = 0, end = 0, top = 390, bottom = 0)
setLayoutParams(binding.ivTextLogo, start = 0, end = 0, top = 0, bottom = 150) // setLayoutParams(binding.ivTextLogo, start = 0, end = 0, top = 0, bottom = 150)
setupRemoteConfig() 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( private fun setLayoutParams(

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

View File

@ -4,7 +4,7 @@
android:shape="rectangle"> android:shape="rectangle">
<gradient <gradient
android:type="linear" android:type="linear"
android:startColor="@color/color_a0e2ff" android:startColor="#ebecf3"
android:endColor="@color/color_ecfaff" android:endColor="#e8eaf1"
android:angle="90" /> android:angle="90" />
</shape> </shape>

View File

@ -1,38 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:background="@drawable/gradient_splash">
<ImageView <SurfaceView
android:layout_width="0dp" android:id="@+id/surface_view"
android:layout_height="0dp" android:layout_width="match_parent"
android:contentDescription="@null" android:layout_height="match_parent"
android:scaleType="centerCrop" android:background="@drawable/gradient_splash" />
android:src="@drawable/splash_bg" </RelativeLayout>
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/splash_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_text_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/splash_logo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.