-
Notifications
You must be signed in to change notification settings - Fork 1
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/challenge]: 챌린지 기초 작업 #66
Conversation
# Conflicts: # settings.gradle.kts
feature/challenge/src/main/java/com/hmh/hamyeonham/challenge/ChallengeCalendarAdapter.kt
Outdated
Show resolved
Hide resolved
feature/challenge/src/main/java/com/hmh/hamyeonham/challenge/ChallengeFragment.kt
Show resolved
Hide resolved
의진님 너무 수고 많으셨습니다~ |
@jihyun0v0 컨벤션을 다시잡죠 ㅎㅎ 너무 비효율적이네요 |
f0a13fa
to
682ff06
Compare
private val getUsageGoalsUseCase: GetUsageGoalsUseCase, | ||
) : ViewModel() { | ||
private val _mainState = MutableStateFlow(MainState()) | ||
val mainState = _mainState.asStateFlow() |
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.
mainState에 MainViewModel에서 사용하는 여러 dataFlow를 저장하는 건가요?
val packageName: String = "", | ||
val goalTime: Long = 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.
이런식으로 초기화 할 수 있구나~ 배워갑니다~
val formattedGoalTime: String | ||
get() { | ||
val hours = goalTimeInHours | ||
val minutes = goalTimeInMinutes | ||
return buildString { | ||
if (hours > 0) { | ||
append("$hours 시간") | ||
} | ||
if (minutes > 0) { | ||
if (hours > 0) append(" ") | ||
append("$minutes 분") | ||
} | ||
} | ||
} |
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.
확장성을 위해서 이 함수를 common에 넣는 건 안좋은 방법인가요? 궁금합니다!
operator fun invoke(): List<UsageGoal> { | ||
return getUsageGoalsUseCase.getUsageGoals() | ||
} | ||
} |
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.
아주 깔끔한 UseCase 굿!
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.
잘 보고 갑니당!!! 궁금한 사항들 적어두었으니 시간될 때 답변 부탁드려요(꾸벍)
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="5dp" | ||
android:text="3시간" |
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.
디자인 확인을 위해 적어둔 텍스트라면 tools 써도 좋을 것 같습니다!
android:id="@+id/iv_challenge_status" | ||
android:layout_width="38dp" | ||
android:layout_height="38dp" | ||
android:src="@drawable/shape_background_radius8_blackground" |
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.
xml 전반적으로 줄바꿈 확인 부탁드립니다!
// 첫 번째와 마지막 아이템을 제외한 경우에만 마진 적용 | ||
if (position != 0) { | ||
outRect.top = verticalSpaceHeight | ||
} |
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.
position != 0 인데 마지막 아이템도 마진 적용되는 거 맞을까요?
data class MainState( | ||
val challengeStatus: ChallengeStatus = ChallengeStatus(), | ||
val usageGoals: List<UsageGoal> = emptyList(), | ||
) |
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.
MVI 패턴 적용 참고해서 나중에 저도 잘 다듬어보겠습니다
val challengeAdapter = binding.rvChallengeCalendar.adapter as? ChallengeCalendarAdapter | ||
val challengeGoalsAdapter = binding.rvAppUsageGoals.adapter as? ChallengeUsageGoalsAdapter |
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.
이미 어댑터가 init~함수에 있는 것 같은데 한번더 collect 함수에서 as? 를 사용해서 캐스팅한 이유 궁금합니다!
val challengeAdapter = binding.rvChallengeCalendar.adapter as? ChallengeCalendarAdapter | ||
val challengeGoalsAdapter = binding.rvAppUsageGoals.adapter as? ChallengeUsageGoalsAdapter | ||
activityViewModel.mainState.flowWithLifecycle(viewLifeCycle).onEach { |
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.
의진님 코드 정말 깔끔하고 뜯어볼게 참 많습니다. 잘 배워갑니다~
개요
작업 사항