Skip to content

Commit

Permalink
Merge pull request #4230 from hammadrfq3/SearchView_updateResultList_…
Browse files Browse the repository at this point in the history
…exception

SearchView updatResultList issue fixed
  • Loading branch information
VishalNehra authored Aug 20, 2024
2 parents 82275fe + de0a8a3 commit 53adcbb
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;

import androidx.appcompat.widget.AppCompatButton;
import androidx.appcompat.widget.AppCompatEditText;
Expand Down Expand Up @@ -372,11 +373,15 @@ private void resetSearchMode() {
* @param searchTerm The search term that resulted in the search results
*/
private void updateResultList(List<SearchResult> newResults, String searchTerm) {
ArrayList<SearchResult> items = new ArrayList<>(newResults);
Collections.sort(
items, new SearchResultListSorter(DirSortBy.NONE_ON_TOP, sortType, searchTerm));
searchRecyclerViewAdapter.submitList(items);
searchRecyclerViewAdapter.notifyDataSetChanged();
if (newResults != null) {
ArrayList<SearchResult> items = new ArrayList<>(newResults);
Collections.sort(
items, new SearchResultListSorter(DirSortBy.NONE_ON_TOP, sortType, searchTerm));
searchRecyclerViewAdapter.submitList(items);
searchRecyclerViewAdapter.notifyDataSetChanged();
} else {
Toast.makeText(mainActivity, "No search result found", Toast.LENGTH_SHORT).show();
}
}

/** show search view with a circular reveal animation */
Expand Down

0 comments on commit 53adcbb

Please sign in to comment.