Merge pull request #11369 from t895/switch-fix

Android: Allow users to interact with switches in settings
This commit is contained in:
JosJuice 2022-12-24 09:09:17 +01:00 committed by GitHub
commit b3bc9c41ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -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

View File

@ -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" />