Skip to content

Commit aaf3120

Browse files
committed
[fix] #132 시간설정 버그 수정
1 parent 111fc64 commit aaf3120

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

app/src/main/java/org/shortweather/presentation/othertimesetting/view/OtherTimeSettingActivity.kt

+10-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ class OtherTimeSettingActivity :
1919
private val viewModel by viewModels<InputTimeViewModel>()
2020
private var beforeOut = " "
2121
private var beforeReturn = " "
22-
22+
private var outFlag = false
23+
private var returnFlag = false
2324

2425
override fun onCreate(savedInstanceState: Bundle?) {
2526
super.onCreate(savedInstanceState)
@@ -33,22 +34,24 @@ class OtherTimeSettingActivity :
3334
private fun setObservers() {
3435
viewModel.isOutDestroy.observe(this, EventObserver { isSuccess ->
3536
if (isSuccess && checkTimeChanged(OUT)) {
37+
outFlag = true
3638
binding.vSettingOutTimeLine.setBackgroundResource(R.color.short_weather_blue)
37-
binding.btnSettingOtherTimeCheck.isEnabled = true
39+
binding.btnSettingOtherTimeCheck.isEnabled = (outFlag && returnFlag)
3840
} else {
41+
outFlag = false
3942
binding.vSettingOutTimeLine.setBackgroundResource(R.color.short_weather_gray_1)
40-
binding.btnSettingOtherTimeCheck.isEnabled =
41-
checkTimeChanged(OUT) || checkTimeChanged(RETURN)
43+
binding.btnSettingOtherTimeCheck.isEnabled = false
4244
}
4345
})
4446
viewModel.isReturnDestroy.observe(this, EventObserver { isSuccess ->
4547
if (isSuccess && checkTimeChanged(RETURN)) {
48+
returnFlag = true
4649
binding.vSettingReturnTimeLine.setBackgroundResource(R.color.short_weather_blue)
47-
binding.btnSettingOtherTimeCheck.isEnabled = true
50+
binding.btnSettingOtherTimeCheck.isEnabled = (outFlag && returnFlag)
4851
} else { // 바텀시트 취소
52+
returnFlag = false
4953
binding.vSettingReturnTimeLine.setBackgroundResource(R.color.short_weather_gray_1)
50-
binding.btnSettingOtherTimeCheck.isEnabled =
51-
checkTimeChanged(OUT) || checkTimeChanged(RETURN)
54+
binding.btnSettingOtherTimeCheck.isEnabled = false
5255
}
5356
})
5457
}

0 commit comments

Comments
 (0)