forked from upstream-mirrors/quik
Use LayoutContainer api for ViewHolders
This commit is contained in:
@@ -69,7 +69,7 @@ class AttachmentAdapter @Inject constructor(
|
||||
|
||||
override fun onBindViewHolder(holder: QkViewHolder, position: Int) {
|
||||
val attachment = getItem(position)
|
||||
val view = holder.itemView
|
||||
val view = holder.containerView
|
||||
|
||||
when (attachment) {
|
||||
is Attachment.Image -> Glide.with(context)
|
||||
|
||||
@@ -98,7 +98,7 @@ class ChipsAdapter @Inject constructor(private val context: Context) : QkAdapter
|
||||
when (getItemViewType(position)) {
|
||||
TYPE_ITEM -> {
|
||||
val contact = getItem(position)
|
||||
val view = holder.itemView
|
||||
val view = holder.containerView
|
||||
|
||||
view.avatar.setContact(contact)
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class ContactAdapter @Inject constructor() : QkAdapter<Contact>() {
|
||||
|
||||
override fun onBindViewHolder(holder: QkViewHolder, position: Int) {
|
||||
val contact = getItem(position)
|
||||
val view = holder.itemView
|
||||
val view = holder.containerView
|
||||
|
||||
view.avatar.setContact(contact)
|
||||
view.name.text = contact.name
|
||||
|
||||
@@ -174,7 +174,7 @@ class MessagesAdapter @Inject constructor(
|
||||
val message = getItem(position)!!
|
||||
val previous = if (position == 0) null else getItem(position - 1)
|
||||
val next = if (position == itemCount - 1) null else getItem(position + 1)
|
||||
val view = viewHolder.itemView
|
||||
val view = viewHolder.containerView
|
||||
|
||||
|
||||
// Update the selected state
|
||||
@@ -267,7 +267,7 @@ class MessagesAdapter @Inject constructor(
|
||||
}
|
||||
|
||||
private fun bindStatus(viewHolder: QkViewHolder, message: Message, next: Message?) {
|
||||
val view = viewHolder.itemView
|
||||
val view = viewHolder.containerView
|
||||
|
||||
val age = TimeUnit.MILLISECONDS.toMinutes(System.currentTimeMillis() - message.date)
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class PhoneNumberAdapter(
|
||||
|
||||
override fun onBindViewHolder(holder: QkViewHolder, position: Int) {
|
||||
val number = getItem(position)
|
||||
val view = holder.itemView
|
||||
val view = holder.containerView
|
||||
|
||||
// Setting this in onCreateViewHolder causes a crash sometimes. [contact] returns the
|
||||
// contact from a different row, I'm not sure why
|
||||
|
||||
@@ -66,7 +66,7 @@ class PartsAdapter(context: Context, navigator: Navigator, theme: Colors.Theme)
|
||||
|
||||
override fun onBindViewHolder(holder: QkViewHolder, position: Int) {
|
||||
val part = data[position]
|
||||
val view = holder.itemView
|
||||
val view = holder.containerView
|
||||
|
||||
val canGroupWithPrevious = canGroup(message, previous) || position > 0
|
||||
val canGroupWithNext = canGroup(message, next) || position < itemCount - 1 || bodyVisible
|
||||
|
||||
Reference in New Issue
Block a user