Conversation
There was a problem hiding this comment.
수고하셨습니다! @@@꼭 다른주차 피드백 확인해주세요!@@@
pr내용은 꼭 적으셔야 합니다
전체적으로 ListAdapter를 상속받으면서도 내부 리스트를 수동으로 관리하거나 notifyDataSetChanged()를 사용하는 등 라이브러리의 의도와 다르게 작성된 부분들이 보입니다...
또한, 데이터 모델 변환 로직이 프래그먼트에 직접 노출되어 있어 유지보수 효율이 떨어질 수 있으니, 매퍼도입이나 리포지토리 로직 개선을 통해 프래그먼트의 책임을 줄여보시면 좋을 것 같습니다. 사소한 버그(Activity/Fragment 혼용)와 하드코딩된 문자열들만 정리하면 훨씬 수준 높은 코드가 될 것 같습니다
고생 많으셨어요!
| class ProductDetailActivity : Fragment() { | ||
|
|
||
| override fun onCreateView( | ||
| inflater: LayoutInflater, | ||
| container: ViewGroup?, | ||
| savedInstanceState: Bundle? | ||
| ): View? { | ||
| val view = inflater.inflate(R.layout.fragment_product_detail, container, false) | ||
|
|
||
| val detailImage = view.findViewById<ImageView>(R.id.detailImage) | ||
| val detailName = view.findViewById<TextView>(R.id.detailName) | ||
| val detailPrice = view.findViewById<TextView>(R.id.detailPrice) | ||
|
|
||
| val name = arguments?.getString("name") ?: "" | ||
| val price = arguments?.getString("price") ?: "" | ||
| val imageResId = arguments?.getInt("image") ?: R.drawable.home_banner | ||
|
|
||
| detailImage.setImageResource(imageResId) | ||
| detailName.text = name | ||
| detailPrice.text = price | ||
|
|
||
| return view | ||
| } |
There was a problem hiding this comment.
ProductDetailActivity.kt 파일에서 이름은 Activity이지만 실제로는 Fragment를 상속받고 있습니다. HomeFragment에서는 이를 Intent로 실행하려 하고 있어 런타임 에러가 발생할 것으로 보입니다. 실제 Activity로 선언하거나, Navigation Component를 활용해 Fragment 간 이동으로 통일해야 합니다..
| inner class ProductViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { | ||
| val imgProduct: ImageView = itemView.findViewById(R.id.imgProduct) | ||
| val imgLike: ImageView = itemView.findViewById(R.id.imgLike) | ||
| val tvBestSeller: TextView = itemView.findViewById(R.id.tvBestSeller) | ||
| val tvName: TextView = itemView.findViewById(R.id.tvName) | ||
| val tvDescription: TextView = itemView.findViewById(R.id.tvDescription) | ||
| val tvColorCount: TextView = itemView.findViewById(R.id.tvColorCount) | ||
| val tvPrice: TextView = itemView.findViewById(R.id.tvPrice) | ||
| } |
There was a problem hiding this comment.
findviewByid방식 뷰바인딩으로 꼭 바꿔주세요!!!!
| <resources> | ||
| <string name="app_name">Nike</string> | ||
| <!-- TODO: Remove or change this placeholder text --> | ||
| <string name="hello_blank_fragment">Hello blank fragment</string> |
There was a problem hiding this comment.
다른 string들도 추가하면 좋을 것 같아요!
jeongkyueun
left a comment
There was a problem hiding this comment.
상품에 하트 누르면 위시리스트에 저장되는 기능 잘 구현하신 거 같아요 굿잡~!!
📌 PR 제목
🔗 관련 이슈
Closes #이슈번호
✨ 변경 사항
🔍 테스트
📸 스크린샷 (선택)
🚨 추가 이슈