mirror of
https://github.com/element-hq/element-android
synced 2024-11-23 18:05:36 +03:00
Makes sure bind and unbind are calling super in items
This commit is contained in:
parent
10d78a3102
commit
f762c4c7a2
52 changed files with 58 additions and 4 deletions
|
@ -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>
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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() }
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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]
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) }
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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(
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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() }
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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()) {
|
||||||
|
|
Loading…
Reference in a new issue