@@ -19,7 +19,8 @@ class OtherTimeSettingActivity :
19
19
private val viewModel by viewModels<InputTimeViewModel >()
20
20
private var beforeOut = " "
21
21
private var beforeReturn = " "
22
-
22
+ private var outFlag = false
23
+ private var returnFlag = false
23
24
24
25
override fun onCreate (savedInstanceState : Bundle ? ) {
25
26
super .onCreate(savedInstanceState)
@@ -33,22 +34,24 @@ class OtherTimeSettingActivity :
33
34
private fun setObservers () {
34
35
viewModel.isOutDestroy.observe(this , EventObserver { isSuccess ->
35
36
if (isSuccess && checkTimeChanged(OUT )) {
37
+ outFlag = true
36
38
binding.vSettingOutTimeLine.setBackgroundResource(R .color.short_weather_blue)
37
- binding.btnSettingOtherTimeCheck.isEnabled = true
39
+ binding.btnSettingOtherTimeCheck.isEnabled = (outFlag && returnFlag)
38
40
} else {
41
+ outFlag = false
39
42
binding.vSettingOutTimeLine.setBackgroundResource(R .color.short_weather_gray_1)
40
- binding.btnSettingOtherTimeCheck.isEnabled =
41
- checkTimeChanged(OUT ) || checkTimeChanged(RETURN )
43
+ binding.btnSettingOtherTimeCheck.isEnabled = false
42
44
}
43
45
})
44
46
viewModel.isReturnDestroy.observe(this , EventObserver { isSuccess ->
45
47
if (isSuccess && checkTimeChanged(RETURN )) {
48
+ returnFlag = true
46
49
binding.vSettingReturnTimeLine.setBackgroundResource(R .color.short_weather_blue)
47
- binding.btnSettingOtherTimeCheck.isEnabled = true
50
+ binding.btnSettingOtherTimeCheck.isEnabled = (outFlag && returnFlag)
48
51
} else { // 바텀시트 취소
52
+ returnFlag = false
49
53
binding.vSettingReturnTimeLine.setBackgroundResource(R .color.short_weather_gray_1)
50
- binding.btnSettingOtherTimeCheck.isEnabled =
51
- checkTimeChanged(OUT ) || checkTimeChanged(RETURN )
54
+ binding.btnSettingOtherTimeCheck.isEnabled = false
52
55
}
53
56
})
54
57
}
0 commit comments