From 0d4bf53ad9f299ea267bae164085fda9486b0aca Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Sat, 12 Aug 2023 01:00:42 -0400 Subject: android: Set switch listener before assigning new value Previously the switch could have its old listener triggered when recycled. --- .../yuzu_emu/features/settings/ui/viewholder/SwitchSettingViewHolder.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SwitchSettingViewHolder.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SwitchSettingViewHolder.kt index 54f531795..f09f3e859 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SwitchSettingViewHolder.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SwitchSettingViewHolder.kt @@ -25,10 +25,10 @@ class SwitchSettingViewHolder(val binding: ListItemSettingSwitchBinding, adapter binding.textSettingDescription.text = "" binding.textSettingDescription.visibility = View.GONE } - binding.switchWidget.isChecked = setting.isChecked binding.switchWidget.setOnCheckedChangeListener { _: CompoundButton, _: Boolean -> adapter.onBooleanClick(item, bindingAdapterPosition, binding.switchWidget.isChecked) } + binding.switchWidget.isChecked = setting.isChecked binding.switchWidget.isEnabled = setting.isEditable } -- cgit v1.2.3