Improved the code, removed unnecessary parentheses

This commit is contained in:
MohitMali 2023-08-02 16:41:04 +05:30
parent 7e0bf3442d
commit bfdc00a009
2 changed files with 2 additions and 2 deletions

View File

@ -116,7 +116,7 @@ class SearchFragment : BaseFragment() {
val totalItemCount = layoutManager.itemCount
val lastVisibleItem = layoutManager.findLastVisibleItemPosition()
// Check if the user is about to reach the last item
if (!isDataLoading && totalItemCount <= (lastVisibleItem + VISIBLE_ITEMS_THRESHOLD)) {
if (!isDataLoading && totalItemCount <= lastVisibleItem + VISIBLE_ITEMS_THRESHOLD) {
// Load more data when the last item is almost visible
loadMoreSearchResult()
}

View File

@ -33,7 +33,7 @@ data class SearchState(
searchResultsWithTerm.search?.let {
val maximumResults = it.estimatedMatches
val safeEndIndex =
if ((startIndex + 100) < maximumResults) startIndex + 100 else maximumResults
if (startIndex + 100 < maximumResults) startIndex + 100 else maximumResults
val searchIterator =
it.getResults(startIndex, safeEndIndex.toInt())
val searchResults = mutableListOf<SearchListItem.RecentSearchListItem>()