Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 77b52a1c authored by Sayantan Roychowdhury's avatar Sayantan Roychowdhury
Browse files

Merge branch '7927-search_scroll_fix' into 'main'

Issue 7927: search scroll fix

See merge request !436
parents 08a9916d 58eb9796
Loading
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -132,7 +132,6 @@ class SearchFragment :
        authObjects.observe(viewLifecycleOwner) {
            val currentQuery = searchView?.query?.toString() ?: ""
            if (it == null || shouldIgnore(it, currentQuery)) {
                showData()
                return@observe
            }

@@ -176,6 +175,8 @@ class SearchFragment :
        searchViewModel.searchResult.observe(viewLifecycleOwner) {
            if (it.data?.first.isNullOrEmpty() && it.data?.second == false) {
                noAppsFoundLayout?.visibility = View.VISIBLE
            } else if (searchViewModel.shouldIgnoreResults()) {
                return@observe
            } else {
                listAdapter?.let { adapter ->
                    observeDownloadList(adapter)
@@ -367,13 +368,13 @@ class SearchFragment :
    }

    override fun showLoadingUI() {
        binding.shimmerLayout.startShimmer()
        binding.shimmerLayout.visibility = View.VISIBLE
        shimmerLayout?.visibility = View.VISIBLE
        shimmerLayout?.startShimmer()
    }

    override fun stopLoadingUI() {
        binding.shimmerLayout.stopShimmer()
        binding.shimmerLayout.visibility = View.GONE
        shimmerLayout?.stopShimmer()
        shimmerLayout?.visibility = View.GONE
    }

    private fun updateProgressOfInstallingApps(downloadProgress: DownloadProgress) {
@@ -440,8 +441,6 @@ class SearchFragment :

            view?.requestFocus()
            searchHintLayout?.visibility = View.GONE
            shimmerLayout?.visibility = View.VISIBLE
            noAppsFoundLayout?.visibility = View.GONE
            /*
             * Set the search text and call for network result.
             */
+9 −0
Original line number Diff line number Diff line
@@ -319,4 +319,13 @@ class SearchViewModel @Inject constructor(
            loadMore(searchText, autoTriggered = true)
        }
    }

    fun shouldIgnoreResults(): Boolean {
        val appsList = _searchResult.value?.data?.first

        if (appsList.isNullOrEmpty()) return true

        val appPackageNames = appsList.map { it.package_name }
        return appPackageNames.all { it.isBlank() }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@

    <include
        android:id="@+id/noAppsFoundLayout"
        android:visibility="invisible"
        android:visibility="gone"
        tools:visibility="gone"
        layout="@layout/layout_no_apps_found" />