Makes sure bind and unbind are calling super in items

This commit is contained in:
ganfra 2020-06-22 11:19:53 +02:00
parent 10d78a3102
commit f762c4c7a2
52 changed files with 58 additions and 4 deletions

View file

@ -1,6 +1,9 @@
<component name="ProjectCodeStyleConfiguration"> <component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173"> <code_scheme name="Project" version="173">
<option name="RIGHT_MARGIN" value="160" /> <option name="RIGHT_MARGIN" value="160" />
<AndroidXmlCodeStyleSettings>
<option name="ARRANGEMENT_SETTINGS_MIGRATED_TO_191" value="true" />
</AndroidXmlCodeStyleSettings>
<JetCodeStyleSettings> <JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS"> <option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value> <value>

View file

@ -29,6 +29,7 @@ abstract class DividerItem : VectorEpoxyModel<DividerItem.Holder>() {
@EpoxyAttribute var color: Int = -1 @EpoxyAttribute var color: Int = -1
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
if (color != -1) { if (color != -1) {
holder.view.setBackgroundColor(color) holder.view.setBackgroundColor(color)
} }

View file

@ -33,6 +33,7 @@ abstract class ErrorWithRetryItem : VectorEpoxyModel<ErrorWithRetryItem.Holder>(
var listener: (() -> Unit)? = null var listener: (() -> Unit)? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.textView.text = text holder.textView.text = text
holder.buttonView.isVisible = listener != null holder.buttonView.isVisible = listener != null
holder.buttonView.setOnClickListener { listener?.invoke() } holder.buttonView.setOnClickListener { listener?.invoke() }

View file

@ -28,6 +28,7 @@ abstract class HelpFooterItem : VectorEpoxyModel<HelpFooterItem.Holder>() {
var text: String? = null var text: String? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.textView.text = text holder.textView.text = text
} }

View file

@ -28,6 +28,7 @@ abstract class NoResultItem : VectorEpoxyModel<NoResultItem.Holder>() {
var text: String? = null var text: String? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.textView.text = text holder.textView.text = text
} }

View file

@ -16,6 +16,7 @@
package im.vector.riotx.core.epoxy package im.vector.riotx.core.epoxy
import androidx.annotation.CallSuper
import androidx.lifecycle.Lifecycle import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LifecycleRegistry import androidx.lifecycle.LifecycleRegistry
@ -38,11 +39,13 @@ abstract class VectorEpoxyModel<H : VectorEpoxyHolder> : EpoxyModelWithHolder<H>
private var onModelVisibilityStateChangedListener: OnVisibilityStateChangedListener? = null private var onModelVisibilityStateChangedListener: OnVisibilityStateChangedListener? = null
@CallSuper
override fun bind(holder: H) { override fun bind(holder: H) {
super.bind(holder) super.bind(holder)
lifecycleRegistry.currentState = Lifecycle.State.STARTED lifecycleRegistry.currentState = Lifecycle.State.STARTED
} }
@CallSuper
override fun unbind(holder: H) { override fun unbind(holder: H) {
lifecycleRegistry.currentState = Lifecycle.State.DESTROYED lifecycleRegistry.currentState = Lifecycle.State.DESTROYED
coroutineScope.coroutineContext.cancelChildren() coroutineScope.coroutineContext.cancelChildren()

View file

@ -58,6 +58,7 @@ abstract class BottomSheetActionItem : VectorEpoxyModel<BottomSheetActionItem.Ho
lateinit var listener: View.OnClickListener lateinit var listener: View.OnClickListener
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.view.setOnClickListener { holder.view.setOnClickListener {
listener.onClick(it) listener.onClick(it)
} }

View file

@ -49,6 +49,7 @@ abstract class BottomSheetMessagePreviewItem : VectorEpoxyModel<BottomSheetMessa
var userClicked: (() -> Unit)? = null var userClicked: (() -> Unit)? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
avatarRenderer.render(matrixItem, holder.avatar) avatarRenderer.render(matrixItem, holder.avatar)
holder.avatar.setOnClickListener { userClicked?.invoke() } holder.avatar.setOnClickListener { userClicked?.invoke() }
holder.sender.setTextOrHide(matrixItem.displayName) holder.sender.setTextOrHide(matrixItem.displayName)

View file

@ -41,6 +41,7 @@ abstract class BottomSheetQuickReactionsItem : VectorEpoxyModel<BottomSheetQuick
var listener: Listener? = null var listener: Listener? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.textViews.forEachIndexed { index, textView -> holder.textViews.forEachIndexed { index, textView ->
textView.typeface = fontProvider.typeface ?: Typeface.DEFAULT textView.typeface = fontProvider.typeface ?: Typeface.DEFAULT
textView.text = texts[index] textView.text = texts[index]

View file

@ -49,6 +49,7 @@ abstract class BottomSheetRoomPreviewItem : VectorEpoxyModel<BottomSheetRoomPrev
@EpoxyAttribute var favoriteClickListener: ClickListener? = null @EpoxyAttribute var favoriteClickListener: ClickListener? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
avatarRenderer.render(matrixItem, holder.avatar) avatarRenderer.render(matrixItem, holder.avatar)
holder.avatar.onClick(settingsClickListener) holder.avatar.onClick(settingsClickListener)
holder.roomName.setTextOrHide(matrixItem.displayName) holder.roomName.setTextOrHide(matrixItem.displayName)

View file

@ -41,6 +41,7 @@ abstract class BottomSheetSendStateItem : VectorEpoxyModel<BottomSheetSendStateI
var drawableStart: Int = 0 var drawableStart: Int = 0
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.progress.isVisible = showProgress holder.progress.isVisible = showProgress
holder.text.setCompoundDrawablesWithIntrinsicBounds(drawableStart, 0, 0, 0) holder.text.setCompoundDrawablesWithIntrinsicBounds(drawableStart, 0, 0, 0)
holder.text.text = text holder.text.text = text

View file

@ -40,6 +40,7 @@ abstract class ProfileMatrixItem : VectorEpoxyModel<ProfileMatrixItem.Holder>()
@EpoxyAttribute var clickListener: View.OnClickListener? = null @EpoxyAttribute var clickListener: View.OnClickListener? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
val bestName = matrixItem.getBestName() val bestName = matrixItem.getBestName()
val matrixId = matrixItem.id.takeIf { it != bestName } val matrixId = matrixItem.id.takeIf { it != bestName }
holder.view.setOnClickListener(clickListener) holder.view.setOnClickListener(clickListener)

View file

@ -47,6 +47,7 @@ abstract class GenericButtonItem : VectorEpoxyModel<GenericButtonItem.Holder>()
var iconRes: Int? = null var iconRes: Int? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.button.text = text holder.button.text = text
val textColor = textColor ?: ThemeUtils.getColor(holder.view.context, R.attr.riotx_text_primary) val textColor = textColor ?: ThemeUtils.getColor(holder.view.context, R.attr.riotx_text_primary)
holder.button.setTextColor(textColor) holder.button.setTextColor(textColor)

View file

@ -52,6 +52,7 @@ abstract class GenericFooterItem : VectorEpoxyModel<GenericFooterItem.Holder>()
var textColor: Int? = null var textColor: Int? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.text.setTextOrHide(text) holder.text.setTextOrHide(text)
when (style) { when (style) {
GenericItem.STYLE.BIG_TEXT -> holder.text.textSize = 18f GenericItem.STYLE.BIG_TEXT -> holder.text.textSize = 18f

View file

@ -74,6 +74,7 @@ abstract class GenericItem : VectorEpoxyModel<GenericItem.Holder>() {
var itemClickAction: Action? = null var itemClickAction: Action? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.titleText.setTextOrHide(title) holder.titleText.setTextOrHide(title)
if (titleIconResourceId != -1) { if (titleIconResourceId != -1) {

View file

@ -33,6 +33,7 @@ abstract class GenericItemHeader : VectorEpoxyModel<GenericItemHeader.Holder>()
var text: String? = null var text: String? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.text.setTextOrHide(text) holder.text.setTextOrHide(text)
} }

View file

@ -57,6 +57,7 @@ abstract class GenericItemWithValue : VectorEpoxyModel<GenericItemWithValue.Hold
var itemClickAction: View.OnClickListener? = null var itemClickAction: View.OnClickListener? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.titleText.setTextOrHide(title) holder.titleText.setTextOrHide(title)
if (titleIconResourceId != -1) { if (titleIconResourceId != -1) {

View file

@ -13,7 +13,9 @@ abstract class GenericLoaderItem : VectorEpoxyModel<GenericLoaderItem.Holder>()
// Maybe/Later add some style configuration, SMALL/BIG ? // Maybe/Later add some style configuration, SMALL/BIG ?
override fun bind(holder: Holder) {} override fun bind(holder: Holder) {
super.bind(holder)
}
class Holder : VectorEpoxyHolder() class Holder : VectorEpoxyHolder()
} }

View file

@ -33,6 +33,7 @@ abstract class AttachmentPreviewItem<H : AttachmentPreviewItem.Holder> : VectorE
abstract val attachment: ContentAttachmentData abstract val attachment: ContentAttachmentData
override fun bind(holder: H) { override fun bind(holder: H) {
super.bind(holder)
if (attachment.type == ContentAttachmentData.Type.VIDEO || attachment.type == ContentAttachmentData.Type.IMAGE) { if (attachment.type == ContentAttachmentData.Type.VIDEO || attachment.type == ContentAttachmentData.Type.IMAGE) {
Glide.with(holder.view.context) Glide.with(holder.view.context)
.asBitmap() .asBitmap()

View file

@ -37,6 +37,7 @@ abstract class AutocompleteMatrixItem : VectorEpoxyModel<AutocompleteMatrixItem.
@EpoxyAttribute var clickListener: View.OnClickListener? = null @EpoxyAttribute var clickListener: View.OnClickListener? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.view.setOnClickListener(clickListener) holder.view.setOnClickListener(clickListener)
holder.nameView.text = matrixItem.getBestName() holder.nameView.text = matrixItem.getBestName()
holder.subNameView.setTextOrHide(subName) holder.subNameView.setTextOrHide(subName)

View file

@ -37,6 +37,7 @@ abstract class AutocompleteCommandItem : VectorEpoxyModel<AutocompleteCommandIte
var clickListener: View.OnClickListener? = null var clickListener: View.OnClickListener? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.view.setOnClickListener(clickListener) holder.view.setOnClickListener(clickListener)
holder.nameView.text = name holder.nameView.text = name

View file

@ -40,6 +40,7 @@ abstract class AutocompleteEmojiItem : VectorEpoxyModel<AutocompleteEmojiItem.Ho
var onClickListener: ReactionClickListener? = null var onClickListener: ReactionClickListener? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.emojiText.text = emojiItem.emoji holder.emojiText.text = emojiItem.emoji
holder.emojiText.typeface = emojiTypeFace ?: Typeface.DEFAULT holder.emojiText.typeface = emojiTypeFace ?: Typeface.DEFAULT
holder.emojiNameText.text = emojiItem.name holder.emojiNameText.text = emojiItem.name

View file

@ -42,6 +42,7 @@ abstract class KeysBackupSettingFooterItem : VectorEpoxyModel<KeysBackupSettingF
var clickOnButton2: View.OnClickListener? = null var clickOnButton2: View.OnClickListener? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.button1.setTextOrHide(textButton1) holder.button1.setTextOrHide(textButton1)
holder.button1.setOnClickListener(clickOnButton1) holder.button1.setOnClickListener(clickOnButton1)

View file

@ -51,6 +51,7 @@ abstract class BottomSheetVerificationActionItem : VectorEpoxyModel<BottomSheetV
lateinit var listener: () -> Unit lateinit var listener: () -> Unit
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.view.setOnClickListener { holder.view.setOnClickListener {
listener.invoke() listener.invoke()
} }

View file

@ -37,6 +37,7 @@ abstract class BottomSheetVerificationBigImageItem : VectorEpoxyModel<BottomShee
var contentDescription: String? = null var contentDescription: String? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.image.setImageResource(imageRes) holder.image.setImageResource(imageRes)
if (contentDescription == null) { if (contentDescription == null) {

View file

@ -33,6 +33,7 @@ abstract class BottomSheetVerificationDecimalCodeItem : VectorEpoxyModel<BottomS
var code: CharSequence = "" var code: CharSequence = ""
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.code.text = code holder.code.text = code
} }

View file

@ -47,6 +47,7 @@ abstract class BottomSheetVerificationEmojisItem : VectorEpoxyModel<BottomSheetV
@EpoxyAttribute lateinit var emojiRepresentation6: EmojiRepresentation @EpoxyAttribute lateinit var emojiRepresentation6: EmojiRepresentation
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
bindEmojiView(holder.emoji0View, emojiRepresentation0) bindEmojiView(holder.emoji0View, emojiRepresentation0)
bindEmojiView(holder.emoji1View, emojiRepresentation1) bindEmojiView(holder.emoji1View, emojiRepresentation1)
bindEmojiView(holder.emoji2View, emojiRepresentation2) bindEmojiView(holder.emoji2View, emojiRepresentation2)

View file

@ -33,6 +33,7 @@ abstract class BottomSheetVerificationNoticeItem : VectorEpoxyModel<BottomSheetV
var notice: CharSequence = "" var notice: CharSequence = ""
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.notice.text = notice holder.notice.text = notice
} }

View file

@ -36,6 +36,7 @@ abstract class BottomSheetVerificationQrCodeItem : VectorEpoxyModel<BottomSheetV
var animate = false var animate = false
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.qsrCodeImage.setData(data, animate) holder.qsrCodeImage.setData(data, animate)
} }

View file

@ -33,6 +33,7 @@ abstract class BottomSheetVerificationWaitingItem : VectorEpoxyModel<BottomSheet
var title: CharSequence = "" var title: CharSequence = ""
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.title.text = title holder.title.text = title
} }

View file

@ -48,6 +48,7 @@ abstract class SettingsItem : EpoxyModelWithHolder<SettingsItem.Holder>() {
var itemClickListener: View.OnClickListener? = null var itemClickListener: View.OnClickListener? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
if (titleResId != null) { if (titleResId != null) {
holder.titleText.setText(titleResId!!) holder.titleText.setText(titleResId!!)
} else { } else {

View file

@ -48,6 +48,7 @@ abstract class FormEditTextItem : VectorEpoxyModel<FormEditTextItem.Holder>() {
} }
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.textInputLayout.isEnabled = enabled holder.textInputLayout.isEnabled = enabled
holder.textInputLayout.hint = hint holder.textInputLayout.hint = hint

View file

@ -44,6 +44,7 @@ abstract class FormSwitchItem : VectorEpoxyModel<FormSwitchItem.Holder>() {
var summary: String? = null var summary: String? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.view.setOnClickListener { holder.view.setOnClickListener {
if (enabled) { if (enabled) {
holder.switchView.toggle() holder.switchView.toggle()

View file

@ -36,6 +36,7 @@ abstract class DisplayReadReceiptItem : EpoxyModelWithHolder<DisplayReadReceiptI
@EpoxyAttribute var userClicked: (() -> Unit)? = null @EpoxyAttribute var userClicked: (() -> Unit)? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
avatarRenderer.render(matrixItem, holder.avatarView) avatarRenderer.render(matrixItem, holder.avatarView)
holder.displayNameView.text = matrixItem.getBestName() holder.displayNameView.text = matrixItem.getBestName()
timestamp?.let { timestamp?.let {

View file

@ -29,6 +29,7 @@ abstract class DaySeparatorItem : EpoxyModelWithHolder<DaySeparatorItem.Holder>(
@EpoxyAttribute lateinit var formattedDay: CharSequence @EpoxyAttribute lateinit var formattedDay: CharSequence
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.dayTextView.text = formattedDay holder.dayTextView.text = formattedDay
} }

View file

@ -30,6 +30,7 @@ abstract class RoomCreateItem : VectorEpoxyModel<RoomCreateItem.Holder>() {
@EpoxyAttribute lateinit var text: CharSequence @EpoxyAttribute lateinit var text: CharSequence
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.description.movementMethod = BetterLinkMovementMethod.getInstance() holder.description.movementMethod = BetterLinkMovementMethod.getInstance()
holder.description.text = text holder.description.text = text
} }

View file

@ -24,8 +24,6 @@ import im.vector.riotx.core.epoxy.VectorEpoxyModel
@EpoxyModelClass(layout = R.layout.item_timeline_read_marker) @EpoxyModelClass(layout = R.layout.item_timeline_read_marker)
abstract class TimelineReadMarkerItem : VectorEpoxyModel<TimelineReadMarkerItem.Holder>() { abstract class TimelineReadMarkerItem : VectorEpoxyModel<TimelineReadMarkerItem.Holder>() {
override fun bind(holder: Holder) {
}
class Holder : VectorEpoxyHolder() class Holder : VectorEpoxyHolder()
} }

View file

@ -40,6 +40,7 @@ abstract class ReactionInfoSimpleItem : EpoxyModelWithHolder<ReactionInfoSimpleI
var userClicked: (() -> Unit)? = null var userClicked: (() -> Unit)? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.emojiReactionView.text = reactionKey holder.emojiReactionView.text = reactionKey
holder.displayNameView.text = authorDisplayName holder.displayNameView.text = authorDisplayName
timeStamp?.let { timeStamp?.let {

View file

@ -33,6 +33,7 @@ abstract class RoomWidgetItem : EpoxyModelWithHolder<RoomWidgetItem.Holder>() {
@EpoxyAttribute var widgetClicked: ClickListener? = null @EpoxyAttribute var widgetClicked: ClickListener? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.widgetName.text = widget.name holder.widgetName.text = widget.name
holder.view.onClick(widgetClicked) holder.view.onClick(widgetClicked)
} }

View file

@ -34,6 +34,7 @@ abstract class FilteredRoomFooterItem : VectorEpoxyModel<FilteredRoomFooterItem.
var currentFilter: String = "" var currentFilter: String = ""
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.createRoomButton.setOnClickListener { listener?.createRoom(currentFilter) } holder.createRoomButton.setOnClickListener { listener?.createRoom(currentFilter) }
holder.createDirectChat.setOnClickListener { listener?.createDirectChat() } holder.createDirectChat.setOnClickListener { listener?.createDirectChat() }
holder.openRoomDirectory.setOnClickListener { listener?.openRoomDirectory(currentFilter) } holder.openRoomDirectory.setOnClickListener { listener?.openRoomDirectory(currentFilter) }

View file

@ -37,6 +37,7 @@ abstract class RoomCategoryItem : VectorEpoxyModel<RoomCategoryItem.Holder>() {
@EpoxyAttribute var listener: (() -> Unit)? = null @EpoxyAttribute var listener: (() -> Unit)? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
val tintColor = ThemeUtils.getColor(holder.rootView.context, R.attr.riotx_text_secondary) val tintColor = ThemeUtils.getColor(holder.rootView.context, R.attr.riotx_text_secondary)
val expandedArrowDrawableRes = if (expanded) R.drawable.ic_expand_more_white else R.drawable.ic_expand_less_white val expandedArrowDrawableRes = if (expanded) R.drawable.ic_expand_more_white else R.drawable.ic_expand_less_white
val expandedArrowDrawable = ContextCompat.getDrawable(holder.rootView.context, expandedArrowDrawableRes)?.also { val expandedArrowDrawable = ContextCompat.getDrawable(holder.rootView.context, expandedArrowDrawableRes)?.also {

View file

@ -44,6 +44,7 @@ abstract class PolicyItem : EpoxyModelWithHolder<PolicyItem.Holder>() {
var clickListener: View.OnClickListener? = null var clickListener: View.OnClickListener? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.let { holder.let {
it.checkbox.isChecked = checked it.checkbox.isChecked = checked
it.checkbox.setOnCheckedChangeListener(checkChangeListener) it.checkbox.setOnCheckedChangeListener(checkChangeListener)

View file

@ -57,6 +57,7 @@ abstract class PublicRoomItem : VectorEpoxyModel<PublicRoomItem.Holder>() {
var joinListener: (() -> Unit)? = null var joinListener: (() -> Unit)? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.rootView.setOnClickListener { globalListener?.invoke() } holder.rootView.setOnClickListener { globalListener?.invoke() }
avatarRenderer.render(matrixItem, holder.avatarView) avatarRenderer.render(matrixItem, holder.avatarView)

View file

@ -46,6 +46,7 @@ abstract class RoomDirectoryItem : VectorEpoxyModel<RoomDirectoryItem.Holder>()
var globalListener: (() -> Unit)? = null var globalListener: (() -> Unit)? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.rootView.setOnClickListener { globalListener?.invoke() } holder.rootView.setOnClickListener { globalListener?.invoke() }
// Avatar // Avatar

View file

@ -73,6 +73,7 @@ abstract class DeviceItem : VectorEpoxyModel<DeviceItem.Holder>() {
var dimensionConverter: DimensionConverter? = null var dimensionConverter: DimensionConverter? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.root.setOnClickListener { itemClickAction?.invoke() } holder.root.setOnClickListener { itemClickAction?.invoke() }
val shield = TrustUtils.shieldForTrust( val shield = TrustUtils.shieldForTrust(

View file

@ -43,6 +43,7 @@ abstract class UserItem : VectorEpoxyModel<UserItem.Holder>() {
var itemClickAction: (() -> Unit)? = null var itemClickAction: (() -> Unit)? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.root.setOnClickListener { itemClickAction?.invoke() } holder.root.setOnClickListener { itemClickAction?.invoke() }
avatarRenderer.render(matrixItem, holder.avatarImage) avatarRenderer.render(matrixItem, holder.avatarImage)

View file

@ -31,6 +31,7 @@ abstract class PushGatewayItem : EpoxyModelWithHolder<PushGatewayItem.Holder>()
lateinit var pusher: Pusher lateinit var pusher: Pusher
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.kind.text = when (pusher.kind) { holder.kind.text = when (pusher.kind) {
// TODO Create const // TODO Create const
"http" -> "Http Pusher" "http" -> "Http Pusher"

View file

@ -41,6 +41,7 @@ abstract class PushRuleItem : EpoxyModelWithHolder<PushRuleItem.Holder>() {
// TODO i18n // TODO i18n
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
val context = holder.view.context val context = holder.view.context
if (pushRule.enabled) { if (pushRule.enabled) {
holder.view.setBackgroundColor(Color.TRANSPARENT) holder.view.setBackgroundColor(Color.TRANSPARENT)

View file

@ -34,6 +34,7 @@ abstract class LoginErrorWithRetryItem : VectorEpoxyModel<LoginErrorWithRetryIte
var listener: (() -> Unit)? = null var listener: (() -> Unit)? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.textView.text = text holder.textView.text = text
holder.buttonView.setOnClickListener { listener?.invoke() } holder.buttonView.setOnClickListener { listener?.invoke() }
} }

View file

@ -45,6 +45,7 @@ abstract class TermItem : EpoxyModelWithHolder<TermItem.Holder>() {
var clickListener: View.OnClickListener? = null var clickListener: View.OnClickListener? = null
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.checkbox.isChecked = checked holder.checkbox.isChecked = checked
holder.title.text = name holder.title.text = name
holder.description.text = description holder.description.text = description

View file

@ -29,6 +29,7 @@ abstract class UserDirectoryLetterHeaderItem : VectorEpoxyModel<UserDirectoryLet
@EpoxyAttribute var letter: String = "" @EpoxyAttribute var letter: String = ""
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.letterView.text = letter holder.letterView.text = letter
} }

View file

@ -38,6 +38,7 @@ abstract class UserDirectoryUserItem : VectorEpoxyModel<UserDirectoryUserItem.Ho
@EpoxyAttribute var selected: Boolean = false @EpoxyAttribute var selected: Boolean = false
override fun bind(holder: Holder) { override fun bind(holder: Holder) {
super.bind(holder)
holder.view.setOnClickListener(clickListener) holder.view.setOnClickListener(clickListener)
// If name is empty, use userId as name and force it being centered // If name is empty, use userId as name and force it being centered
if (matrixItem.displayName.isNullOrEmpty()) { if (matrixItem.displayName.isNullOrEmpty()) {