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
This commit is contained in:
Stypox 2022-09-14 14:01:59 +02:00
parent e6391a860a
commit fbf5549182
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
1 changed files with 3 additions and 2 deletions

View File

@ -80,13 +80,14 @@ public class SuggestionListAdapter
@Override @Override
public boolean areItemsTheSame(@NonNull final SuggestionItem oldItem, public boolean areItemsTheSame(@NonNull final SuggestionItem oldItem,
@NonNull final SuggestionItem newItem) { @NonNull final SuggestionItem newItem) {
return oldItem.query.equals(newItem.query); return oldItem.fromHistory == newItem.fromHistory
&& oldItem.query.equals(newItem.query);
} }
@Override @Override
public boolean areContentsTheSame(@NonNull final SuggestionItem oldItem, public boolean areContentsTheSame(@NonNull final SuggestionItem oldItem,
@NonNull final SuggestionItem newItem) { @NonNull final SuggestionItem newItem) {
return oldItem.equals(newItem); return true; // items' contents never change; the list of items themselves does
} }
} }
} }