File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed
java/com/sopetit/softie/ui/onboarding/bearselection Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,19 @@ class BearSelectionViewModel @Inject constructor(
14
14
) : ViewModel() {
15
15
private val _selectedBearType : MutableLiveData <String > = MutableLiveData (NONE )
16
16
val selectedBearType: LiveData <String > get() = _selectedBearType
17
+ private val _isBearSelected : MutableLiveData <Boolean > = MutableLiveData (false )
18
+ val isBearSelected: LiveData <Boolean > get() = _isBearSelected
17
19
18
20
fun selectBearType (dollType : String ) {
19
21
val isSameBearSelected = _selectedBearType .value == dollType
20
22
21
- if (isSameBearSelected) _selectedBearType .value = NONE
22
- else _selectedBearType .value = dollType
23
+ if (isSameBearSelected) {
24
+ _selectedBearType .value = NONE
25
+ _isBearSelected .value = false
26
+ } else {
27
+ _selectedBearType .value = dollType
28
+ _isBearSelected .value = true
29
+ }
23
30
}
24
31
25
32
fun setBearType () {
Original file line number Diff line number Diff line change 100
100
android : layout_marginHorizontal =" 20dp"
101
101
android : layout_marginBottom =" 34dp"
102
102
style =" ?android:attr/borderlessButtonStyle"
103
- android : background =" @{viewModel.selectedBearType != @string/none ? @drawable/shape_main1_fill_12_rect : @drawable/shape_gray200_fill_12_rect}"
104
- android : clickable =" @{viewModel.selectedBearType != @string/none ? true : false}"
105
- android : enabled =" @{viewModel.selectedBearType != @string/none ? true : false}"
103
+ android : background =" @{viewModel.isBearSelected ? @drawable/shape_main1_fill_12_rect: @drawable/shape_gray200_fill_12_rect}"
104
+ android : clickable =" @{viewModel.isBearSelected ? true: false}"
105
+ android : enabled =" @{viewModel.isBearSelected ? true: false}"
106
106
android : text =" @string/bear_selection_button"
107
107
android : textAppearance =" @style/body1"
108
108
android : textColor =" @color/gray000"
Original file line number Diff line number Diff line change 6
6
<string name =" red" >RED</string >
7
7
<string name =" white" >WHITE</string >
8
8
<string name =" gray" >GRAY</string >
9
- <string name =" none" ></string >
10
9
11
10
<!-- util -->
12
11
<string name =" finish_app_toast_msg" >뒤로가기를 한 번 더 누르면 종료됩니다</string >
You can’t perform that action at this time.
0 commit comments