Allow searching for multiple extensions at once (closes #5922)
This commit is contained in:
parent
b8d8cf19d9
commit
ea34ba53b9
@ -144,7 +144,7 @@ open class ExtensionController :
|
|||||||
.filter { router.backstack.lastOrNull()?.controller == this }
|
.filter { router.backstack.lastOrNull()?.controller == this }
|
||||||
.onEach {
|
.onEach {
|
||||||
query = it.toString()
|
query = it.toString()
|
||||||
drawExtensions()
|
updateExtensionsList()
|
||||||
}
|
}
|
||||||
.launchIn(viewScope)
|
.launchIn(viewScope)
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ open class ExtensionController :
|
|||||||
fun setExtensions(extensions: List<ExtensionItem>) {
|
fun setExtensions(extensions: List<ExtensionItem>) {
|
||||||
binding.swipeRefresh.isRefreshing = false
|
binding.swipeRefresh.isRefreshing = false
|
||||||
this.extensions = extensions
|
this.extensions = extensions
|
||||||
drawExtensions()
|
updateExtensionsList()
|
||||||
|
|
||||||
// Update badge on parent controller tab
|
// Update badge on parent controller tab
|
||||||
val ctrl = parentController as BrowseController
|
val ctrl = parentController as BrowseController
|
||||||
@ -187,11 +187,14 @@ open class ExtensionController :
|
|||||||
ctrl.extensionListUpdateRelay.call(true)
|
ctrl.extensionListUpdateRelay.call(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun drawExtensions() {
|
private fun updateExtensionsList() {
|
||||||
if (query.isNotBlank()) {
|
if (query.isNotBlank()) {
|
||||||
|
val extensionNames = query.split(",")
|
||||||
adapter?.updateDataSet(
|
adapter?.updateDataSet(
|
||||||
extensions.filter {
|
extensions.filter {
|
||||||
it.extension.name.contains(query, ignoreCase = true)
|
extensionNames.any { queriedName ->
|
||||||
|
it.extension.name.contains(queriedName, ignoreCase = true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user