Skip to content
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

Merged
merged 37 commits into from
Jan 11, 2024

Conversation

pump9918
Copy link
Collaborator

@pump9918 pump9918 commented Jan 10, 2024

📑 Work Description

  • chip recyclerView 가로 정렬
  • 카테고리 recyclerVIew
  • mockList사용 어댑터, 뷰홀더
  • 아이템 데코레이션 사용
  • 칩 클릭 시 다른 리스트 불러오기

🛠️ Issue

📷 Screenshot

Screen_Recording_20240111_180307_Softie.mp4

💬 To Reviewers

다음 페이즈로 넘어가고 싶어요...

@pump9918 pump9918 changed the title #10 [UI] Happy Routine 추가하기(목록) #10 [ui] Happy Routine 추가하기(목록) Jan 10, 2024
@pump9918 pump9918 added UI ui 관련 작업 호연🐻‍❄️ 호연이가 작업함! labels Jan 10, 2024
@pump9918 pump9918 self-assigned this Jan 10, 2024
@stellar-halo stellar-halo marked this pull request as draft January 10, 2024 07:57
@pump9918 pump9918 marked this pull request as ready for review January 11, 2024 04:44
@pump9918 pump9918 changed the title #10 [ui] Happy Routine 추가하기(목록) #10 [ui] 행복루틴 추가하기(목록) Jan 11, 2024
@pump9918 pump9918 changed the title #10 [ui] 행복루틴 추가하기(목록) #10 [ui] 행복루틴 추가하기(목록) 뷰 Jan 11, 2024
Copy link
Contributor

@stellar-halo stellar-halo left a 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,
Copy link
Contributor

Choose a reason for hiding this comment

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

좋아요~

Comment on lines +34 to +35
happyAddListChipContentAdapter = HappyAddListChipContentAdapter()
happyAddListContentAdapter = HappyAddListContentAdapter(::moveToDetail)
Copy link
Contributor

Choose a reason for hiding this comment

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

setChipAdapter 처럼 함수 분리 해주세요!

Comment on lines 37 to 40
itemDeco = VerticalItemDecoration(applicationContext)
binding.rvHappyAddList.addItemDecoration(itemDeco)
chipDeco = HorizontalChipItemDecoration(applicationContext)
binding.rvHappyAddListChip.addItemDecoration(chipDeco)
Copy link
Contributor

Choose a reason for hiding this comment

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

마찬가지 입니다. setItemDeco로 함수 분리 해주세요!

Comment on lines +41 to +43
binding.ivHappyAddBackArrow.setOnClickListener {
finish()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

역시나 함수 분리 부탁드립니다! setBackBtnClickListener처럼 (꼭 변수명 따라가지 않아도 됨) 부탁드립니다.

Comment on lines +61 to +67
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
Copy link
Contributor

Choose a reason for hiding this comment

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

나중에 enum class 한 번 써보세요! when을 사용할 때 else를 쓰지 않아도 됩니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

좋은 충고 감사함다

Comment on lines +29 to +31
binding.root.setOnClickListener {
moveToDetail(data.routineId)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

감격입니다!!!! 이제 호연님도 리사이클러뷰 마스터

Copy link
Member

Choose a reason for hiding this comment

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

이야!!!! 이제 리사이클러뷰 클릭리스너 마스터했네요!!!

Comment on lines +11 to +30
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
Copy link
Contributor

Choose a reason for hiding this comment

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

mock이라고 이름 붙이는 것도 좋지만, 그냥 실제 변수명처럼 쓴다면, 나중에 두 번 고칠 일은 없겠죠~?

Copy link
Collaborator Author

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"
Copy link
Contributor

Choose a reason for hiding this comment

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

cl_ 로 시작하는 것이 더 맞아보이네요!

Comment on lines 20 to 30
<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>
Copy link
Contributor

Choose a reason for hiding this comment

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

행복 루틴 뷰 별로 string 분리해주세요!

Comment on lines +15 to +38
<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>
Copy link
Contributor

Choose a reason for hiding this comment

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

이야 성공했다 멋있따

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

덕분입니다..

Copy link
Member

@minemi00 minemi00 left a 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
Copy link
Member

Choose a reason for hiding this comment

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

처음에 아무것도 선택 안된채로 초기화 시켜둔건가요?.?

Copy link
Collaborator Author

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() {
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

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

넘 멋져요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

고맙습니다 허허

Copy link
Member

@emjayMJkim emjayMJkim left a comment

Choose a reason for hiding this comment

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

수고하셨습니다! 이제 리사이클러뷰 클릭리스너 마스터하셨네요!!

Comment on lines 13 to 16
ItemDiffCallback<HappyChip>(
onItemsTheSame = { oldItem, newItem -> oldItem == newItem },
onContentsTheSame = { oldItem, newItem -> oldItem == newItem }
)
Copy link
Member

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 }로 바꿔주세요!

Copy link
Collaborator Author

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
Copy link
Member

Choose a reason for hiding this comment

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

이 변수 class 위로 올려주세요!! 강희언니가 코드 리뷰 해준 제꺼 pr 참고하시면 좋을 것 같아용

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

반영하겠습니다~~

Comment on lines +29 to +31
binding.root.setOnClickListener {
moveToDetail(data.routineId)
}
Copy link
Member

Choose a reason for hiding this comment

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

이야!!!! 이제 리사이클러뷰 클릭리스너 마스터했네요!!!

Comment on lines 24 to 25
private lateinit var happyAddListChipContentAdapter: HappyAddListChipContentAdapter
private lateinit var happyAddListContentAdapter: HappyAddListContentAdapter
Copy link
Member

Choose a reason for hiding this comment

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

adapter도 메모리 누수 방지를 위해 null처리를 해주는 것이 좋을 것 같습니다!! 헷갈리면 제 코드 참고하세용

Copy link
Contributor

@stellar-halo stellar-halo left a comment

Choose a reason for hiding this comment

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

고생했습니다!!! 어려운 거 큰 거 하나 해냈다

@pump9918 pump9918 merged commit 1cc529c into develop Jan 11, 2024
1 check passed
@pump9918 pump9918 deleted the feature/#10-ui-happy-add-view-list branch January 11, 2024 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
UI ui 관련 작업 호연🐻‍❄️ 호연이가 작업함!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ui] 행복루틴 - 추가하기(목록)
4 participants