Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object item IDs #50

Open
BenTilbrook opened this issue May 1, 2017 · 0 comments
Open

Object item IDs #50

BenTilbrook opened this issue May 1, 2017 · 0 comments

Comments

@BenTilbrook
Copy link
Collaborator

Item IDs have a problem, which is ensuring composed adapters with stable item IDs form a composite adapter whose ID ranges don't accidentally overlap. If they overlapped it'd result in strange behavior in RecyclerView, which would be difficult to debug. We also don't want users to have to worry about stable IDs outside of overriding getItemId().

Consider this related problem: what if your model IDs are strings? Many systems use UUIDs.

My thoughts right now are to change PowerAdapter.getItemId() to return an Object instead. Since an Object is unique in the system, any headers/footers would automatically have a stable ID. The challenge is how to map the objects into a range of longs in a way that isn't prone to memory leaks, and has decent performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant