-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
49 changed files
with
1,415 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
domain/src/main/kotlin/co/orange/domain/enums/MobileType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package co.orange.domain.enums | ||
|
||
enum class MobileType(val description: String) { | ||
SKT("SKT"), | ||
KT("KT"), | ||
LG("LG U+"), | ||
SKT_A("SKT 알뜰폰"), | ||
KT_A("KT 알뜰폰"), | ||
LG_A("LG U+ 알뜰폰"), | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions
31
presentation/src/main/java/co/orange/presentation/auth/login/LoginActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package co.orange.presentation.auth.login | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.activity.viewModels | ||
import co.orange.presentation.auth.signup.SignUpActivity | ||
import dagger.hilt.android.AndroidEntryPoint | ||
import kr.genti.core.base.BaseActivity | ||
import kr.genti.core.extension.setOnSingleClickListener | ||
import kr.genti.presentation.R | ||
import kr.genti.presentation.databinding.ActivityLoginBinding | ||
|
||
@AndroidEntryPoint | ||
class LoginActivity : BaseActivity<ActivityLoginBinding>(R.layout.activity_login) { | ||
private val viewModel by viewModels<LoginViewModel>() | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
initLoginBtnListener() | ||
} | ||
|
||
private fun initLoginBtnListener() { | ||
binding.btnLoginKakao.setOnSingleClickListener { | ||
Intent(this, SignUpActivity::class.java).apply { | ||
startActivity(this) | ||
} | ||
finish() | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
presentation/src/main/java/co/orange/presentation/auth/login/LoginViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package co.orange.presentation.auth.login | ||
|
||
import androidx.lifecycle.ViewModel | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class LoginViewModel | ||
@Inject | ||
constructor( | ||
// private val authRepository: AuthRepository, | ||
) : ViewModel() |
48 changes: 48 additions & 0 deletions
48
presentation/src/main/java/co/orange/presentation/auth/signup/MobileBottomSheet.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package co.orange.presentation.auth.signup | ||
|
||
import android.os.Bundle | ||
import android.view.View | ||
import androidx.fragment.app.activityViewModels | ||
import co.orange.domain.enums.MobileType | ||
import kr.genti.core.base.BaseBottomSheet | ||
import kr.genti.core.extension.setOnSingleClickListener | ||
import kr.genti.presentation.R | ||
import kr.genti.presentation.databinding.BottomSheetMobileBinding | ||
|
||
class MobileBottomSheet : | ||
BaseBottomSheet<BottomSheetMobileBinding>(R.layout.bottom_sheet_mobile) { | ||
private val viewModel by activityViewModels<SignUpViewModel>() | ||
|
||
override fun onStart() { | ||
super.onStart() | ||
dialog?.window?.setBackgroundDrawableResource(R.color.transparent) | ||
} | ||
|
||
override fun onViewCreated( | ||
view: View, | ||
savedInstanceState: Bundle?, | ||
) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
initBtnsListener() | ||
} | ||
|
||
private fun initBtnsListener() { | ||
with(binding) { | ||
btnMobileSkt.setOnSingleClickListener { setMobile(MobileType.SKT) } | ||
btnMobileKt.setOnSingleClickListener { setMobile(MobileType.KT) } | ||
btnMobileLg.setOnSingleClickListener { setMobile(MobileType.LG) } | ||
btnMobileSktA.setOnSingleClickListener { setMobile(MobileType.SKT_A) } | ||
btnMobileKtA.setOnSingleClickListener { setMobile(MobileType.KT_A) } | ||
btnMobileLgA.setOnSingleClickListener { setMobile(MobileType.LG_A) } | ||
} | ||
} | ||
|
||
private fun setMobile(mobileType: MobileType) { | ||
with(viewModel) { | ||
mobile.value = mobileType.description | ||
isMobileFinished.value = true | ||
} | ||
dismiss() | ||
} | ||
} |
111 changes: 111 additions & 0 deletions
111
presentation/src/main/java/co/orange/presentation/auth/signup/SignUpActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
package co.orange.presentation.auth.signup | ||
|
||
import android.os.Bundle | ||
import androidx.activity.viewModels | ||
import dagger.hilt.android.AndroidEntryPoint | ||
import kr.genti.core.base.BaseActivity | ||
import kr.genti.core.extension.hideKeyboard | ||
import kr.genti.core.extension.initFocusWithKeyboard | ||
import kr.genti.core.extension.setOnSingleClickListener | ||
import kr.genti.presentation.R | ||
import kr.genti.presentation.databinding.ActivitySignUpBinding | ||
|
||
@AndroidEntryPoint | ||
class SignUpActivity : BaseActivity<ActivitySignUpBinding>(R.layout.activity_sign_up) { | ||
private val viewModel by viewModels<SignUpViewModel>() | ||
|
||
private var mobileBottomSheet: MobileBottomSheet? = null | ||
private var termBottomSheet: TermBottomSheet? = null | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
binding.vm = viewModel | ||
initConfirmBtnListener() | ||
initMobileBtnListener() | ||
initVerifyBtnListener() | ||
observeBirthFrontFinished() | ||
observeBirthBackFinished() | ||
observeMobileFinished() | ||
observePhoneFinished() | ||
observeCodeFinished() | ||
} | ||
|
||
private fun initConfirmBtnListener() { | ||
binding.btnConfirm.setOnSingleClickListener { | ||
termBottomSheet = TermBottomSheet() | ||
termBottomSheet?.show(supportFragmentManager, BOTTOM_SHEET_TERM) | ||
} | ||
} | ||
|
||
private fun initMobileBtnListener() { | ||
binding.btnSelectMobile.setOnSingleClickListener { showMobileBottomSheet() } | ||
} | ||
|
||
private fun showMobileBottomSheet() { | ||
mobileBottomSheet = MobileBottomSheet() | ||
mobileBottomSheet?.show(supportFragmentManager, BOTTOM_SHEET_MOBILE) | ||
} | ||
|
||
private fun initVerifyBtnListener() { | ||
binding.btnPhoneCertify.setOnSingleClickListener { | ||
// TODO 서버통신 | ||
} | ||
} | ||
|
||
private fun observeBirthFrontFinished() { | ||
viewModel.isBirthFrontFinished.observe(this) { isFinished -> | ||
if (isFinished) { | ||
binding.etSignUpBirthBack.requestFocus() | ||
} | ||
} | ||
} | ||
|
||
private fun observeBirthBackFinished() { | ||
viewModel.isBirthBackFinished.observe(this) { isFinished -> | ||
if (isFinished) { | ||
currentFocus?.let { hideKeyboard(it) } | ||
currentFocus?.clearFocus() | ||
showMobileBottomSheet() | ||
} | ||
} | ||
} | ||
|
||
private fun observeMobileFinished() { | ||
viewModel.isMobileFinished.observe(this) { isFinished -> | ||
if (isFinished) { | ||
initFocusWithKeyboard(binding.etSignUpPhone) | ||
} | ||
} | ||
} | ||
|
||
private fun observePhoneFinished() { | ||
viewModel.isPhoneFinished.observe(this) { isFinished -> | ||
if (isFinished) { | ||
currentFocus?.let { hideKeyboard(it) } | ||
currentFocus?.clearFocus() | ||
} | ||
} | ||
} | ||
|
||
private fun observeCodeFinished() { | ||
viewModel.isCodeFinished.observe(this) { isFinished -> | ||
if (isFinished) { | ||
currentFocus?.let { hideKeyboard(it) } | ||
currentFocus?.clearFocus() | ||
} | ||
} | ||
} | ||
|
||
override fun onDestroy() { | ||
super.onDestroy() | ||
|
||
mobileBottomSheet = null | ||
termBottomSheet = null | ||
} | ||
|
||
companion object { | ||
private const val BOTTOM_SHEET_MOBILE = "BOTTOM_SHEET_MOBILE" | ||
private const val BOTTOM_SHEET_TERM = "BOTTOM_SHEET_TERM" | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
presentation/src/main/java/co/orange/presentation/auth/signup/SignUpViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package co.orange.presentation.auth.signup | ||
|
||
import androidx.lifecycle.MutableLiveData | ||
import androidx.lifecycle.ViewModel | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class SignUpViewModel | ||
@Inject | ||
constructor( | ||
// private val authRepository: AuthRepository, | ||
) : ViewModel() { | ||
val name = MutableLiveData<String>() | ||
val isNameFinished = MutableLiveData(false) | ||
|
||
val birthFront = MutableLiveData<String>() | ||
val isBirthFrontFinished = MutableLiveData(false) | ||
|
||
val birthBack = MutableLiveData<String>() | ||
val isBirthBackFinished = MutableLiveData(false) | ||
|
||
val mobile = MutableLiveData<String>("선택해주세요") | ||
val isMobileFinished = MutableLiveData(false) | ||
|
||
val phone = MutableLiveData<String>() | ||
val isPhoneFinished = MutableLiveData(false) | ||
|
||
val code = MutableLiveData<String>() | ||
val isCodeFinished = MutableLiveData(false) | ||
|
||
val isCompleted = MutableLiveData(false) | ||
|
||
fun checkNameFinished() { | ||
isNameFinished.value = name.value?.isNotEmpty() | ||
checkIsCompleted() | ||
} | ||
|
||
fun checkBirthFrontFinished() { | ||
isBirthFrontFinished.value = birthFront.value?.length == 6 | ||
checkIsCompleted() | ||
} | ||
|
||
fun checkBirthBackFinished() { | ||
isBirthBackFinished.value = birthBack.value?.length == 1 | ||
checkIsCompleted() | ||
} | ||
|
||
fun checkPhoneFinished() { | ||
isPhoneFinished.value = phone.value?.length == 11 | ||
} | ||
|
||
fun checkCodeFinished() { | ||
isCodeFinished.value = code.value?.length == 6 | ||
checkIsCompleted() | ||
} | ||
|
||
fun checkIsCompleted() { | ||
isCompleted.value = | ||
(isNameFinished.value == true && isBirthFrontFinished.value == true && isBirthBackFinished.value == true && isMobileFinished.value == true && isPhoneFinished.value == true && isCodeFinished.value == true) | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
presentation/src/main/java/co/orange/presentation/auth/signup/TermBottomSheet.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package co.orange.presentation.auth.signup | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.view.View | ||
import androidx.fragment.app.activityViewModels | ||
import co.orange.presentation.auth.submit.SubmitActivity | ||
import kr.genti.core.base.BaseBottomSheet | ||
import kr.genti.core.extension.setOnSingleClickListener | ||
import kr.genti.presentation.R | ||
import kr.genti.presentation.databinding.BottomSheetTermBinding | ||
|
||
class TermBottomSheet : | ||
BaseBottomSheet<BottomSheetTermBinding>(R.layout.bottom_sheet_term) { | ||
private val viewModel by activityViewModels<SignUpViewModel>() | ||
|
||
override fun onStart() { | ||
super.onStart() | ||
dialog?.window?.setBackgroundDrawableResource(R.color.transparent) | ||
} | ||
|
||
override fun onViewCreated( | ||
view: View, | ||
savedInstanceState: Bundle?, | ||
) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
initTermBtnsListener() | ||
initSubmitBtnListener() | ||
} | ||
|
||
private fun initTermBtnsListener() { | ||
with(binding) { | ||
// TODO | ||
} | ||
} | ||
|
||
private fun initSubmitBtnListener() { | ||
binding.btnSubmit.setOnSingleClickListener { | ||
Intent(requireActivity(), SubmitActivity::class.java).apply { | ||
startActivity(this) | ||
} | ||
requireActivity().finish() | ||
dismiss() | ||
} | ||
} | ||
} |
Oops, something went wrong.