Skip to content

Commit

Permalink
[fix/#158] time-mm/dd 한자리수 입력 수정 완료
Browse files Browse the repository at this point in the history
  • Loading branch information
Mnseo committed Feb 16, 2024
1 parent bf8331e commit 91c4e6e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ class MoimFragment :
ScreenState.Success -> {
context?.defaultToast("모임 생성이 완료되었습니다")
delay(2000)
viewModel.initializeState()
}
ScreenState.BookMarkSuccess -> {
context?.defaultToast("모임 저장을 성공했습니다")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ class MoimViewModel @Inject constructor(
if (isOverSizeImageFound) {
viewModelScope.launch {
_snackbarEvent.emit(SnackbarEvent.FILE_OVER_10MB)
Log.d("snackbarEvent", _snackbarEvent.toString())
}
}
_imageUri.value = currentList.take(5)
Expand Down Expand Up @@ -333,13 +332,12 @@ class MoimViewModel @Inject constructor(
var timeInput = _time.value

val isAfternoon = _isAfternoon.value == "오후"
val (hourString, minute) = timeInput.split(":")
val (hourString, minuteString) = timeInput.split(":")
var hour = hourString.toInt()
val minute = if (minuteString.length == 1) "0$minuteString" else minuteString

if (isAfternoon && hour < 12) { hour += 12 }
else if (!isAfternoon && hour == 12) {
hour = 0
}
else if (!isAfternoon && hour == 12) { hour = 0 }

timeInput = "$hour:$minute"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ fun MoimCreateBtn(
viewModel.createMoim()
} else if (screenState == ScreenState.Success) {
navController?.navigate(R.id.fragment_home)
delay(2000)
viewModel.initializeState()
}
else {
viewModel.goToNextScreen() }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ fun MoimDateColumn(viewModel: MoimViewModel) {

private fun updateTimeIfComplete(hour: String, minute: String, viewModel: MoimViewModel) {
if (hour.isNotEmpty() && minute.isNotEmpty()) {
val time = "$hour:$minute"
val formattedHour = if (hour.length == 1) "0$hour" else hour
val formattedMinute = if (minute.length == 1) "0$minute" else minute

val time = "$formattedHour:$formattedMinute"
viewModel.updateTime(time)
}
}
Expand Down Expand Up @@ -259,7 +262,7 @@ fun MoimTimeColumn(viewModel: MoimViewModel) {
)
},
onValueChange = { newText ->
timeAText = newText.take(1)
timeAText = newText.take(2)
updateTimeIfComplete(timeAText, timeBText, viewModel)
},
singleLine = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ fun RecommendItem(recommend: Recommend, myPageViewModel: MyPageViewModel, navCon
verticalAlignment = Alignment.CenterVertically
) {
RecommendRow(recommend = recommend, list= CHARACTER_CARD_FRIEND)
RecommendRow(recommend = recommend, list= SignupUtils.CHARACTER_FRIEND_LIST)
recommend.jobName?.let {
Text(
text = it,
Expand Down
14 changes: 0 additions & 14 deletions app/src/main/java/com/teumteum/teumteum/util/SignupUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,6 @@ object SignupUtils {
11 to R.drawable.ic_panda
)

val CHARACTER_FRIEND_LIST: HashMap<Int, Int> = hashMapOf(
0 to R.drawable.ic_ghost,
1 to R.drawable.ic_star_character,
2 to R.drawable.ic_bear,
3 to R.drawable.ic_raccoon,
4 to R.drawable.ic_cat,
5 to R.drawable.ic_rabbit,
6 to R.drawable.ic_fox,
7 to R.drawable.ic_water,
8 to R.drawable.ic_penguin,
9 to R.drawable.ic_dog,
10 to R.drawable.ic_mouse,
11 to R.drawable.ic_panda
)

const val JOB_DESIGN = "디자인"
const val JOB_DEVELOPMENT = "개발"
Expand Down

0 comments on commit 91c4e6e

Please sign in to comment.