-
Notifications
You must be signed in to change notification settings - Fork 0
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
[feat] 회원가입 뷰 구현 #16
[feat] 회원가입 뷰 구현 #16
Changes from 25 commits
9a003a4
30e48b7
07e02f7
af4a56a
e75028e
55dae8c
9030315
b8aa361
95b4545
88c1c4d
7f161c6
fc3ad79
c93e5bd
a80fa3e
ccda175
8eea2bc
751a6ac
0af1079
710aa3d
2b7aaa7
e7f8776
0e9598e
6477d7d
24e0101
feb80b6
e0adf6b
8921cb0
9a55011
356589e
4f24740
d32711e
299fd4d
393dbc4
f19ef2a
f032a27
6940b24
9ae09c1
42592b6
8d92b5f
e3eb8cb
885460b
45968d5
73c17fc
d634f14
ff9f6a8
4e878d1
b726a43
c06e195
0f5485e
e45bbbb
adbe6fc
45a6d8c
3d21e29
2655456
83ced83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.sopt.geonppang.presentation.signup.view | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.activity.viewModels | ||
import com.sopt.geonppang.R | ||
import com.sopt.geonppang.databinding.ActivitySignupEmailBinding | ||
import com.sopt.geonppang.presentation.signup.viewmodel.SignUpViewModel | ||
import com.sopt.geonppang.util.binding.BindingActivity | ||
import com.sopt.geonppang.util.extension.hideKeyboard | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@AndroidEntryPoint | ||
class SignUpEmailActivity : | ||
BindingActivity<ActivitySignupEmailBinding>(R.layout.activity_signup_email) { | ||
private val viewModel: SignUpViewModel by viewModels() | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding.viewModel = viewModel | ||
binding.lifecycleOwner = this | ||
// binding에서 LiveData를 사용할 경우 해당 코드 필요 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 주석 삭제 |
||
|
||
addListeners() | ||
} | ||
|
||
private fun initLayout() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 사용하지 않은 함수 삭제 |
||
TODO("Not yet implemented") | ||
} | ||
|
||
private fun addListeners() { | ||
binding.root.setOnClickListener { | ||
hideKeyboard(it) | ||
} | ||
binding.btnNext.setOnClickListener { | ||
moveToPassword() | ||
} | ||
} | ||
|
||
private fun addObservers() { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
private fun moveToPassword() { | ||
startActivity(Intent(this, SignUpPasswordActivity::class.java)) | ||
finish() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.sopt.geonppang.presentation.signup.view | ||
|
||
import android.os.Bundle | ||
import androidx.activity.viewModels | ||
import com.sopt.geonppang.R | ||
import com.sopt.geonppang.databinding.ActivitySignupNicknameBinding | ||
import com.sopt.geonppang.presentation.signup.viewmodel.SignUpViewModel | ||
import com.sopt.geonppang.util.binding.BindingActivity | ||
import com.sopt.geonppang.util.extension.hideKeyboard | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@AndroidEntryPoint | ||
class SignUpNicknameActivity : | ||
BindingActivity<ActivitySignupNicknameBinding>(R.layout.activity_signup_nickname) { | ||
private val viewModel: SignUpViewModel by viewModels() | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding.viewModel = viewModel | ||
binding.lifecycleOwner = this | ||
// binding에서 LiveData를 사용할 경우 해당 코드 필요 | ||
|
||
addListeners() | ||
} | ||
|
||
private fun initLayout() { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
private fun addListeners() { | ||
binding.root.setOnClickListener { | ||
hideKeyboard(it) | ||
} | ||
} | ||
|
||
private fun addObservers() { | ||
TODO("Not yet implemented") | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.sopt.geonppang.presentation.signup.view | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.activity.viewModels | ||
import com.sopt.geonppang.R | ||
import com.sopt.geonppang.databinding.ActivitySignupPasswordBinding | ||
import com.sopt.geonppang.presentation.signup.viewmodel.SignUpViewModel | ||
import com.sopt.geonppang.util.binding.BindingActivity | ||
import com.sopt.geonppang.util.extension.hideKeyboard | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@AndroidEntryPoint | ||
class SignUpPasswordActivity : | ||
BindingActivity<ActivitySignupPasswordBinding>(R.layout.activity_signup_password) { | ||
private val viewModel: SignUpViewModel by viewModels() | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding.viewModel = viewModel | ||
binding.lifecycleOwner = this | ||
// binding에서 LiveData를 사용할 경우 해당 코드 필요 | ||
|
||
addListeners() | ||
} | ||
|
||
private fun initLayout() { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
private fun addListeners() { | ||
binding.root.setOnClickListener { | ||
hideKeyboard(it) | ||
} | ||
binding.btnNext.setOnClickListener { | ||
moveToNickname() | ||
} | ||
} | ||
|
||
private fun addObservers() { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
private fun moveToNickname() { | ||
startActivity(Intent(this, SignUpNicknameActivity::class.java)) | ||
finish() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,76 @@ | ||||||||
package com.sopt.geonppang.presentation.signup.viewmodel | ||||||||
|
||||||||
import androidx.lifecycle.LiveData | ||||||||
import androidx.lifecycle.MediatorLiveData | ||||||||
import androidx.lifecycle.MutableLiveData | ||||||||
import androidx.lifecycle.ViewModel | ||||||||
import androidx.lifecycle.map | ||||||||
import dagger.hilt.android.lifecycle.HiltViewModel | ||||||||
import javax.inject.Inject | ||||||||
|
||||||||
@HiltViewModel | ||||||||
class SignUpViewModel @Inject constructor() : ViewModel() { | ||||||||
val email = MutableLiveData("") | ||||||||
val password = MutableLiveData("") | ||||||||
val password_check = MutableLiveData("") | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 변수명 passwordCheck camelcase 지켜주세요 |
||||||||
val nickname = MutableLiveData("") | ||||||||
|
||||||||
val isValidEmail: LiveData<Boolean> = email.map { email -> | ||||||||
email.matches(Regex(EMAIL_PATTERN)) | ||||||||
} | ||||||||
|
||||||||
val isValidNickname: LiveData<Boolean> = nickname.map { nickname -> | ||||||||
nickname.matches(Regex(NICKNAME_PATTERN)) | ||||||||
} | ||||||||
|
||||||||
val isValidPassword: LiveData<Boolean> = password.map { password -> | ||||||||
password.matches(Regex(PASSWORD_PATTERN)) | ||||||||
} | ||||||||
|
||||||||
val isValidPasswordCheck: LiveData<Boolean> = password_check.map { password_check -> | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 삭제 ~ |
||||||||
password_check.matches(Regex(PASSWORD_PATTERN)) | ||||||||
} | ||||||||
val doubleCheckEmail = MediatorLiveData<Boolean>().apply { | ||||||||
// Todo 중복 확인 구현 예정 | ||||||||
} | ||||||||
val doubleCheckNickname = MediatorLiveData<Boolean>().apply { | ||||||||
// Todo 닉네임 중복 확인 구현 예정 | ||||||||
} | ||||||||
|
||||||||
/*다음 버튼 활성화*/ | ||||||||
val completeEmail = MediatorLiveData<Boolean>().apply { | ||||||||
addSource(email) { value = checkEmailCondition() } | ||||||||
} | ||||||||
|
||||||||
/*다음 버튼 활성화*/ | ||||||||
val completePassword = MediatorLiveData<Boolean>().apply { | ||||||||
addSource(password) { value = isPasswordSame() } | ||||||||
addSource(password_check) { value = isPasswordSame() } | ||||||||
} | ||||||||
|
||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isValidEmail 이런 애들이 유효하면 다음 버튼 활성화 시키면 되겠죵 ~~ |
||||||||
val completeNickname = MediatorLiveData<Boolean>().apply { | ||||||||
addSource(nickname) { value = checkNicknameCondition() } | ||||||||
/*다음 버튼 활성화*/ | ||||||||
} | ||||||||
|
||||||||
private fun isPasswordSame(): Boolean { | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
return password.value.toString() == password_check.value.toString() && !password.value.isNullOrBlank() && !password_check.value.isNullOrBlank() | ||||||||
} | ||||||||
|
||||||||
// TODO 이메일 조건 | ||||||||
private fun checkEmailCondition(): Boolean { | ||||||||
return isValidEmail.value == true | ||||||||
} | ||||||||
|
||||||||
// TODO 닉네임 조건 | ||||||||
private fun checkNicknameCondition(): Boolean { | ||||||||
return isValidNickname.value == true | ||||||||
} | ||||||||
|
||||||||
companion object { | ||||||||
const val EMAIL_PATTERN = "^[a-zA-Z0-9+-\\_.]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+\$" | ||||||||
const val NICKNAME_PATTERN = "[가-힣]*[A-Za-z[0-9]]{2,10}\$" | ||||||||
const val PASSWORD_PATTERN = | ||||||||
"^(?=.*[A-Za-z])(?=.*[0-9])(?=.*[\$@\$!%*#?&.])[A-Za-z[0-9]\$@\$!%*#?&.]{6,12}\$" | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 정규식 옳은 정규식인지 꼭 확인해주셍ㅇ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 나머지 리뷰는 내일 달겠습니다 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ 파업이슈 |
||||||||
} | ||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
package com.sopt.geonppang.util | ||
package com.sopt.geonppang.util.binding | ||
|
||
import android.view.View | ||
import android.widget.ImageView | ||
import androidx.core.view.isVisible | ||
import androidx.databinding.BindingAdapter | ||
import coil.load | ||
|
||
@BindingAdapter("image") | ||
fun ImageView.setImage(imageUrl: String) { | ||
this.load(imageUrl) | ||
} | ||
|
||
@BindingAdapter("visibility") | ||
fun View.setVisibility(isVisible: Boolean?) { | ||
if (isVisible == null) return | ||
this.isVisible = isVisible | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:state_pressed="true"> | ||
<shape> | ||
<stroke android:width="1dp" android:color="#1C6739" /> | ||
<corners android:radius="12dp" /> | ||
</shape> | ||
</item> | ||
|
||
<item android:state_pressed="false"> | ||
<shape> | ||
<stroke android:width="1dp" android:color="#CBC8C5"/> | ||
<corners android:radius="12dp" /> | ||
</shape> | ||
</item> | ||
</selector> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<stroke | ||
android:width="1dp" | ||
android:color="@color/gray_300" /> | ||
<corners android:radius="12dp" /> | ||
</shape> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<stroke | ||
android:width="1dp" | ||
android:color="@color/main_2" /> | ||
<corners android:radius="12dp" /> | ||
</shape> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item | ||
android:state_enabled="true" | ||
android:drawable="@drawable/background_btn_double_check_enable"/> | ||
<item | ||
android:state_enabled="false" | ||
android:drawable="@drawable/background_btn_double_check_disable"/> | ||
</selector> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:state_enabled="true"> | ||
<shape> | ||
<solid android:color="#1C6739" /> | ||
<corners android:radius="12dp" /> | ||
</shape> | ||
</item> | ||
|
||
<item android:state_enabled="false"> | ||
<shape> | ||
<solid android:color="#EBEBEB" /> | ||
<corners android:radius="12dp" /> | ||
</shape> | ||
</item> | ||
</selector> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item | ||
android:bottom="1dp" | ||
android:left="1dp" | ||
android:right="1dp" | ||
android:top="1dp"> | ||
<shape android:shape="rectangle" > | ||
<stroke | ||
android:width="1dp" | ||
android:color="#FF2633" /> | ||
<solid android:color="#FAF7F2" /> | ||
<corners android:radius="10dp"/> | ||
</shape> | ||
</item> | ||
</layer-list> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item | ||
android:bottom="1dp" | ||
android:left="1dp" | ||
android:right="1dp" | ||
android:top="1dp"> | ||
<shape android:shape="rectangle" > | ||
<solid android:color="#FAF7F2" /> | ||
<corners android:radius="10dp"/> | ||
</shape> | ||
</item> | ||
</layer-list> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:state_enabled="true" | ||
android:color="@color/main_2" /> | ||
<item android:state_enabled="false" | ||
android:color="@color/gray_300" /> | ||
</selector> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:state_enabled="true" | ||
android:color="@color/gray_200" /> | ||
<item android:state_enabled="false" | ||
android:color="@color/gray_400" /> | ||
</selector> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:pathData="M15,5L8,12L15,19" | ||
android:strokeLineJoin="round" | ||
android:strokeWidth="2.3" | ||
android:fillColor="#00000000" | ||
android:strokeColor="#262525" | ||
android:strokeLineCap="round"/> | ||
</vector> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="36dp" | ||
android:height="14dp" | ||
android:viewportWidth="36" | ||
android:viewportHeight="14"> | ||
<path | ||
android:pathData="M10.787,0.816V13.285H9.023V0.816H10.787ZM0.738,6.121C0.731,3.407 2.119,1.691 4.033,1.691C5.906,1.691 7.301,3.407 7.301,6.121C7.301,8.855 5.906,10.564 4.033,10.564C2.119,10.564 0.731,8.855 0.738,6.121ZM2.42,6.121C2.413,7.974 3.063,8.985 4.033,8.979C4.977,8.985 5.612,7.974 5.619,6.121C5.612,4.275 4.977,3.264 4.033,3.264C3.063,3.264 2.413,4.275 2.42,6.121ZM17.773,2.102V5.342H19.018V0.994H20.658V12.684H19.018V6.736H17.773V10.127H12.824V2.102H17.773ZM14.451,8.76H16.146V3.482H14.451V8.76ZM21.588,13.258V0.816H23.256V13.258H21.588ZM28.109,1.186C30.003,1.179 31.425,2.368 31.432,4.029C31.425,5.677 30.003,6.853 28.109,6.859C26.188,6.853 24.76,5.677 24.76,4.029C24.76,2.368 26.188,1.179 28.109,1.186ZM26.455,4.029C26.441,4.918 27.146,5.444 28.109,5.451C29.053,5.444 29.743,4.918 29.75,4.029C29.743,3.134 29.053,2.607 28.109,2.607C27.152,2.607 26.441,3.134 26.455,4.029ZM26.633,8.91V7.57H34.986V10.947H28.369V11.754H35.328V13.121H26.66V9.676H33.25V8.91H26.633ZM33.236,7.051V0.816H34.986V7.051H33.236Z" | ||
android:fillColor="#878784"/> | ||
</vector> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 다시 되돌려주세용~~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그리고 지금보니까 왜 엑티비티들이 하나도 메니페스트에 추가가 안돼있을까용?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 얘는 빼고 머지 해야하나 싶어서 아직 안 해뒀어요 이번에 푸시할겠슴다