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
리스너(Euphony) 함수 추가 및 MainActivity에 onClickListener 추가 #8
Conversation
우선 첫 pr이네요! 넘넘 수고하셨습니다! 👍👍👍👍👍👍 |
@@ -21,10 +22,23 @@ class MainActivity : AppCompatActivity() { | |||
model.listenData.observe(this, Observer { | |||
binding.tvNum.text = it.toString() | |||
}) | |||
|
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.btnListen.setOnClickListener { model.listener() } |
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.
코틀린이 처음이라고 하셔서요! 피드백을 드리자면 코틀린은 함수형 프로그래밍 언어이기 때문에 자바보다 훨씬 간결하게 코드를 짤 수 있습니다! 이게 코틀린의 장점이죠!! MainActivity에 새로 추가하신 모든 초록색 코드 대신에 이 한줄로 표현할 수 있습니다!
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.
저도 코틀린이 처음이라 저렇게 한 줄로 표현이 가능한지 몰랐네요..!
배우고 갑니당 감사해요 ㅎㅎ
고생하셨습니다!! mvvm 패턴 공부해봤는데 왜 어렵다 하셨는지 알았습니다ㅠ |
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.
저도 코틀린이 처음인데 쉬운듯 하면서 어렵네요..! 고생하셨씁니다!!!
네넵 찾아보니까 대부분의 정보처리는 VeiwModel에서 일어나는 것 같아서 MainViewModel에 있는 listener함수를 사용하시면 될 것 같습니다! |
우선 진산님하고 만들기로 한 리스너를 만들기 위해서 버튼을 받아오는 onClickListener를 만들고 listener()함수를 viewModel에 만들었습니다. 코틀린도 처음이고 mvvm 모델도 처음이라 맞게 한건지 모르겠네요ㅠㅠ 혹독한 피드백 부탁드립니다!