diff --git a/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt b/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt index cf48826ad..88eea0e7a 100644 --- a/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt @@ -171,6 +171,7 @@ class ConversationsListActivity : private var conversationItems: MutableList> = ArrayList() private var conversationItemsWithHeader: MutableList> = ArrayList() private val searchableConversationItems: MutableList> = ArrayList() + private var filterableConversationItems: MutableList> = ArrayList() private var searchItem: MenuItem? = null private var chooseAccountItem: MenuItem? = null private var searchView: SearchView? = null @@ -420,7 +421,8 @@ class ConversationsListActivity : searchItem!!.setOnActionExpandListener(object : MenuItem.OnActionExpandListener { override fun onMenuItemActionExpand(item: MenuItem): Boolean { adapter!!.setHeadersShown(true) - adapter!!.updateDataSet(searchableConversationItems, false) + if (!filterState.containsValue(true)) filterableConversationItems = searchableConversationItems + adapter!!.updateDataSet(filterableConversationItems, false) adapter!!.showAllHeaders() binding?.swipeRefreshLayoutView?.isEnabled = false return true @@ -428,7 +430,8 @@ class ConversationsListActivity : override fun onMenuItemActionCollapse(item: MenuItem): Boolean { adapter!!.setHeadersShown(false) - adapter!!.updateDataSet(conversationItems, false) + if (!filterState.containsValue(true)) filterableConversationItems = searchableConversationItems + adapter!!.updateDataSet(filterableConversationItems, false) adapter!!.hideAllHeaders() if (searchHelper != null) { // cancel any pending searches @@ -1491,6 +1494,8 @@ class ConversationsListActivity : filterState[UNREAD] = unread } + fun setFilterableItems(items: MutableList>) { filterableConversationItems = items } + companion object { const val TAG = "ConvListController" const val UNREAD_BUBBLE_DELAY = 2500 diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/FilterConversationFragment.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/FilterConversationFragment.kt index 03a7a027d..b758c84e6 100644 --- a/app/src/main/java/com/nextcloud/talk/ui/dialog/FilterConversationFragment.kt +++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/FilterConversationFragment.kt @@ -106,6 +106,7 @@ class FilterConversationFragment( } } currentAdapter.updateDataSet(newItems, true) + conversationsList.setFilterableItems(newItems) } conversationsList.updateFilterState( filterState[MENTION]!!,