1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-26 08:37:29 +00:00
This commit is contained in:
Ammar Githam 2021-03-16 21:57:03 +09:00
parent cc8f14b562
commit 747745c6d5

View File

@ -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>() { private static final DiffUtil.ItemCallback<Media> DIFF_CALLBACK = new DiffUtil.ItemCallback<Media>() {
@Override @Override
public boolean areItemsTheSame(@NonNull final Media oldItem, @NonNull final Media newItem) { 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 @Override
public boolean areContentsTheSame(@NonNull final Media oldItem, @NonNull final Media newItem) { public boolean areContentsTheSame(@NonNull final Media oldItem, @NonNull final Media newItem) {
final Caption oldItemCaption = oldItem.getCaption(); final Caption oldItemCaption = oldItem.getCaption();
final Caption newItemCaption = newItem.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) { private String getCaptionText(final Caption caption) {