Android: Allow users to interact with switches in settings
This commit is contained in:
parent
ea19909fd4
commit
cf8537576e
|
@ -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
|
||||
|
|
|
@ -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" />
|
||||
|
|
Loading…
Reference in New Issue