mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01:00
remove unused code
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
e2dc525bf1
commit
0035e03cd2
@ -26,8 +26,6 @@ class OpenConversationsAdapter(
|
|||||||
private val onClick: (Conversation) -> Unit
|
private val onClick: (Conversation) -> Unit
|
||||||
) :
|
) :
|
||||||
ListAdapter<Conversation, OpenConversationsAdapter.OpenConversationsViewHolder>(ConversationsCallback) {
|
ListAdapter<Conversation, OpenConversationsAdapter.OpenConversationsViewHolder>(ConversationsCallback) {
|
||||||
private var originalList: List<Conversation> = emptyList()
|
|
||||||
private var isFiltering = false
|
|
||||||
|
|
||||||
inner class OpenConversationsViewHolder(val itemBinding: RvItemOpenConversationBinding) :
|
inner class OpenConversationsViewHolder(val itemBinding: RvItemOpenConversationBinding) :
|
||||||
RecyclerView.ViewHolder(itemBinding.root) {
|
RecyclerView.ViewHolder(itemBinding.root) {
|
||||||
@ -78,33 +76,6 @@ class OpenConversationsAdapter(
|
|||||||
val conversation = getItem(position)
|
val conversation = getItem(position)
|
||||||
holder.bindItem(conversation)
|
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>() {
|
object ConversationsCallback : DiffUtil.ItemCallback<Conversation>() {
|
||||||
|
Loading…
Reference in New Issue
Block a user