-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#10 [ui] 행복루틴 추가하기(목록) 뷰 #20
Conversation
# Conflicts: # app/src/main/res/values/themes.xml
…st' into feature/#10-ui-happy-add-view-list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
너무너무 고생했어요! 짱 최고
다만, 함수 분리가 조금 덜 된 부분이 보입니다! 잘 분리해주시길 부탁드리겠습니다.
val routineId: Int, | ||
val title: String, | ||
val content: String, | ||
@DrawableRes val imageUrl: Int, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋아요~
happyAddListChipContentAdapter = HappyAddListChipContentAdapter() | ||
happyAddListContentAdapter = HappyAddListContentAdapter(::moveToDetail) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setChipAdapter 처럼 함수 분리 해주세요!
itemDeco = VerticalItemDecoration(applicationContext) | ||
binding.rvHappyAddList.addItemDecoration(itemDeco) | ||
chipDeco = HorizontalChipItemDecoration(applicationContext) | ||
binding.rvHappyAddListChip.addItemDecoration(chipDeco) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
마찬가지 입니다. setItemDeco로 함수 분리 해주세요!
binding.ivHappyAddBackArrow.setOnClickListener { | ||
finish() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
역시나 함수 분리 부탁드립니다! setBackBtnClickListener처럼 (꼭 변수명 따라가지 않아도 됨) 부탁드립니다.
1 -> viewModel.mockHappyContentList.value | ||
2 -> viewModel.mockHappyContentListOne.value | ||
3 -> viewModel.mockHappyContentListTwo.value | ||
4 -> viewModel.mockHappyContentListThree.value | ||
5 -> viewModel.mockHappyContentListFour.value | ||
6 -> viewModel.mockHappyContentListFive.value | ||
else -> viewModel.mockHappyContentList.value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
나중에 enum class 한 번 써보세요! when을 사용할 때 else를 쓰지 않아도 됩니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋은 충고 감사함다
binding.root.setOnClickListener { | ||
moveToDetail(data.routineId) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
감격입니다!!!! 이제 호연님도 리사이클러뷰 마스터
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이야!!!! 이제 리사이클러뷰 클릭리스너 마스터했네요!!!
private val _mockHappyChipList = MutableLiveData<List<HappyChip>>() | ||
val mockHappyChipList: LiveData<List<HappyChip>> = _mockHappyChipList | ||
|
||
private val _mockHappyContentList = MutableLiveData<List<HappyContent>>() | ||
val mockHappyContentList: LiveData<List<HappyContent>> = _mockHappyContentList | ||
|
||
private val _mockHappyContentListOne = MutableLiveData<List<HappyContent>>() | ||
val mockHappyContentListOne: LiveData<List<HappyContent>> = _mockHappyContentListOne | ||
|
||
private val _mockHappyContentListTwo = MutableLiveData<List<HappyContent>>() | ||
val mockHappyContentListTwo: LiveData<List<HappyContent>> = _mockHappyContentListTwo | ||
|
||
private val _mockHappyContentListThree = MutableLiveData<List<HappyContent>>() | ||
val mockHappyContentListThree: LiveData<List<HappyContent>> = _mockHappyContentListThree | ||
|
||
private val _mockHappyContentListFour = MutableLiveData<List<HappyContent>>() | ||
val mockHappyContentListFour: LiveData<List<HappyContent>> = _mockHappyContentListFour | ||
|
||
private val _mockHappyContentListFive = MutableLiveData<List<HappyContent>>() | ||
val mockHappyContentListFive: LiveData<List<HappyContent>> = _mockHappyContentListFive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mock이라고 이름 붙이는 것도 좋지만, 그냥 실제 변수명처럼 쓴다면, 나중에 두 번 고칠 일은 없겠죠~?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오우 꿀팁이네요~ 가짜 데이터를 더 잘 사용하게 된다면 바꿔보겠습니다ㅎ
</data> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:id="@+id/item_happy_add_component" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cl_ 로 시작하는 것이 더 맞아보이네요!
app/src/main/res/values/strings.xml
Outdated
<string name="happy_title">행복 루틴</string> | ||
<string name="happy_default_mention">행복 루틴은 매일 조금씩 너에 대해\n알아갈 수 있는 특별한 이벤트형 루틴이야!</string> | ||
<string name="happy_empty_card">진행 중인 행복루틴이 없어요.\n루틴을 추가할까요?</string> | ||
<string name="happy_add_title">행복 루틴 추가</string> | ||
<string name="chip_item_happy_all">전체</string> | ||
<string name="chip_item_happy_relationship">관계 쌓기</string> | ||
<string name="chip_item_happy_all_one_growth">한 걸음 성장</string> | ||
<string name="chip_item_happy_resilience">회복탄력성</string> | ||
<string name="chip_item_happy_new_me">새로운 나</string> | ||
<string name="chip_item_happy_mindfulness">마음 챙김</string> | ||
<string name="happy_list_item_content">성숙한 사랑을 만나기 위한</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
행복 루틴 뷰 별로 string 분리해주세요!
<style name="Widget.Material3.Chip.Style" parent=""> | ||
<item name="chipMinTouchTargetSize">0dp</item> | ||
<item name="chipEndPadding">0dp</item> | ||
<item name="chipStartPadding">0dp</item> | ||
<item name="android:checked">false</item> | ||
<item name="android:clickable">false</item> | ||
</style> | ||
|
||
<style name="Style.Material3.Chip.Softie.Type" parent="Widget.MaterialComponents.Chip.Choice"> | ||
<item name="android:stateListAnimator">@null</item> | ||
<item name="chipMinTouchTargetSize">0dp</item> | ||
<item name="chipEndPadding">0dp</item> | ||
<item name="chipMinHeight">0dp</item> | ||
<item name="chipStartPadding">0dp</item> | ||
<item name="chipCornerRadius">99dp</item> | ||
<item name="chipBackgroundColor">@color/selector_happy_type_filter_background</item> | ||
<item name="textStartPadding">14dp</item> | ||
<item name="textEndPadding">14dp</item> | ||
<item name="rippleColor">#00FFFFFF</item> | ||
<item name="android:paddingVertical">10dp</item> | ||
<item name="chipStrokeWidth">1dp</item> | ||
<item name="chipStrokeColor">@color/gray100</item> | ||
<item name="android:textColor">@color/selector_happy_type_text_color</item> | ||
</style> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이야 성공했다 멋있따
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
덕분입니다..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해낸거 대단하다 !! 수고했습니다
binding = ActivityHappyAddListBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
|
||
val themeId = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
처음에 아무것도 선택 안된채로 초기화 시켜둔건가요?.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id는 뒤에 할당받아 사용할거라 0으로 두었습니다!
import android.view.View | ||
import androidx.recyclerview.widget.RecyclerView | ||
|
||
class HorizontalChipItemDecoration(val context: Context) : RecyclerView.ItemDecoration() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 전 그냥 한 클래스에서 작성했는데 이걸로 고쳐보겠습니다 !
|
||
private fun handleChipClick(themeId: Int) { | ||
val listToSubmit = when (themeId) { | ||
1 -> viewModel.mockHappyContentList.value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넘 멋져요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고맙습니다 허허
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다! 이제 리사이클러뷰 클릭리스너 마스터하셨네요!!
ItemDiffCallback<HappyChip>( | ||
onItemsTheSame = { oldItem, newItem -> oldItem == newItem }, | ||
onContentsTheSame = { oldItem, newItem -> oldItem == newItem } | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onItemsTheSame은 아이템이 같은지, onContentsTheSame은 아이템의 내용이 같은지 확인합니다. onItemsTheSame를 { oldItem, newItem -> oldItem.themeId == newItem.themeId }
로 바꿔주세요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋은 지적 감사합니다~~
} | ||
} | ||
|
||
private var onItemClickListener: ((HappyChip) -> Unit)? = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 변수 class 위로 올려주세요!! 강희언니가 코드 리뷰 해준 제꺼 pr 참고하시면 좋을 것 같아용
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영하겠습니다~~
binding.root.setOnClickListener { | ||
moveToDetail(data.routineId) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이야!!!! 이제 리사이클러뷰 클릭리스너 마스터했네요!!!
private lateinit var happyAddListChipContentAdapter: HappyAddListChipContentAdapter | ||
private lateinit var happyAddListContentAdapter: HappyAddListContentAdapter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adapter도 메모리 누수 방지를 위해 null처리를 해주는 것이 좋을 것 같습니다!! 헷갈리면 제 코드 참고하세용
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생했습니다!!! 어려운 거 큰 거 하나 해냈다
📑 Work Description
🛠️ Issue
📷 Screenshot
Screen_Recording_20240111_180307_Softie.mp4
💬 To Reviewers
다음 페이즈로 넘어가고 싶어요...