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

Commit f0844d61 authored by Hasib Prince's avatar Hasib Prince
Browse files

fixed: search with same keyword

parent f389c8eb
Loading
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -119,9 +119,13 @@ class SearchFragment :
        authObjects.observe(viewLifecycleOwner) {
            val currentQuery = searchView?.query?.toString() ?: ""
            if (it == null || shouldIgnore(it, currentQuery)) {
                showData()
                return@observe
            }

            val applicationListRVAdapter = recyclerView?.adapter as ApplicationListRVAdapter
            applicationListRVAdapter.setData(mutableListOf())

            loadDataWhenNetworkAvailable(it)
        }

@@ -187,11 +191,15 @@ class SearchFragment :
            return false
        }

        showData()
        listAdapter?.setData(appList!!)
        return true
    }

    private fun showData() {
        stopLoadingUI()
        noAppsFoundLayout?.visibility = View.GONE
        searchHintLayout?.visibility = View.GONE
        listAdapter?.setData(appList!!)
        return true
    }

    private fun setupSearchResult(view: View): ApplicationListRVAdapter? {
@@ -373,6 +381,7 @@ class SearchFragment :
            if (text.isNotEmpty()) {
                hideKeyboard(activity as Activity)
            }

            view?.requestFocus()
            searchHintLayout?.visibility = View.GONE
            shimmerLayout?.visibility = View.VISIBLE
@@ -381,8 +390,6 @@ class SearchFragment :
             * Set the search text and call for network result.
             */
            searchText = text
            val applicationListRVAdapter = recyclerView?.adapter as ApplicationListRVAdapter
            applicationListRVAdapter.setData(mutableListOf())
            repostAuthObjects()
        }
        return false
+4 −0
Original line number Diff line number Diff line
@@ -130,4 +130,8 @@ class SearchViewModel @Inject constructor(
    fun isAuthObjectListSame(authObjectList: List<AuthObject>?): Boolean {
        return lastAuthObjects == authObjectList
    }

    fun isSearchResultAvailable(): Boolean {
        return searchResult.value?.data?.first?.isNotEmpty() == true
    }
}