fix: search only if selection changed (#868)

This commit is contained in:
coxju 2024-01-11 20:24:28 +05:30 committed by GitHub
parent 8c5ab86714
commit 0eb152c5db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -264,6 +264,9 @@ class SearchFragment : Fragment() {
builder.setContentView(selectMainpageBinding.root) builder.setContentView(selectMainpageBinding.root)
builder.show() builder.show()
builder.let { dialog -> builder.let { dialog ->
val previousSelectedApis = selectedApis.toSet()
val previousSelectedSearchTypes = selectedSearchTypes.toSet()
val isMultiLang = ctx.getApiProviderLangSettings().let { set -> val isMultiLang = ctx.getApiProviderLangSettings().let { set ->
set.size > 1 || set.contains(AllLanguagesName) set.size > 1 || set.contains(AllLanguagesName)
} }
@ -352,8 +355,10 @@ class SearchFragment : Fragment() {
selectedApis = currentSelectedApis selectedApis = currentSelectedApis
// run search when dialog is close // run search when dialog is close
if(previousSelectedApis != selectedApis.toSet() || previousSelectedSearchTypes != selectedSearchTypes.toSet()) {
search(binding?.mainSearch?.query?.toString()) search(binding?.mainSearch?.query?.toString())
} }
}
updateList(selectedSearchTypes.toList()) updateList(selectedSearchTypes.toList())
} }
} }