Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SearchView updatResultList issue fixed #4230

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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