Skip to content

Commit

Permalink
Merge pull request #4255 from Obolrom/improve/rm-unnecessary-notify-d…
Browse files Browse the repository at this point in the history
…s-list-adapter

Improve: remove unnecessary notifyDataSetChanged for ListAdapter
  • Loading branch information
VishalNehra authored Oct 8, 2024
2 parents 4612942 + f984a80 commit 0ee6b54
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@

import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
Expand Down Expand Up @@ -132,7 +131,6 @@ public class SearchView {
private SortType sortType = defaultSortType;

@SuppressWarnings("ConstantConditions")
@SuppressLint("NotifyDataSetChanged")
public SearchView(final AppBar appbar, MainActivity mainActivity) {

this.mainActivity = mainActivity;
Expand Down Expand Up @@ -378,7 +376,6 @@ private void updateResultList(List<SearchResult> newResults, String searchTerm)
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();
}
Expand Down Expand Up @@ -614,10 +611,8 @@ private void initSearchViewColor(MainActivity a) {
}
}

@SuppressLint("NotifyDataSetChanged")
private void clearRecyclerView() {
searchRecyclerViewAdapter.submitList(new ArrayList<>());
searchRecyclerViewAdapter.notifyDataSetChanged();
searchRecyclerViewAdapter.submitList(Collections.emptyList());

deepSearchTV.setVisibility(View.GONE);

Expand Down

0 comments on commit 0ee6b54

Please sign in to comment.