Skip to content

Conversation

@c-b-h
Copy link

@c-b-h c-b-h commented Apr 29, 2021

onDistinctItems is called when the adapter receives new (distinct from
previous) items. This allows for changing the notification behavior
in a backward-compatible way e.g. from notifyDataSetChanged() to notifyItemRangeInserted()`.

Our app uses a custom ItemAnimator for insertions and with this change, we're able to call notifyItemRangeInserted when the adapter initially receives items and there by trigger an insert animation as can be observed in this clip:

notify_insert.mov

The current behavior is that notifyDataSetChanged() is called which for the first item will not trigger an insert animation. See clip for difference and notice the first item:

changed.mov

`onDistinctItems` is called when the adapter receives new (distinct from
 previous) `items`. This allows for changing the notification behavior
 in a backward-compatible way e.g. from `notifyDataSetChanged() to
 `notifyItemRangeInserted()`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant