mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-16 19:18:52 +01:00
Fix conversation swipe actions
This commit is contained in:
+9
@@ -45,6 +45,11 @@ class ConversationsAdapter @Inject constructor(
|
||||
private val phoneNumberUtils: PhoneNumberUtils
|
||||
) : QkRealmAdapter<Conversation>() {
|
||||
|
||||
init {
|
||||
// This is how we access the threadId for the swipe actions
|
||||
setHasStableIds(true)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder {
|
||||
val layoutInflater = LayoutInflater.from(parent.context)
|
||||
val view = layoutInflater.inflate(R.layout.conversation_list_item, parent, false)
|
||||
@@ -109,6 +114,10 @@ class ConversationsAdapter @Inject constructor(
|
||||
holder.unread.setTint(colors.theme(recipient).theme)
|
||||
}
|
||||
|
||||
override fun getItemId(position: Int): Long {
|
||||
return getItem(position)?.id ?: -1
|
||||
}
|
||||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
return if (getItem(position)?.unread == false) 0 else 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user