Skip to content
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

Merged
merged 31 commits into from
May 1, 2024
Merged

Conversation

hyeeum
Copy link
Collaborator

@hyeeum hyeeum commented Apr 18, 2024

📌𝘐𝘴𝘴𝘶𝘦𝘴

📎𝘞𝘰𝘳𝘬 𝘋𝘦𝘴𝘤𝘳𝘪𝘱𝘵𝘪𝘰𝘯

  • - 마이페이지를 1주차 과제에서 만드셨다면, 마이페이지 탭으로 옮겨주세요.세미나 자료에 있는 바텀 네비게이션과 연동 시켜주세요.
  • - 리스트 위에 기존 Friend 형식과는 다른 내 프로필을 디자인 해서 리스트 상단에 넣는다.
  • - 디자인은 자유입니다, 다만 친구 목록과 대비 되도록 프로필 이미지 사이즈, 혹은 추가적인 디자인적 요소가 필수적으로 탑재되어야 합니다.
  • - 데이터는 최소 스크롤이 가능해야 하며, 스크롤시에는 내 프로필 또한 같이 스크롤이 되어야합니다.
    • 즉 내 프로필을 RecyclerView 외부에 위치시킨다면 같이 스크롤이 되지 않기 때문에 내부에 위치시킬 수 있는 방법을 찾아봅시다
    • Multi-View Type RecyclerView 또는 ConcatAdapter

📷𝘚𝘤𝘳𝘦𝘦𝘯𝘴𝘩𝘰𝘵

KakaoTalk_20240419_013037282.mp4

💬𝘛𝘰 𝘙𝘦𝘷𝘪𝘦𝘸𝘦𝘳𝘴

이번 주차 과제에 뷰모델을 적용해보려고 했는데..다른 자잘자잘한 부분에 집중하다보니 미처 시도하지 못했습니다..
시험이 끝나면 무조건 뷰모델부터 구현할게요!!
항상 부족한 코드가 많지만 리뷰달아주시면 최선을 다해서 반영해보겠습니닷..!!

코리 반영하기

@hyeeum hyeeum requested review from chattymin, twogarlic, kez-lab, boiledEgg-s and a team April 18, 2024 16:35
@hyeeum hyeeum self-assigned this Apr 18, 2024
@hyeeum hyeeum requested review from youjin09222 and removed request for twogarlic and a team April 18, 2024 16:37
@hyeeum hyeeum changed the base branch from main-xml to develop-xml April 19, 2024 05:24
Copy link
Member

@chattymin chattymin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코멘트를 빨아들이는 속도가 스펀지 뺨치네요
제 모든코드 호로록 가져가시길 바랍니다 ㅋㅋ

app/src/main/java/com/sopt/now/HomeFragment.kt Outdated Show resolved Hide resolved
Comment on lines 32 to 35
(holder as UserViewHolder).ivProfile.setImageResource(item.profileImage)
holder.tvName.text = item.name
holder.tvSelfDescription.text = item.selfDescription
holder.setIsRecyclable(false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with를 활용해보면 좋을것 같아요~

Copy link

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을 반환하기 때문에 조금 더 안전한 개발이 가능합니다

app/src/main/java/com/sopt/now/HomeListData.kt Outdated Show resolved Hide resolved
Comment on lines 9 to 11
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헉.
findViewById는 사용 금지!!!!!!!!!!!!!!!!!!
다른 방법을 찾아봅시다!!!!!!!!!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

바인딩 객체를 인자로 받아 구현하는 편이 좋겠네요~

Comment on lines 50 to 52
val intent = Intent(this, MainActivity::class.java)
saveUserInfo(id,pw,nick)
startActivity(intent)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scope 함수를 활용해봐용~

Comment on lines +55 to +63
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()
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헉 sharedPreference 너무 좋아요!!
그런데 데이터를 가져오는 과정은 View보다는 ViewModel에 적합한 코드 같네요!! 수정해볼까용~

app/src/main/java/com/sopt/now/LoginActivity.kt Outdated Show resolved Hide resolved
Comment on lines +57 to +62
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
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굿!!!! 완벽하네요

app/src/main/res/layout/item_user.xml Outdated Show resolved Hide resolved
Copy link
Member

@boiledEgg-s boiledEgg-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코멘트를 달고 싶지만 달게 없네요,, 왜 이렇게 잘하는거야

Comment on lines 9 to 11
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

바인딩 객체를 인자로 받아 구현하는 편이 좋겠네요~

Copy link

@youjin09222 youjin09222 left a 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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리스트 데이터를 따로 저장해서 사용하니까 코드가 확실히 간단해지네요!!

Comment on lines +24 to +29
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", "")
}
Copy link

@youjin09222 youjin09222 Apr 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SharedPreferences를 사용하여 코드가 간단하고 직관적이네요!

Copy link

@kez-lab kez-lab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

갓기 혜음아 엄청난 코드 잘보고 간다 ^&^

Comment on lines 32 to 35
(holder as UserViewHolder).ivProfile.setImageResource(item.profileImage)
holder.tvName.text = item.name
holder.tvSelfDescription.text = item.selfDescription
holder.setIsRecyclable(false)
Copy link

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을 반환하기 때문에 조금 더 안전한 개발이 가능합니다

Comment on lines 8 to 10
selfDescription = "멀티 뷰 리싸이클러뷰!",
0
),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HomeList.VIEW_TYPE_USER 상수를 만들었으니 상수를 활용하는 것이 좋아보여요!

Copy link
Member

@chattymin chattymin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

매주 빠르게 발전하는 코드 잘 보고갑니다!!
최고~

Comment on lines +50 to +52
val intent = Intent(this, MainActivity::class.java).apply {
saveUserInfo(id, pw, nick)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

객체를 생성하지 않고도 가능하답니당!

Comment on lines +9 to +13
binding.run {
ivProfile.setImageResource(friendData.profileImage)
tvName.text = friendData.name
tvSelfDescription.text = friendData.selfDescription
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

구우우우웃!!!

@hyeeum hyeeum merged commit 3598df2 into develop-xml May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants