8000 [stable-20.0] Fix conversation search functionality and highlighting by backportbot[bot] · Pull Request #4116 · nextcloud/talk-android · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[stable-20.0] Fix conversation search functionality and highlighting #4116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@ class ConversationsListActivity :
conversationsListViewModel.getRoomsFlow
.onEach { list ->
// Update Conversations
conversationItems.clear()
conversationItemsWithHeader.clear()
conversationItems.clear() // fixme remove this
for (conversation in list) {
addToConversationItems(conversation)
}
Expand Down Expand Up @@ -539,6 +540,12 @@ class ConversationsListActivity :
if (searchManager != null) {
searchView!!.setSearchableInfo(searchManager.getSearchableInfo(componentName))
}
initSearchDisposable()
}
}

private fun initSearchDisposable() {
if (searchViewDisposable == null || searchViewDisposable?.isDisposed == true) {
searchViewDisposable = observeSearchView(searchView!!)
.debounce { query: String? ->
if (TextUtils.isEmpty(query)) {
Expand Down Expand Up @@ -619,17 +626,31 @@ class ConversationsListActivity :
showSearchView(searchView, searchItem)
viewThemeUtils.platform.themeStatusBar(this)
}
searchView!!.setOnCloseListener {
searchView!!.findViewById<View>(R.id.search_close_btn).setOnClickListener {
if (TextUtils.isEmpty(searchView!!.query.toString())) {
searchView!!.onActionViewCollapsed()
viewThemeUtils.platform.resetStatusBar(this)
} else {
searchView!!.post { searchView!!.setQuery(TAG, true) }
resetSearchResults()
searchView!!.setQuery("", false)
}
true
}

searchView!!.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextSubmit(p0: String?): Boolean {
initSearchDisposable()
return true
}

override fun onQueryTextChange(p0: String?): Boolean {
this@ConversationsListActivity.onQueryTextChange(p0)
return true
}
})

searchItem!!.setOnActionExpandListener(object : MenuItem.OnActionExpandListener {
override fun onMenuItemActionExpand(item: MenuItem): Boolean {
initSearchDisposable()
adapter!!.setHeadersShown(true)
if (!filterState.containsValue(true)) filterableConversationItems = searchableConversationItems
adapter!!.updateDataSet(filterableConversationItems, false)
Expand Down
Loading
0