Skip to content

Commit fbf5549

Browse files
committed
Fix wrong icons being set on suggestion items
The diff util wrongly considered as equal two items with the same text but with different `fromHistory` value
1 parent e6391a8 commit fbf5549

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

app/src/main/java/org/schabi/newpipe/fragments/list/search/SuggestionListAdapter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,14 @@ private static class SuggestionItemCallback extends DiffUtil.ItemCallback<Sugges
8080
@Override
8181
public boolean areItemsTheSame(@NonNull final SuggestionItem oldItem,
8282
@NonNull final SuggestionItem newItem) {
83-
return oldItem.query.equals(newItem.query);
83+
return oldItem.fromHistory == newItem.fromHistory
84+
&& oldItem.query.equals(newItem.query);
8485
}
8586

8687
@Override
8788
public boolean areContentsTheSame(@NonNull final SuggestionItem oldItem,
8889
@NonNull final SuggestionItem newItem) {
89-
return oldItem.equals(newItem);
90+
return true; // items' contents never change; the list of items themselves does
9091
}
9192
}
9293
}

0 commit comments

Comments
 (0)