mirror of
https://github.com/nextcloud/talk-android
synced 2025-01-31 11:32:00 +00:00
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:
parent
a60fce05cd
commit
ffdae1552d
@ -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
|
||||
|
@ -106,6 +106,7 @@ class FilterConversationFragment(
|
||||
}
|
||||
}
|
||||
currentAdapter.updateDataSet(newItems, true)
|
||||
conversationsList.setFilterableItems(newItems)
|
||||
}
|
||||
conversationsList.updateFilterState(
|
||||
filterState[MENTION]!!,
|
||||
|
Loading…
Reference in New Issue
Block a user