From da9b9f486447385fc718ca4fbad46389bb8df07d Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 21 Jan 2020 15:48:35 +0100 Subject: [PATCH] Make the whole cell clickable --- .../java/im/vector/riotx/features/form/FormSwitchItem.kt | 6 ++++++ vector/src/main/res/layout/item_form_switch.xml | 1 + 2 files changed, 7 insertions(+) diff --git a/vector/src/main/java/im/vector/riotx/features/form/FormSwitchItem.kt b/vector/src/main/java/im/vector/riotx/features/form/FormSwitchItem.kt index 2e48a8b709..1f3c7c81bb 100644 --- a/vector/src/main/java/im/vector/riotx/features/form/FormSwitchItem.kt +++ b/vector/src/main/java/im/vector/riotx/features/form/FormSwitchItem.kt @@ -44,6 +44,12 @@ abstract class FormSwitchItem : VectorEpoxyModel() { var summary: String? = null override fun bind(holder: Holder) { + holder.view.setOnClickListener { + if (enabled) { + holder.switchView.toggle() + } + } + holder.titleView.text = title holder.summaryView.setTextOrHide(summary) diff --git a/vector/src/main/res/layout/item_form_switch.xml b/vector/src/main/res/layout/item_form_switch.xml index 5757c4b853..3583ac8024 100644 --- a/vector/src/main/res/layout/item_form_switch.xml +++ b/vector/src/main/res/layout/item_form_switch.xml @@ -5,6 +5,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?riotx_background" + android:foreground="?attr/selectableItemBackground" android:minHeight="@dimen/item_form_min_height">