removing nullable padding parameter in favour of callers handling nullability

This commit is contained in:
Adam Brown 2022-04-14 14:02:30 +01:00
parent 77da82c310
commit 7f7b75cae9
2 changed files with 9 additions and 11 deletions

View File

@ -33,11 +33,11 @@ fun View.showKeyboard(andRequestFocus: Boolean = false) {
imm?.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT)
}
fun View.setHorizontalPadding(padding: Int?) {
fun View.setHorizontalPadding(padding: Int) {
setPadding(
padding ?: paddingLeft,
padding,
paddingTop,
padding ?: paddingRight,
padding,
paddingBottom
)
}

View File

@ -50,14 +50,12 @@ abstract class PolicyItem : EpoxyModelWithHolder<PolicyItem.Holder>() {
override fun bind(holder: Holder) {
super.bind(holder)
holder.let {
it.view.setHorizontalPadding(horizontalPadding)
it.checkbox.isChecked = checked
it.checkbox.setOnCheckedChangeListener(checkChangeListener)
it.title.text = title
it.subtitle.text = subtitle
it.view.onClick(clickListener)
}
horizontalPadding?.let { holder.view.setHorizontalPadding(it) }
holder.checkbox.isChecked = checked
holder.checkbox.setOnCheckedChangeListener(checkChangeListener)
holder.title.text = title
holder.subtitle.text = subtitle
holder.view.onClick(clickListener)
}
// Ensure checkbox behaves as expected (remove the listener)