diff --git a/vector/src/main/java/im/vector/app/core/extensions/View.kt b/vector/src/main/java/im/vector/app/core/extensions/View.kt index 7ec86d3508..8b30f9e015 100644 --- a/vector/src/main/java/im/vector/app/core/extensions/View.kt +++ b/vector/src/main/java/im/vector/app/core/extensions/View.kt @@ -32,3 +32,12 @@ fun View.showKeyboard(andRequestFocus: Boolean = false) { val imm = context?.getSystemService() imm?.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT) } + +fun View.setHorizontalPadding(padding: Int?) { + setPadding( + padding ?: paddingLeft, + paddingTop, + padding ?: paddingRight, + paddingBottom + ) +} diff --git a/vector/src/main/java/im/vector/app/features/login/terms/PolicyItem.kt b/vector/src/main/java/im/vector/app/features/login/terms/PolicyItem.kt index da1b68c976..a1cd64db40 100644 --- a/vector/src/main/java/im/vector/app/features/login/terms/PolicyItem.kt +++ b/vector/src/main/java/im/vector/app/features/login/terms/PolicyItem.kt @@ -26,6 +26,7 @@ import im.vector.app.R import im.vector.app.core.epoxy.ClickListener import im.vector.app.core.epoxy.VectorEpoxyHolder import im.vector.app.core.epoxy.onClick +import im.vector.app.core.extensions.setHorizontalPadding @EpoxyModelClass(layout = R.layout.item_policy) abstract class PolicyItem : EpoxyModelWithHolder() { @@ -50,12 +51,7 @@ abstract class PolicyItem : EpoxyModelWithHolder() { override fun bind(holder: Holder) { super.bind(holder) holder.let { - it.view.setPadding( - horizontalPadding ?: it.view.paddingLeft, - it.view.paddingTop, - horizontalPadding ?: it.view.paddingRight, - it.view.paddingBottom - ) + it.view.setHorizontalPadding(horizontalPadding) it.checkbox.isChecked = checked it.checkbox.setOnCheckedChangeListener(checkChangeListener) it.title.text = title