mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 01:45:52 +03:00
extracting helper for setting horizontal padding
This commit is contained in:
parent
1f6068976d
commit
215cac2aec
2 changed files with 11 additions and 6 deletions
|
@ -32,3 +32,12 @@ fun View.showKeyboard(andRequestFocus: Boolean = false) {
|
|||
val imm = context?.getSystemService<InputMethodManager>()
|
||||
imm?.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT)
|
||||
}
|
||||
|
||||
fun View.setHorizontalPadding(padding: Int?) {
|
||||
setPadding(
|
||||
padding ?: paddingLeft,
|
||||
paddingTop,
|
||||
padding ?: paddingRight,
|
||||
paddingBottom
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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<PolicyItem.Holder>() {
|
||||
|
@ -50,12 +51,7 @@ abstract class PolicyItem : EpoxyModelWithHolder<PolicyItem.Holder>() {
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue