diff --git a/mobile/src/main/java/org/openhab/habdroid/ui/WidgetDetailBottomSheets.kt b/mobile/src/main/java/org/openhab/habdroid/ui/WidgetDetailBottomSheets.kt index 19d7ee85db..26d4f9520d 100644 --- a/mobile/src/main/java/org/openhab/habdroid/ui/WidgetDetailBottomSheets.kt +++ b/mobile/src/main/java/org/openhab/habdroid/ui/WidgetDetailBottomSheets.kt @@ -98,7 +98,7 @@ class SliderBottomSheet : AbstractWidgetBottomSheet(), WidgetSlider.UpdateListen } } -class SelectionBottomSheet : AbstractWidgetBottomSheet(), RadioGroup.OnCheckedChangeListener { +class SelectionBottomSheet : AbstractWidgetBottomSheet() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { val view = inflater.inflate(R.layout.bottom_sheet_selection, container, false) val group = view.findViewById(R.id.group) @@ -108,23 +108,18 @@ class SelectionBottomSheet : AbstractWidgetBottomSheet(), RadioGroup.OnCheckedCh radio.id = mapping.hashCode() radio.text = mapping.label radio.isChecked = stateString == mapping.value + radio.setOnClickListener { + connection?.httpClient?.sendItemCommand(widget.item, mapping.value) + dismissAllowingStateLoss() + } group.addView(radio) } - group.setOnCheckedChangeListener(this) view.findViewById(R.id.title).apply { text = widget.label } return view } - - override fun onCheckedChanged(group: RadioGroup?, id: Int) { - val mapping = widget.mappingsOrItemOptions.firstOrNull { mapping -> mapping.hashCode() == id } - if (mapping != null) { - connection?.httpClient?.sendItemCommand(widget.item, mapping.value) - } - dismissAllowingStateLoss() - } } class ColorChooserBottomSheet : AbstractWidgetBottomSheet() {