Skip to content

Conversation

@Nick9417
Copy link
Contributor

@Nick9417 Nick9417 commented Oct 8, 2025

📌 PR 제목

4주차 미션 제출 : FLO 클론 코딩

✅ 변경 사항

  • 홈 화면(HomeFragment) 앨범 RecyclerView 레이아웃 및 RecylcerView 만들기
  • 이전에 ImageView로 구현했던 부분을 바꾸고, AlbumFragment로 이동하는 로직은 그대로 유지
  • 앨범 화면(AlbumFragment)의 수록곡 RecycierView 레이아웃 및 RecycleriVew 만들기
  • 보관함 화면(LockerFragment) 저장한 곡 탭에 들어 노래 RecyclerView 레이아웃 및 RecyclerView 만들기
  • 홈 화면에서 “오늘 발매 음악”의 앨범 item의 Play 버튼 클릭 시 MiniPlayer에 동기화 해보기
  • 보관함 화면에서 각 음악 item의 […] 버튼 클릭 시 해당 아이템 삭제해보기

📷 영상 및 스크린샷

앨범 화면 RecylcerView 보관함 RecyclerView 홈화면 RecyclerView
Screenshot_20251009-152819 Screenshot_20251009-152837 Screenshot_20251009-153505

로직 실행 사진

보관함 [...]버튼 입력 홈화면 앨범커버 재생버튼 입력
Screenshot_20251009-152847 Screenshot_20251009-152919

🔗 알게 된 사항

RecyclerView를 이용하는 방법과 interface를 이용하는 방법에 대하여 알 수 있었습니다.

📝 질문 사항

콜백에 대하여 더 알아보고 싶어요

@Nick9417 Nick9417 requested a review from yangjiae12 October 9, 2025 03:09
Copy link
Member

@yangjiae12 yangjiae12 left a comment

Choose a reason for hiding this comment

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

4주차 미션도 수고하셨습니다~!

fun bind(album: Album){
binding.homeTodayAlbumTitleTv.text = album.title
binding.homeTodayAlbumSingerTv.text = album.singer
binding.homeTodayAlbumIv.setImageResource(album.coverImg!!)
Copy link
Member

Choose a reason for hiding this comment

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

널 강제 언래핑을 하면 NPE 위험이 있으니까 모델을 Int로 보장하거나 플레이스 홀더 처리를 고려해 봐도 좋을 것 같습니다!

Comment on lines +43 to +48
override fun onBindViewHolder(holder: AlbumRVAdapter.ViewHolder, position: Int) {
holder.bind(albumlist[position])
holder.itemView.setOnClickListener { mItemClickListener.onItemClick(albumlist[position]) }
holder.binding.homeTodayAlbumArrowIv.setOnClickListener { sendMiniPlayer.changeText(albumlist[position]) }
// holder.binding.homeTodayAlbumTitleTv.setOnClickListener { mItemClickListner.onRemoveAlbum(position) }
}
Copy link
Member

Choose a reason for hiding this comment

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

현재 클릭 리스너가 bind() 함수 내부에 설정되어 있는데, onBindViewHolder가 호출되어 bind()가 실행될 때마다, 즉 아이템이 화면에 나타날 때마다 리스너 객체를 새로 생성하여 설정하게 되고 이로 인해 불필요한 객체를 생성하게 된다고 생각합니다. 따라서 ViewHolderinit 블록을 사용하여 클릭 리스너를 한 번만 설정하면 좋을 것 같습니다.

Comment on lines +20 to +23
fun removeitem(position: Int){
albumlist.removeAt(position)
notifyDataSetChanged()
}
Copy link
Member

Choose a reason for hiding this comment

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

현재 notifyDataSetChanged()를 통한 전체 갱신을 하고 있는데, addItem, removeItem에서 전체 갱신은 성능 저하를 유발할 수도 있기 때문에, notifyItemInserted(lastIndex), notifyItemRemoved(position)로 바꾸어 부분 갱신을 사용하는 것을 고려해 봐도 좋을 것 같습니다.

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.

3 participants