Skip to content

feat: 8주차 미션_제로#58

Open
jeongkyueun wants to merge 7 commits into
mainfrom
zero-m8
Open

feat: 8주차 미션_제로#58
jeongkyueun wants to merge 7 commits into
mainfrom
zero-m8

Conversation

@jeongkyueun
Copy link
Copy Markdown
Collaborator

@jeongkyueun jeongkyueun commented May 20, 2026

📌 feat: 8주차 미션_제로

기존 XML 기반의 RecyclerView와 Adapter 구조를 Jetpack Compose의 LazyColumn으로 마이그레이션하여 UI 선언형 구조로 개선하고 코드 복잡도를 줄였습니다.

🔗 관련 이슈

Closes #이슈번호

✨ 변경 사항

기존 RecyclerView + Adapter 코드를 LazyColumn으로 교체
items() 함수를 사용하여 리스트 데이터 표시
아이템 레이아웃을 ProductItem Composable 함수로 새로 작성
각 아이템에 고유한 key를 지정하여 상태 안정성 확보

  1. 신규 Composable 컴포넌트 생성 (ProductCompose.kt)
  • ProductItem: 기존 item_product.xml을 대체. 이미지, 상품 정보, 위시리스트 버튼을 포함하는 컴포저블 구현.
  • ProductList: LazyColumn을 사용하여 리스트를 렌더링하며, key 값으로 product.id를 설정하여 리스트 업데이트 효율을 높였습니다.
  1. Fragment 마이그레이션
  • HomeFragment:

    • 전체 레이아웃을 LazyColumn 하나로 통합했습니다.
    • 기존 NestedScrollView 내부에 LazyColumn이 위치할 때 발생하던 무한 높이 크래시(IllegalStateException) 문제를 해결하기 위해, 상단 배너와 텍스트 섹션을 item { ... }으로 통합 관리하도록 개선했습니다.
  • WishlistFragment & PurchaseFragment:

    • XML 레이아웃의 RecyclerView를 ComposeView로 교체하고, 마이그레이션한 ProductList를 연결했습니다.
  1. 상태 관리 (State Management)
  • mutableStateListOf와 remember를 사용하여 위시리스트 클릭 시 해당 아이템의 상태가 즉시 UI에 반영되도록 구현했습니다.
  1. 코드 및 리소스 최적화
  • 파일 삭제: 사용하지 않는 ProductAdapter.kt, item_product.xml, fragment_home.xml 제거
  • Navigation 수정: nav_graph.xml에서 삭제된 레이아웃 참조(tools:layout)를 제거하여 빌드 경고를 해결했습니다.

참고 사항: HomeFragment는 XML 레이아웃을 사용하지 않고 onCreateView에서 ComposeView를 생성하여 반환하는 방식으로 전환되어 결합도를 낮췄습니다.

🔍 테스트

  • 테스트 완료
  • 에러 없음

📸 스크린샷 (선택)

구매하기 위시리스트 장바구니 프로필
image image image image image

🚨 추가 이슈

@jeongkyueun jeongkyueun self-assigned this May 20, 2026
Comment on lines +40 to +52
@Composable
fun HomeScreen() {
val dummyProducts = remember {
mutableStateListOf(
Product(1, "Air Jordan XXXVI", "Basketball Shoes", "US$185", R.drawable.img_air_jordan_xxxvi, category = "Basketball Shoes"),
Product(2, "Nike Air Force 1 '07", "Men's Shoes", "US$115", R.drawable.img_nike_air_force, category = "Men's Shoes"),
Product(3, "Nike Everyday Plus Cushioned", "Training Socks", "US$20", R.drawable.img_nike_everyday_plus_cushioned, category = "Training Socks")
)
}

LazyColumn(
modifier = Modifier.fillMaxSize(),
contentPadding = PaddingValues(bottom = 16.dp)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lazyColumn 좋아요ㅎㅎ


private fun setupComposeView() {
// Dummy wishlist data
val dummyWishlist = listOf(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

더미를 페이지마다 만들지 말고 하나의 리스트로 통합하는 것도 좋을 것 같아요!

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