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

Fix for MvxRecyclerAdapter indexes #1794

Merged
merged 1 commit into from May 12, 2017
Merged

Fix for MvxRecyclerAdapter indexes #1794

merged 1 commit into from May 12, 2017

Conversation

fela98
Copy link
Contributor

@fela98 fela98 commented May 11, 2017

Small fix for mistake made in #1786

@fela98 fela98 changed the title Fixed mistake with Count. Fix for MvxRecyclerAdapter indexes May 11, 2017
Copy link
Contributor

@kjeremy kjeremy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this change.

However are you absolutely certain that the starting location needs to go through GetViewPosition? It looks like incorrect behavior if the starting value can be modified but not the count, especially because we are talking about changes in the adapter positions and not visual positions.

@fela98
Copy link
Contributor Author

fela98 commented May 12, 2017

Yes I am 100% certain that the starting location needs to go through GetViewPosition.

I do not fully understand what you mean by adapter positions and visual positions when you write.

It looks like incorrect behavior if the starting value can be modified but not the count, especially because we are talking about changes in the adapter positions and not visual positions.

What i know, is that even though it might not be the "visual position" in the adapter, that is what it results in. The views get affected by it, and it gets displayed to the user.

The reason the starting value has to be modified is to be able to offset the whole ItemsSource by a number. So even though there are only 3 items in the ItemsSource a header can been added resulting in an ItemCount of 4. Additionally now the item at index 0 in the ItemsSource is now at index 1 in the adapter, and when the item in the ItemSource at index 0 is removed, we have to remove the item in the adapter that is at index 1. The count of the changed items however doesn't need to be modified because it's not a change in how many items changed in the ItemsSource but only their position (they're offset, moved one or more step down).

@martijn00 martijn00 merged commit a94201f into MvvmCross:develop May 12, 2017
@martijn00 martijn00 added this to the 5.0.0 milestone May 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants