Skip to content

feat: 2주차 미션_묵은지#28

Open
mookeunji05 wants to merge 12 commits intomainfrom
mookeunji-2
Open

feat: 2주차 미션_묵은지#28
mookeunji05 wants to merge 12 commits intomainfrom
mookeunji-2

Conversation

@mookeunji05
Copy link
Copy Markdown
Collaborator

📌 PR 제목

[feat] nike 앱 기본 화면 구현

🔗 관련 이슈

Closes #이슈번호

✨ 변경 사항

앱 아래쪽에 메뉴 바 만들고, 버튼 누르면 화면 바뀌게 연결하기
메뉴마다 보여줄 화면들(프래그먼트)을 하단 바와 엮어주기

🔍 테스트

테스트 완료
에러 없음

📸 스크린샷 (선택)

image image image image image

🚨 추가 이슈

@mookeunji05 mookeunji05 changed the title Mookeunji 2 feat: 2주차 미션_묵은지 Apr 2, 2026
Copy link
Copy Markdown
Collaborator

@kimdoyeon1234 kimdoyeon1234 left a comment

Choose a reason for hiding this comment

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

이번 과제에서 리사이클러뷰와 어댑터, 그리고 더미 데이터까지 직접 설계해서 실제 리스트 화면을 구현해 보려는 시도가 정말 인상 깊었습니다!

다만, 실제 앱이 정상적으로 동작하고 협업하기 좋은 코드가 되기 위해 꼭 수정이 필요한 부분들을 정리해 드립니다.

마지막으로 이미지들은 이전에 안내드렸던 표로 정리해주시면은 감사하겠습니다! 이슈도 연결해주세요!

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.

현재 drawable 폴더를 보면 ic_home.png와 housesimple.xml처럼 이름 짓는 방식이 섞여 있습니다. 리소스가 많아지면 관리가 어려워질 수 있어서, 아래와 같은 규칙을 적용해 보시면 좋을거 같습니다

접두어 통일: 아이콘은 무조건 ic_로 시작하게 (예: ic_cart, ic_user)
구분자 사용: 단어 사이는 띄어쓰기 대신 _ (언더바)로 구분 (예: ic_house_simple, ic_list_magnifying_glass)

이렇게 하면 안드로이드 스튜디오에서 ic_만 검색해도 모든 아이콘을 한눈에 볼 수 있고, 가독성도 훨씬 좋아져서 협업할 때 큰 도움이 됩니다!

Comment on lines +7 to +16
<ImageView
android:id="@+id/BagCircle"
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/bagcircle" /> <TextView
android:text="장바구니가 비었습니다.\n제품을 추가하면 여기에 표시됩니다."
android:gravity="center"
android:layout_marginTop="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
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.

코드가 전체적으로 들여쓰기가 맞지 않아 가독성이 떨어집니다. 안드로이드 스튜디오의 단축키인 Ctrl + Alt + L (윈도우) / Cmd + Option + L (맥) 으로 쉽게 정렬할 수 있습니다!

Comment on lines +29 to +47
bottomNav.setOnItemSelectedListener { item ->
when (item.itemId) {
R.id.HouseSimple -> replaceFragment(HomeFragment())
R.id.ListMagnifyingGlass -> replaceFragment(BuyFragment())
R.id.HeartStraight -> replaceFragment(WishlistFragment())
R.id.Bagsimple -> replaceFragment(CartFragment())
R.id.User -> replaceFragment(ProfileFragment())
}
true
}
}


private fun replaceFragment(fragment: Fragment) {
supportFragmentManager.beginTransaction()
.replace(R.id.main_container, fragment)
.commit()
}
}
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.

바텀바 메뉴 ID(HouseSimple 등)를 안드로이드 표준 규칙인 소문자와 언더바(_) 조합으로 바꿔보세요!
(예: nav_home)

지금은 탭을 누를 때마다 프래그먼트를 새로 생성하고 있습니다. 지금은 간단한 ui작업이니 상관은 없지만 나중에 Navigation Component를 써서 내용이 유지되게 고쳐보시면 좋을 것 같아요!

Comment on lines +24 to +44
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val item = itemList[position]
// 여기서 바뀐 이름들(prodName 등)을 연결합니다
holder.ivLike.setOnClickListener {
item.isLiked = !item.isLiked // 하트 상태 반전

// 💡 여기서 위시리스트 매니저를 불러서 데이터를 넣었다 뺐다 하는 거예요!
WishlistManager.toggleWish(item)

// 하트 모양을 새로고침 (빨간 하트 <-> 빈 하트)
notifyItemChanged(position)

holder.tvName.text = item.prodName
holder.tvCategory.text = item.prodCategory
holder.tvPrice.text = item.prodPrice

holder.itemView.setOnClickListener {
val context = holder.itemView.context
android.widget.Toast.makeText(context, "${item.prodName}을 선택하셨습니다!", android.widget.Toast.LENGTH_SHORT).show()
}
}
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.

ViewHolder에서 ivLike 변수를 선언하지 않은 채 onBindViewHolder에서 사용하고 있습니다! 이대로 빌드하면 앱이 실행되지 않으니, 반드시 ViewHolder 안에 하트 이미지 뷰를 연결하는 코드를 추가해 주세요!

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.

fragment_cart.xml과 buyfragment.xml이 섞여 있습니다! 다른 파일들과 형식을 맞춰서 fragment_buy.xml로 이름을 변경해 주시면 훨씬 가독성이 좋아질 것 같아요

Comment on lines +7 to +46

<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
android:layout_marginBottom="20dp">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">

<Button
android:id="@+id/btn_all"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="전체"
android:textStyle="bold"
android:textColor="#000000" />

<Button
android:id="@+id/btn_tops"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="Tops &amp; Shirts"
android:textColor="#888888" />

<Button
android:id="@+id/btn_shoes"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="Shoes"
android:textColor="#888888" />
</LinearLayout>
</HorizontalScrollView>
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.

HorizontalScrollView와 Button을 조합해 상단 카테고리를 직접 만드셨는데, 시도는 좋으나 유지보수가 어려울 수 있습니다. 안드로이드 표준 컴포넌트인 TabLayout을 사용해 보시는 건 어떨까요? 클릭 효과나 애니메이션을 자동으로 지원해 줍니다!

Comment on lines +50 to +53
android:text="나이키 최신 상품"
android:textSize="35sp"
android:textStyle="bold"
android:textColor="#000000"
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.

android:text="니이키 최신 상품"이나 #000000 같은 색상값이 직접 입력되어 있습니다. strings.xml과 colors.xml로 분리해서 관리하는 습관을 들여보시면 좋을 것 같습니다!

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.

2 participants