mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-08 07:57:28 +00:00
Use null safe equals. Fixes https://github.com/austinhuang0131/barinsta/issues/789
This commit is contained in:
parent
cc8f14b562
commit
747745c6d5
@ -43,14 +43,15 @@ public final class FeedAdapterV2 extends ListAdapter<Media, RecyclerView.ViewHol
|
||||
private static final DiffUtil.ItemCallback<Media> DIFF_CALLBACK = new DiffUtil.ItemCallback<Media>() {
|
||||
@Override
|
||||
public boolean areItemsTheSame(@NonNull final Media oldItem, @NonNull final Media newItem) {
|
||||
return oldItem.getPk().equals(newItem.getPk());
|
||||
return Objects.equals(oldItem.getPk(), newItem.getPk());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areContentsTheSame(@NonNull final Media oldItem, @NonNull final Media newItem) {
|
||||
final Caption oldItemCaption = oldItem.getCaption();
|
||||
final Caption newItemCaption = newItem.getCaption();
|
||||
return oldItem.getPk().equals(newItem.getPk()) && Objects.equals(getCaptionText(oldItemCaption), getCaptionText(newItemCaption));
|
||||
return Objects.equals(oldItem.getPk(), newItem.getPk())
|
||||
&& Objects.equals(getCaptionText(oldItemCaption), getCaptionText(newItemCaption));
|
||||
}
|
||||
|
||||
private String getCaptionText(final Caption caption) {
|
||||
|
Loading…
Reference in New Issue
Block a user