From cf8537576e98d0f9ee1dd03ee8c73e44bbc3cd88 Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Tue, 20 Dec 2022 20:27:43 -0500 Subject: [PATCH] Android: Allow users to interact with switches in settings --- .../ui/viewholder/SwitchSettingViewHolder.java | 13 +++++++++---- .../main/res/layout/list_item_setting_switch.xml | 1 - 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SwitchSettingViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SwitchSettingViewHolder.java index 9364f1e3eb..ea7185b2ec 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SwitchSettingViewHolder.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SwitchSettingViewHolder.java @@ -33,6 +33,15 @@ public final class SwitchSettingViewHolder extends SettingViewHolder mBinding.settingSwitch.setChecked(mItem.isChecked(getAdapter().getSettings())); + mBinding.settingSwitch.setEnabled(mItem.isEditable()); + + mBinding.settingSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> + { + getAdapter().onBooleanClick(mItem, mBinding.settingSwitch.isChecked()); + + setStyle(mBinding.textSettingName, mItem); + }); + setStyle(mBinding.textSettingName, mItem); } @@ -46,10 +55,6 @@ public final class SwitchSettingViewHolder extends SettingViewHolder } mBinding.settingSwitch.toggle(); - - getAdapter().onBooleanClick(mItem, mBinding.settingSwitch.isChecked()); - - setStyle(mBinding.textSettingName, mItem); } @Nullable @Override diff --git a/Source/Android/app/src/main/res/layout/list_item_setting_switch.xml b/Source/Android/app/src/main/res/layout/list_item_setting_switch.xml index aab0408c7b..9613a7337f 100644 --- a/Source/Android/app/src/main/res/layout/list_item_setting_switch.xml +++ b/Source/Android/app/src/main/res/layout/list_item_setting_switch.xml @@ -44,7 +44,6 @@ android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:layout_marginEnd="24dp" - android:clickable="false" android:focusable="false" android:minHeight="0dp" android:minWidth="0dp" />