Skip to content

Commit 531a145

Browse files
committed
Fixed jumping list.
See 'Implement the diffing callback': https://developer.android.com/topic/libraries/architecture/paging/ui Fixes #4
1 parent 027c1b1 commit 531a145

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

app/src/main/java/com/artshell/misc/rv/official_paging_example/ui/PostsAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ public void setNetworkState(@Nullable NetworkState newNetworkState) {
102102
public static class DiffCallback extends DiffUtil.ItemCallback<RedditPost> {
103103
@Override
104104
public boolean areItemsTheSame(RedditPost oldItem, RedditPost newItem) {
105-
return oldItem == newItem;
105+
return oldItem.name.equals(newItem.name);
106106
}
107107

108108
@Override
109109
public boolean areContentsTheSame(RedditPost oldItem, RedditPost newItem) {
110-
return oldItem.name == newItem.name || oldItem.name.equals(newItem.name);
110+
return oldItem.equals(newItem);
111111
}
112112

113113
@Override

0 commit comments

Comments
 (0)