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

Improve: remove unnecessary notifyDataSetChanged for ListAdapter #4255

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 @@ -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
Loading