remove unused code

Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
sowjanyakch 2024-12-19 15:04:49 +01:00 committed by Marcel Hibbe
parent e2dc525bf1
commit 0035e03cd2
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -26,8 +26,6 @@ class OpenConversationsAdapter(
private val onClick: (Conversation) -> Unit
) :
ListAdapter<Conversation, OpenConversationsAdapter.OpenConversationsViewHolder>(ConversationsCallback) {
private var originalList: List<Conversation> = emptyList()
private var isFiltering = false
inner class OpenConversationsViewHolder(val itemBinding: RvItemOpenConversationBinding) :
RecyclerView.ViewHolder(itemBinding.root) {
@ -78,33 +76,6 @@ class OpenConversationsAdapter(
val conversation = getItem(position)
holder.bindItem(conversation)
}
fun filter(text: String) {
if (text == "") {
submitList(originalList)
isFiltering = false
return
}
isFiltering = true
val newList = mutableListOf<Conversation>()
for (conversation in originalList) {
if (conversation.displayName.contains(text, true) || conversation.description!!.contains(text, true)) {
newList.add(conversation)
}
}
if (newList.isNotEmpty()) {
submitList(newList)
}
}
override fun onCurrentListChanged(previousList: MutableList<Conversation>, currentList: MutableList<Conversation>) {
if (!isFiltering) {
originalList = currentList
}
super.onCurrentListChanged(previousList, currentList)
}
}
object ConversationsCallback : DiffUtil.ItemCallback<Conversation>() {