mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 09:56:00 +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>()
|
val imm = context?.getSystemService<InputMethodManager>()
|
||||||
imm?.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT)
|
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.ClickListener
|
||||||
import im.vector.app.core.epoxy.VectorEpoxyHolder
|
import im.vector.app.core.epoxy.VectorEpoxyHolder
|
||||||
import im.vector.app.core.epoxy.onClick
|
import im.vector.app.core.epoxy.onClick
|
||||||
|
import im.vector.app.core.extensions.setHorizontalPadding
|
||||||
|
|
||||||
@EpoxyModelClass(layout = R.layout.item_policy)
|
@EpoxyModelClass(layout = R.layout.item_policy)
|
||||||
abstract class PolicyItem : EpoxyModelWithHolder<PolicyItem.Holder>() {
|
abstract class PolicyItem : EpoxyModelWithHolder<PolicyItem.Holder>() {
|
||||||
|
@ -50,12 +51,7 @@ abstract class PolicyItem : EpoxyModelWithHolder<PolicyItem.Holder>() {
|
||||||
override fun bind(holder: Holder) {
|
override fun bind(holder: Holder) {
|
||||||
super.bind(holder)
|
super.bind(holder)
|
||||||
holder.let {
|
holder.let {
|
||||||
it.view.setPadding(
|
it.view.setHorizontalPadding(horizontalPadding)
|
||||||
horizontalPadding ?: it.view.paddingLeft,
|
|
||||||
it.view.paddingTop,
|
|
||||||
horizontalPadding ?: it.view.paddingRight,
|
|
||||||
it.view.paddingBottom
|
|
||||||
)
|
|
||||||
it.checkbox.isChecked = checked
|
it.checkbox.isChecked = checked
|
||||||
it.checkbox.setOnCheckedChangeListener(checkChangeListener)
|
it.checkbox.setOnCheckedChangeListener(checkChangeListener)
|
||||||
it.title.text = title
|
it.title.text = title
|
||||||
|
|
Loading…
Reference in a new issue