From 5516c8c32d7cbd5cfdd904af627146846c21ffaf Mon Sep 17 00:00:00 2001 From: Funny-Pen-7005 Date: Tue, 12 Dec 2023 11:50:37 +0530 Subject: [PATCH] fixes --- .../cloudstream3/ui/search/SearchFragment.kt | 39 +++++++++---------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt index 75759b7a..53863c06 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt @@ -315,31 +315,28 @@ class SearchFragment : Fragment() { arrayAdapter.notifyDataSetChanged() } - val selectedSearchTypesFromDialog = DataStoreHelper.searchPreferenceTags - - context?.filterProviderByPreferredMedia()?.let { validAPIs -> - bindChips( - selectMainpageBinding.tvtypesChipsScroll.tvtypesChips, - selectedSearchTypesFromDialog, - validAPIs.flatMap { api -> api.supportedTypes }.distinct() - ) { list -> - updateList(list) - - // refresh selected chips in main chips - if (selectedSearchTypes.toSet() != list.toSet()) { - selectedSearchTypes.clear() - selectedSearchTypes.addAll(list) - bindChips( - binding?.tvtypesChipsScroll?.tvtypesChips, - selectedSearchTypes, - validAPIs.flatMap { api -> api.supportedTypes }.distinct() - ) { // This already handled in another bindChips. Do nothing here! } - } + bindChips( + selectMainpageBinding.tvtypesChipsScroll.tvtypesChips, + selectedSearchTypes, + validAPIs.flatMap { api -> api.supportedTypes }.distinct() + ) { list -> + updateList(list) + // refresh selected chips in main chips + if (selectedSearchTypes.toSet() != list.toSet()) { + selectedSearchTypes.clear() + selectedSearchTypes.addAll(list) + bindChips( + binding?.tvtypesChipsScroll?.tvtypesChips, + selectedSearchTypes, + validAPIs.flatMap { api -> api.supportedTypes }.distinct() + ) { // This already handled in another bindChips. Do nothing here! } } + } } + cancelBtt?.setOnClickListener { dialog.dismissSafe() } @@ -362,7 +359,7 @@ class SearchFragment : Fragment() { // run search when dialog is close search(binding?.mainSearch?.query?.toString()) } - updateList(selectedSearchTypesFromDialog.toList()) + updateList(selectedSearchTypes.toList()) } } }