Conversation
JJJoonngg
reviewed
Dec 18, 2023
Member
JJJoonngg
left a comment
There was a problem hiding this comment.
같은 패턴의 함수들이 보이네요
단순 view 이벤트 처리들은 view 에서 직접해결하도록 하고
viewmodel 이 필요 없다면 굳이 구현하지 않아도 됩니다.
databinding -> viewbinding 으로 넘어가는 추세이기에
databinding은 지양해줘요~!
| private val _btnNext: SingleLiveEvent<Unit> = SingleLiveEvent() | ||
| val btnNext: LiveData<Unit> = _btnNext | ||
|
|
||
| fun onClickCheckButton() { |
Member
There was a problem hiding this comment.
단순 button click 이벤트들은 databinding 을 지양하고
fragment에서 활용해주면 됩니다.
또한 observer 도 없네요~!
| initTextWatcher() | ||
| } | ||
|
|
||
| override fun initObserver() { |
Member
There was a problem hiding this comment.
with()을 사용할 땐
override fun initObserver) = with(viewModel){
.......
}
이렇게 사용하면 코드 줄 수도 줄어들고 불필요한 괄호도 사라집니다.
| 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('-') && |
Member
There was a problem hiding this comment.
! 보단 뒤에 .not()을 사용하면 가독이 오르고
또한 각 숫자들이 의미하는 바가 뭔지 알기 어렵습니다.
매직넘버들은 상수화 해줘요~!
| } | ||
|
|
||
| override fun afterTextChanged(s: Editable?) { | ||
| } |
| val _birthDate: MutableLiveData<String> = MutableLiveData("") | ||
| val birthDate: LiveData<String> = _birthDate | ||
|
|
||
| fun onClickCheckButton() { |
Member
There was a problem hiding this comment.
여기도 이벤트 그냥 activity, fragment 에서 하도록 해줘요~!
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🧨이슈
🔍 상세 내용 (해결 내용)
💡 참고자료 및 공유할만한 자료 (선택)
❕후속 진행 이슈