-
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/#5 week2 xml 필수과제 구현 #7
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.
코멘트를 빨아들이는 속도가 스펀지 뺨치네요
제 모든코드 호로록 가져가시길 바랍니다 ㅋㅋ
(holder as UserViewHolder).ivProfile.setImageResource(item.profileImage) | ||
holder.tvName.text = item.name | ||
holder.tvSelfDescription.text = item.selfDescription | ||
holder.setIsRecyclable(false) |
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를 활용해보면 좋을것 같아요~
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.
homeListList.getOrNull(position) = 해당 index에 값이 없으면 exception을 던지는 것이 아닌 null을 반환하기 때문에 조금 더 안전한 개발이 가능합니다
val ivProfile: ImageView = view.findViewById(R.id.iv_profile) | ||
val tvName: TextView = view.findViewById(R.id.tv_name) | ||
val tvSelfDescription: TextView = view.findViewById(R.id.tv_self_description) |
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.
헉.
findViewById는 사용 금지!!!!!!!!!!!!!!!!!!
다른 방법을 찾아봅시다!!!!!!!!!
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.
바인딩 객체를 인자로 받아 구현하는 편이 좋겠네요~
val intent = Intent(this, MainActivity::class.java) | ||
saveUserInfo(id,pw,nick) | ||
startActivity(intent) |
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.
Scope 함수를 활용해봐용~
private fun saveUserInfo(id:String,pw:String,nick:String) { | ||
val sharedPreferences = getSharedPreferences("userInfo", MODE_PRIVATE) | ||
val editor = sharedPreferences.edit() | ||
editor | ||
.putString("userId", id) | ||
.putString("userPw", pw) | ||
.putString("userNick", nick) | ||
.apply() | ||
} |
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.
헉 sharedPreference 너무 좋아요!!
그런데 데이터를 가져오는 과정은 View보다는 ViewModel에 적합한 코드 같네요!! 수정해볼까용~
companion object { | ||
const val MIN_ID_LENGTH = 6 | ||
const val MAX_ID_LENGTH = 10 | ||
const val MIN_PW_LENGTH = 8 | ||
const val MAX_PW_LENGTH = 12 | ||
} |
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.
코멘트를 달고 싶지만 달게 없네요,, 왜 이렇게 잘하는거야
val ivProfile: ImageView = view.findViewById(R.id.iv_profile) | ||
val tvName: TextView = view.findViewById(R.id.tv_name) | ||
val tvSelfDescription: TextView = view.findViewById(R.id.tv_self_description) |
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.
너무 잘하시네요!! 👍👍
adapter = homeListAdapter | ||
layoutManager = LinearLayoutManager(requireContext()) | ||
} | ||
homeListAdapter.setHomeList(HomeListData.homeListData) |
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.
리스트 데이터를 따로 저장해서 사용하니까 코드가 확실히 간단해지네요!!
private fun getUserInfo() { | ||
val userInfo = activity?.getSharedPreferences("userInfo", Context.MODE_PRIVATE) | ||
binding.tvMainNick.text = userInfo?.getString("userNick", "") | ||
binding.tvMainId.text = userInfo?.getString("userId", "") | ||
binding.tvMainPw.text = userInfo?.getString("userPw", "") | ||
} |
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.
SharedPreferences를 사용하여 코드가 간단하고 직관적이네요!
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.
갓기 혜음아 엄청난 코드 잘보고 간다 ^&^
(holder as UserViewHolder).ivProfile.setImageResource(item.profileImage) | ||
holder.tvName.text = item.name | ||
holder.tvSelfDescription.text = item.selfDescription | ||
holder.setIsRecyclable(false) |
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.
homeListList.getOrNull(position) = 해당 index에 값이 없으면 exception을 던지는 것이 아닌 null을 반환하기 때문에 조금 더 안전한 개발이 가능합니다
selfDescription = "멀티 뷰 리싸이클러뷰!", | ||
0 | ||
), |
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.
HomeList.VIEW_TYPE_USER 상수를 만들었으니 상수를 활용하는 것이 좋아보여요!
…ID/hyeumm-song into feat/#5-week2_xml
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.
매주 빠르게 발전하는 코드 잘 보고갑니다!!
최고~
val intent = Intent(this, MainActivity::class.java).apply { | ||
saveUserInfo(id, pw, nick) | ||
} |
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.run { | ||
ivProfile.setImageResource(friendData.profileImage) | ||
tvName.text = friendData.name | ||
tvSelfDescription.text = friendData.selfDescription | ||
} |
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.
구우우우웃!!!
📌𝘐𝘴𝘴𝘶𝘦𝘴
📎𝘞𝘰𝘳𝘬 𝘋𝘦𝘴𝘤𝘳𝘪𝘱𝘵𝘪𝘰𝘯
📷𝘚𝘤𝘳𝘦𝘦𝘯𝘴𝘩𝘰𝘵
KakaoTalk_20240419_013037282.mp4
💬𝘛𝘰 𝘙𝘦𝘷𝘪𝘦𝘸𝘦𝘳𝘴
이번 주차 과제에 뷰모델을 적용해보려고 했는데..다른 자잘자잘한 부분에 집중하다보니 미처 시도하지 못했습니다..
시험이 끝나면 무조건 뷰모델부터 구현할게요!!
항상 부족한 코드가 많지만 리뷰달아주시면 최선을 다해서 반영해보겠습니닷..!!
코리 반영하기