-
Notifications
You must be signed in to change notification settings - Fork 2
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
[FEAT/#211] 투두 수정뷰 / UI 구현 #232
Conversation
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 checkIsTodoChanged(): Boolean = | ||
todo.value != oldTodoInfo.title || endDate.value != oldTodoInfo.endDate || memo.value != oldTodoInfo.memo || checkIsListChanged() |
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 fun checkIsTodoChanged(): Boolean = | |
todo.value != oldTodoInfo.title || endDate.value != oldTodoInfo.endDate || memo.value != oldTodoInfo.memo || checkIsListChanged() | |
private fun checkIsTodoChanged(): Boolean = | |
(todo.value != oldTodoInfo.title) || (endDate.value != oldTodoInfo.endDate) || (memo.value != oldTodoInfo.memo) || checkIsListChanged() |
private val _todoPatchState = MutableSharedFlow<Boolean>() | ||
val todoPatchState: SharedFlow<Boolean> = _todoPatchState |
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.
제가 아직 flow는 공부 중이라,, 이 친구를 sharedFlow
로 작성해주신 이유가 궁금합니다,,!!
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.
SharedFlow는 StateFlow와 다르게 초기값 설정이 필요없으며,
StateFlow는 초기값으로 뷰모델 init과 함께 flow가 시작되는 반면 SharedFlow는 초기값이 없기에 emit을 진행시키기 전까지는 흐르고 있지 않게 됩니다.
투두패치의 경우, UiState의 로딩이나 엠프티가 필요없는 상태라 Boolean값으로 성공 유무만 처리하면 되는 로직이었고,
서버통신 이후 바로 뷰가 종료되기 때문에 일회성으로 emit 후 종료되어 SharedFlow가 더 효과적이라고 생각했습니다 ~
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.
아하!! 설명 감사합니다~!!! 저도 SharedFlow 적용할 수 있으면 해볼게요!
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.
아하@!! 이런 이유로 사용하신거군요, 저도 SharedFlow 부분에 대해 다시 찾아보겠습니다!
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.run { | ||
tvTodoName.text = item.name | ||
tvTodoName.isSelected = item.isAllocated | ||
|
||
setShapeColor(item.isOwner) | ||
setTextColor() | ||
|
||
layoutTodoName.setOnClickListener { | ||
itemClick(position) | ||
tvTodoName.isSelected = !tvTodoName.isSelected | ||
setTextColor() | ||
} | ||
} | ||
} | ||
|
||
private fun setShapeColor(isOwner: Boolean) { | ||
with(binding.tvTodoName) { | ||
if (isOwner) { | ||
setBackgroundResource(R.drawable.sel_todo_shape_red500_fill) | ||
} else { | ||
setBackgroundResource(R.drawable.sel_todo_shape_gray400_fill) | ||
} | ||
} |
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.
with와 run이 기능상 거의 같은 것으로 알고있는데 위에는 run, 밑에는 with로 사용하신 이유가 있을까요??
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 _todoPatchState = MutableSharedFlow<Boolean>() | ||
val todoPatchState: SharedFlow<Boolean> = _todoPatchState |
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 checkIsTodoChanged(): Boolean = | ||
todo.value != oldTodoInfo.title || endDate.value != oldTodoInfo.endDate || memo.value != oldTodoInfo.memo || checkIsListChanged() |
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 checkIsTodoChanged(): Boolean = | |
todo.value != oldTodoInfo.title || endDate.value != oldTodoInfo.endDate || memo.value != oldTodoInfo.memo || checkIsListChanged() | |
private fun checkIsTodoChanged(): Boolean = | |
(todo.value != oldTodoInfo.title) || (endDate.value != oldTodoInfo.endDate) || (memo.value != oldTodoInfo.memo) || checkIsListChanged() |
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.
patch 서버 붙이면서 많이 도움 받았습니다!!! 수고하셧습니다 !!!!!!!
private val _todoPatchState = MutableSharedFlow<Boolean>() | ||
val todoPatchState: SharedFlow<Boolean> = _todoPatchState |
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.
아하@!! 이런 이유로 사용하신거군요, 저도 SharedFlow 부분에 대해 다시 찾아보겠습니다!
private fun initAdapter() { | ||
_adapter = OurTodoFriendAdapter() | ||
_adapter = OurTodoFriendAdapter(::initFriendInfoListener) | ||
binding.rvOurTripFriend.adapter = adapter | ||
} | ||
|
||
private fun initFriendInfoListener(participantId: Long) { | ||
// TODO: 친구 아이템 클릭 시 상세정보 구현 | ||
} |
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.
굿굿~
역시 완벽하네요~
⛳️ Work Description
📸 Screenshot
KakaoTalk_Video_2024-03-05-18-42-22.mp4
📢 To Reviewers