Skip to content

Commit

Permalink
[FEAT/#244] 프로그래스바 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
leeeyubin committed Mar 10, 2024
1 parent 7cb6f40 commit b6e5181
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class InviteFinishActivity :
startDate: String,
endDate: String,
day: Int,
): Intent = Intent(context, EnterTripActivity::class.java).apply {
): Intent = Intent(context, InviteFinishActivity::class.java).apply {
putExtra(TRIP_ID, tripId)
putExtra(TITLE, title)
putExtra(START, startDate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,66 @@ class CheckFriendsActivity :

private fun setFriendsData(data: CheckFriendsModel) {
adapter.submitList(data.participants)

val rates = data.styles.map { it.rates }
val counts = data.styles.map { it.counts }

setProgressBarStatus(rates)
setCountStatus(counts)
}

private fun setProgressBarStatus(rates: List<List<Int>>) {
with(binding) {
val progressBars = listOf(
progressBarCheckFriends1,
progressBarCheckFriends2,
progressBarCheckFriends3,
progressBarCheckFriends4,
progressBarCheckFriends5
)

for (i in rates.indices) {
progressBars[i].progress = rates[i][0]
progressBars[i].secondaryProgress = rates[i][0] + rates[i][1]
}
}
}

private fun setCountStatus(counts: List<List<Int>>) {
with(binding) {
val countsLeftList = mutableListOf(
tvCheckFriendsPreferenceNumber1Left,
tvCheckFriendsPreferenceNumber2Left,
tvCheckFriendsPreferenceNumber3Left,
tvCheckFriendsPreferenceNumber4Left,
tvCheckFriendsPreferenceNumber5Left,
)

val countsCenterList = mutableListOf(
tvCheckFriendsPreferenceNumber1Center,
tvCheckFriendsPreferenceNumber2Center,
tvCheckFriendsPreferenceNumber3Center,
tvCheckFriendsPreferenceNumber4Center,
tvCheckFriendsPreferenceNumber5Center,
)

val countsRightList = mutableListOf(
tvCheckFriendsPreferenceNumber1Right,
tvCheckFriendsPreferenceNumber2Right,
tvCheckFriendsPreferenceNumber3Right,
tvCheckFriendsPreferenceNumber4Right,
tvCheckFriendsPreferenceNumber5Right
)

for (i in counts.indices) {
countsLeftList[i].text =
getString(R.string.check_friends_preference_number, counts[i][0])
countsCenterList[i].text =
getString(R.string.check_friends_preference_number, counts[i][1])
countsRightList[i].text =
getString(R.string.check_friends_preference_number, counts[i][2])
}

val progressBars = listOf(
binding.progressBarCheckFriends1,
binding.progressBarCheckFriends2,
binding.progressBarCheckFriends3,
binding.progressBarCheckFriends4,
binding.progressBarCheckFriends5
)

for (i in rates.indices) {
progressBars[i].progress = rates[i][0]
progressBars[i].secondaryProgress = rates[i][0] + rates[i][1]
}

}
Expand Down

0 comments on commit b6e5181

Please sign in to comment.