diff --git a/presentation/src/main/java/com/going/presentation/entertrip/preferencetag/PreferenceTagViewHolder.kt b/presentation/src/main/java/com/going/presentation/entertrip/preferencetag/PreferenceTagViewHolder.kt
index db19e5e1..b51a300c 100644
--- a/presentation/src/main/java/com/going/presentation/entertrip/preferencetag/PreferenceTagViewHolder.kt
+++ b/presentation/src/main/java/com/going/presentation/entertrip/preferencetag/PreferenceTagViewHolder.kt
@@ -2,7 +2,6 @@ package com.going.presentation.entertrip.preferencetag
import androidx.recyclerview.widget.RecyclerView
import com.going.domain.entity.PreferenceData
-import com.going.presentation.R
import com.going.presentation.databinding.ItemPreferenceTagBinding
class PreferenceTagViewHolder(
@@ -17,20 +16,36 @@ class PreferenceTagViewHolder(
tvPreferenceTag1.text = item.leftPrefer
tvPreferenceTag3.text = item.rightPrefer
- rgPreferenceTag.setOnCheckedChangeListener { _, checkedId ->
- val selectedButtonIdList = listOf(
- R.id.rb_preference_1,
- R.id.rb_preference_2,
- R.id.rb_preference_3,
- R.id.rb_preference_4,
- R.id.rb_preference_5
- )
+ val selectedButtonList = listOf(
+ rbPreference1,
+ rbPreference2,
+ rbPreference3,
+ rbPreference4,
+ rbPreference5
+ )
- val checkedIndex = selectedButtonIdList.indexOf(checkedId)
- if (checkedIndex != -1) {
- listener.onPreferenceSelected(item, checkedIndex)
+ val selectedViewList = listOf(
+ viewRadio1,
+ viewRadio2,
+ viewRadio3,
+ viewRadio4,
+ viewRadio5
+ )
+
+ selectedButtonList.forEachIndexed { index, radioButton ->
+ radioButton.setOnClickListener {
+ if (radioButton.isChecked) {
+ listener.onPreferenceSelected(item, index)
+ }
+ }
+ }
+
+ selectedViewList.forEachIndexed { index, view ->
+ view.setOnClickListener {
+ selectedButtonList[index].isChecked = true
+ listener.onPreferenceSelected(item, index)
}
}
}
}
-}
+}
\ No newline at end of file
diff --git a/presentation/src/main/res/layout/item_preference_tag.xml b/presentation/src/main/res/layout/item_preference_tag.xml
index 40feb977..ace88877 100644
--- a/presentation/src/main/res/layout/item_preference_tag.xml
+++ b/presentation/src/main/res/layout/item_preference_tag.xml
@@ -29,14 +29,14 @@
+ app:layout_constraintTop_toTopOf="@id/tv_preference_number" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file