-
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 생년월일 입력 화면 #39
base: develop
Are you sure you want to change the base?
The head ref may contain hidden characters: "feat/#16-\uC0DD\uB144\uC6D4\uC77C-\uC785\uB825-\uD654\uBA74"
Conversation
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.
같은 패턴의 함수들이 보이네요
단순 view 이벤트 처리들은 view 에서 직접해결하도록 하고
viewmodel 이 필요 없다면 굳이 구현하지 않아도 됩니다.
databinding -> viewbinding 으로 넘어가는 추세이기에
databinding은 지양해줘요~!
private val _btnNext: SingleLiveEvent<Unit> = SingleLiveEvent() | ||
val btnNext: LiveData<Unit> = _btnNext | ||
|
||
fun onClickCheckButton() { |
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.
단순 button click 이벤트들은 databinding 을 지양하고
fragment에서 활용해주면 됩니다.
또한 observer 도 없네요~!
initTextWatcher() | ||
} | ||
|
||
override fun initObserver() { |
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.
with()
을 사용할 땐
override fun initObserver) = with(viewModel){
.......
}
이렇게 사용하면 코드 줄 수도 줄어들고 불필요한 괄호도 사라집니다.
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.
넵! 바로 반영하겠습니다!
binding.birthdateEt.setSelection(binding.birthdateEt.text.length) | ||
|
||
}else if(textlength == 8 && binding.birthdateEt.text.toString().substring(7,8) != "-" && | ||
!binding.birthdateEt.text.toString().substring(0,4).contains('-') && |
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.
! 보단 뒤에 .not()을 사용하면 가독이 오르고
또한 각 숫자들이 의미하는 바가 뭔지 알기 어렵습니다.
매직넘버들은 상수화 해줘요~!
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.
오옹! 그렇군요! 바로 수정하겠습니다!
} | ||
|
||
override fun afterTextChanged(s: Editable?) { | ||
} |
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.
비어있는 함수들은 = Unit
처리해주면 좋습니다.
val _birthDate: MutableLiveData<String> = MutableLiveData("") | ||
val birthDate: LiveData<String> = _birthDate | ||
|
||
fun onClickCheckButton() { |
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.
여기도 이벤트 그냥 activity, fragment 에서 하도록 해줘요~!
🧨이슈
🔍 상세 내용 (해결 내용)
💡 참고자료 및 공유할만한 자료 (선택)
❕후속 진행 이슈