Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UI/#35] splash screen 구현 #38

Merged
merged 9 commits into from
Jan 8, 2024
Prev Previous commit
[CHORE/#28] 함수 수정
  • Loading branch information
chattymin committed Jan 8, 2024
commit a32c2f015d8f6a1ca5912bfc41eb1de8ced6139f
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import androidx.activity.result.contract.ActivityResultContracts
import com.going.presentation.R
import com.going.presentation.auth.SignInActivity
import com.going.presentation.databinding.ActivitySplashBinding
import com.going.ui.base.BaseActivity
import com.going.ui.extension.toast

class SplashActivity : BaseActivity<ActivitySplashBinding>(R.layout.activity_splash) {
override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -27,6 +25,17 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(R.layout.activity_spl
}
}

private fun initSplash() {
Handler(Looper.getMainLooper()).postDelayed({
navigateToSignInScreen()
if (false) { // 자동 로그인 판정으로 변경 예정
navigateToMainScreen()
} else {
navigateToSignInScreen()
}
}, 3000)
}

private fun showNetworkErrorAlertDialog() =
AlertDialog.Builder(this)
.setTitle(R.string.notice)
Expand All @@ -40,17 +49,6 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(R.layout.activity_spl
.create()
.show()

private fun initSplash() {
Handler(Looper.getMainLooper()).postDelayed({
navigateToSignInScreen()
if (false) { // 자동 로그인 판정으로 변경 예정
navigateToMainScreen()
} else {
navigateToSignInScreen()
}
}, 3000)
}

private fun navigateToMainScreen() {
// Main이 나오면 구현 예정
finish()
Expand All @@ -62,12 +60,4 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(R.layout.activity_spl
}
finish()
}

private val activityResultLauncher =
registerForActivityResult(ActivityResultContracts.StartIntentSenderForResult()) {
if (it.resultCode != RESULT_OK) {
toast(getString(R.string.splash_update_error))
finishAffinity()
}
}
}