feat:5주차 미션_묵은지#39
Conversation
| <LinearLayout | ||
| android:id="@+id/layout_menu" | ||
| android:layout_width="0dp" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginTop="30dp" | ||
| android:gravity="center" | ||
| android:orientation="horizontal" | ||
| app:layout_constraintEnd_toEndOf="parent" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintTop_toBottomOf="@id/btn_edit_profile"> | ||
|
|
||
| <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="주문" android:textColor="#555555" /> | ||
| <View android:layout_width="1dp" android:layout_height="12dp" android:layout_marginHorizontal="15dp" android:background="#DDDDDD" /> | ||
| <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="패스" android:textColor="#555555" /> | ||
| <View android:layout_width="1dp" android:layout_height="12dp" android:layout_marginHorizontal="15dp" android:background="#DDDDDD" /> | ||
| <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="이벤트" android:textColor="#555555" /> | ||
| <View android:layout_width="1dp" android:layout_height="12dp" android:layout_marginHorizontal="15dp" android:background="#DDDDDD" /> | ||
| <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="설정" android:textColor="#555555" /> | ||
| </LinearLayout> |
There was a problem hiding this comment.
아이콘 이미지가 없고 하단바가 가려진 상태에요!
jeongkyueun
left a comment
There was a problem hiding this comment.
주문 패스 이벤트 설정에 아이콘 추가하고, 회원가입일 추가하시고 네비게이션바가 잘려서 보이는 거 같아요 !
| <ImageView | ||
| android:id="@+id/iv_profile_user" | ||
| android:layout_width="100dp" | ||
| android:layout_height="100dp" | ||
| android:layout_marginTop="40dp" | ||
| android:scaleType="centerCrop" | ||
| android:clipToOutline="true" | ||
| app:layout_constraintEnd_toEndOf="parent" |
kimdoyeon1234
left a comment
There was a problem hiding this comment.
수고하셨습니다! 기본 구조는 잘 잡혀있어요! 다만 수정해야 할 부분이 보여서 코멘트 몇개 남깁니다!
다음에 개선하면 좋을 점
- 패키지명 week2final 잔재를 week3으로 통일해주세요
- WishlistFragment 구현을 완성해주세요
- PurchaseFragment의 하트 버튼을 RecyclerView + Adapter로 리팩토링하면 훨씬 유연해져요
- API 키는 BuildConfig로, Interceptor로 자동 주입하도록 개선해주세요
- 팔로잉 목록에서 본인(id=1)을 필터링해주세요
수고하셨습니다🙂
| package com.example.week2final | ||
|
|
There was a problem hiding this comment.
ProfileFragment가 week2final 패키지에 있고 나머지는 week3에 있어요. 이전 주차 파일을 복사해서 쓰신 것 같은데, 패키지명을 com.example.week3으로 통일해주세요!
| val list = response.body()?.data ?: listOf() | ||
|
|
||
| // 어댑터 연결 | ||
| binding.rvFollowing.adapter = FollowerAdapter(list) |
There was a problem hiding this comment.
팔로잉 목록에 프로필의 본인(id=1)이 그대로 포함되어 있어요! 아래처럼 필터링 해주세요!
val list = response.body()?.data?.filter { it.id != 1 } ?: listOf()
| private val binding get() = _binding!! | ||
|
|
||
| private val MY_API_KEY = "reqres_3fd0bc2b94a34359a2e2b56a6f1f7d85" | ||
|
|
There was a problem hiding this comment.
local.properties + BuildConfig로 분리해서 관리해주세요!
|
|
||
| val instance: UserService by lazy { | ||
| val retrofit = Retrofit.Builder() | ||
| .baseUrl(BASE_URL) | ||
| .addConverterFactory(GsonConverterFactory.create()) | ||
| .build() | ||
| retrofit.create(UserService::class.java) | ||
| } |
There was a problem hiding this comment.
싱글톤으로 분리하신 건 좋아요! 다만 OkHttpClient가 없어서 API 키를 헤더로 넣는 Interceptor가 없어요. 그래서 UserService에서 매 요청마다 @Header로 직접 키를 넘기는 방식을 쓰고 계신데, 이렇게 하면 API 키가 호출부마다 노출돼요. Interceptor로 자동으로 붙여주는 방식이 더 안전합니다!
| val dummyData = listOf( | ||
| Product("AirJordan1", "$115", R.drawable.jordan1), | ||
| Product("AirJordan2", "$120", R.drawable.jordan2), | ||
| Product("Nike Everyday Plus", "$10", R.drawable.socks) | ||
| ) | ||
| dataStoreManager.saveAllProducts(dummyData) | ||
| } |
There was a problem hiding this comment.
초기 데이터 저장 로직이 MainActivity에 있어요. 데이터 관련 로직은 DataStoreManager나 별도 Repository로 옮기는 게 좋습니다. MainActivity는 화면 전환만 담당하는 게 역할 분리 측면에서 더 깔끔해요!
|
|
||
| val heartButtons = listOf<ImageView>( | ||
| view.findViewById(R.id.btn_heart1), | ||
| view.findViewById(R.id.btn_heart2), | ||
| view.findViewById(R.id.btn_heart3), | ||
| view.findViewById(R.id.btn_heart4) | ||
| ) | ||
|
|
There was a problem hiding this comment.
하트 버튼을 ID로 하나하나 찾아서 리스트로 만들고 있어요. 상품이 늘어나면 버튼도 계속 추가해야 하는 구조예요. RecyclerView + Adapter 방식으로 만들면 상품 수에 관계없이 동작하고 코드도 훨씬 간결해집니다!
| class WishlistFragment : Fragment(R.layout.fragment_wishlist) { | ||
| override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
| super.onViewCreated(view, savedInstanceState) | ||
|
|
||
| } |
There was a problem hiding this comment.
몇주차째 ...Fragment가 비어 있어요. DataStoreManager의 getWishlist()를 연결해서 위시리스트 목록을 보여주는 부분이 구현되면 완성입니다!
viewLifecycleOwner.lifecycleScope.launch {
dataStoreManager.getWishlist().collect { wishlist ->
// RecyclerView에 wishlist 연결
}
}
There was a problem hiding this comment.
현재 최상위 레이아웃이 ConstraintLayout 하나로만 되어 있어서 스크롤이 지원되지 않아요. 콘텐츠가 화면보다 길어지면 하단 네비게이션 바를 덮어버리는 문제가 생깁니다.
NestedScrollView로 감싸주는 구조로 바꿔주세요!..
📌 PR 제목
🔗 관련 이슈
Closes #이슈번호
✨ 변경 사항
🔍 테스트
📸 스크린샷 (선택)
🚨 추가 이슈