From 83cdad0572df8eeb8a8648c6fcfbfcdd3af1e69d Mon Sep 17 00:00:00 2001 From: hasibprince Date: Fri, 9 Dec 2022 07:36:51 +0600 Subject: [PATCH] fixed: flickering in search page --- .../apps/applicationlist/ApplicationListRVAdapter.kt | 2 +- .../java/foundation/e/apps/search/SearchFragment.kt | 12 ++++++++---- app/src/main/res/layout/fragment_search.xml | 3 +-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListRVAdapter.kt b/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListRVAdapter.kt index f056b13ac..0c45331ab 100644 --- a/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListRVAdapter.kt +++ b/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListRVAdapter.kt @@ -382,8 +382,8 @@ class ApplicationListRVAdapter( privacyInfoViewModel.getAppPrivacyInfoLiveData(searchApp).observe(lifecycleOwner!!) { showPrivacyScore() val calculatedScore = privacyInfoViewModel.getPrivacyScore(searchApp) + searchApp.privacyScore = calculatedScore if (it.isSuccess() && calculatedScore != -1) { - searchApp.privacyScore = calculatedScore appPrivacyScore.text = view.context.getString( R.string.privacy_rating_out_of, searchApp.privacyScore.toString() diff --git a/app/src/main/java/foundation/e/apps/search/SearchFragment.kt b/app/src/main/java/foundation/e/apps/search/SearchFragment.kt index 176c6ea36..159a517d9 100644 --- a/app/src/main/java/foundation/e/apps/search/SearchFragment.kt +++ b/app/src/main/java/foundation/e/apps/search/SearchFragment.kt @@ -61,6 +61,7 @@ import foundation.e.apps.utils.exceptions.GPlayLoginException import foundation.e.apps.utils.modules.PWAManagerModule import foundation.e.apps.utils.parentFragment.TimeoutFragment import kotlinx.coroutines.launch +import timber.log.Timber import javax.inject.Inject @AndroidEntryPoint @@ -177,6 +178,7 @@ class SearchFragment : currentList ) ) { + binding.loadingProgressBar.isVisible = it.data!!.second return false } @@ -299,13 +301,11 @@ class SearchFragment : override fun showLoadingUI() { binding.shimmerLayout.startShimmer() binding.shimmerLayout.visibility = View.VISIBLE - binding.recyclerView.visibility = View.GONE } override fun stopLoadingUI() { binding.shimmerLayout.stopShimmer() binding.shimmerLayout.visibility = View.GONE - binding.recyclerView.visibility = View.VISIBLE } private fun updateProgressOfInstallingApps(downloadProgress: DownloadProgress) { @@ -372,12 +372,14 @@ class SearchFragment : view?.requestFocus() searchHintLayout?.visibility = View.GONE shimmerLayout?.visibility = View.VISIBLE - recyclerView?.visibility = View.GONE noAppsFoundLayout?.visibility = View.GONE /* * Set the search text and call for network result. */ searchText = text + val applicationListRVAdapter = recyclerView?.adapter as ApplicationListRVAdapter + applicationListRVAdapter.setData(mutableListOf()) +// applicationListRVAdapter.notifyDataSetChanged() repostAuthObjects() } return false @@ -398,7 +400,9 @@ class SearchFragment : override fun onSuggestionClick(position: Int): Boolean { searchViewModel.searchSuggest.value?.let { - searchView?.setQuery(it[position].suggestedQuery, true) + if (it.isNotEmpty()) { + searchView?.setQuery(it[position].suggestedQuery, true) + } } return true } diff --git a/app/src/main/res/layout/fragment_search.xml b/app/src/main/res/layout/fragment_search.xml index 10d4481e0..786b2a930 100644 --- a/app/src/main/res/layout/fragment_search.xml +++ b/app/src/main/res/layout/fragment_search.xml @@ -52,8 +52,7 @@ android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="0dp" - android:layout_weight="1" - android:visibility="gone" /> + android:layout_weight="1" />