WIP filter conversations feature, can now search through filter

Signed-off-by: Julius Linus julius.linus@nextcloud.com

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
rapterjet2004 2023-06-14 11:35:51 -05:00 committed by Andy Scherzinger
parent a60fce05cd
commit ffdae1552d
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
2 changed files with 8 additions and 2 deletions

View File

@ -171,6 +171,7 @@ class ConversationsListActivity :
private var conversationItems: MutableList<AbstractFlexibleItem<*>> = ArrayList()
private var conversationItemsWithHeader: MutableList<AbstractFlexibleItem<*>> = ArrayList()
private val searchableConversationItems: MutableList<AbstractFlexibleItem<*>> = ArrayList()
private var filterableConversationItems: MutableList<AbstractFlexibleItem<*>> = 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<AbstractFlexibleItem<*>>) { filterableConversationItems = items }
companion object {
const val TAG = "ConvListController"
const val UNREAD_BUBBLE_DELAY = 2500

View File

@ -106,6 +106,7 @@ class FilterConversationFragment(
}
}
currentAdapter.updateDataSet(newItems, true)
conversationsList.setFilterableItems(newItems)
}
conversationsList.updateFilterState(
filterState[MENTION]!!,