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