-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 crash and improve MvxRecyclerViewAdapter and MvxRecyclerViewHolder #3366
Conversation
MvvmCross.Android.Support/V7.RecyclerView/MvxRecyclerAdapter.cs
Outdated
Show resolved
Hide resolved
@softlion can you address the comments? |
This comment was marked as abuse.
This comment was marked as abuse.
MvvmCross.Android.Support/V7.RecyclerView/MvxRecyclerAdapter.cs
Outdated
Show resolved
Hide resolved
MvvmCross.Android.Support/V7.RecyclerView/MvxRecyclerAdapter.cs
Outdated
Show resolved
Hide resolved
MvvmCross.Android.Support/V7.RecyclerView/MvxRecyclerAdapter.cs
Outdated
Show resolved
Hide resolved
MvvmCross.Android.Support/V7.RecyclerView/MvxRecyclerAdapter.cs
Outdated
Show resolved
Hide resolved
MvvmCross.Android.Support/V7.RecyclerView/MvxRecyclerAdapter.cs
Outdated
Show resolved
Hide resolved
@softlion we use rebase instead of merge to get changes from develop into the branch you make changes in. I did one on your branch, but that means that you have to delete your local branch and check it out again because the history is overwritten. If you want i can do it again to get rid of the merge commit. Or you commit your changes to my comments first, and then i do a rebase. |
This comment was marked as abuse.
This comment was marked as abuse.
I've rebased it for you. Can you please check the File Changed tab and verify that those are the correct changes? @softlion |
This comment was marked as abuse.
This comment was marked as abuse.
@softlion actually I do have access to it. As soon as you make a Pull Request, I have access to push to that branch. Unless you remove the check mark in the checkbox on the PR, which allows/disallows others to push to it. |
This looks good to me. Also tested it on a sample app I made, which tested both, ItemClick, ItemLongClick, adding, removing items, adding items in bulk. Everything seems OK. |
If I had my ViewHolder like this:
How should I be with the current changes? Because it gives me this error:
|
You may be running into the issue described in #3411. Check there for a solution. |
This did introduce a breaking change by adding events to the IMvxRecyclerViewHolder. Maybe some documentation should be added. |
This change removes public and protected items from the MvxRecyclerViewHolder, which does in fact make it breaking imo. Sure, none of them were in the documentation, but if they're accessible you can expect they will be used. To be more specific, what this breaks in my app is some of my custom ViewHolders/Adapters. That is a usage not covered at all in the documentation but I don't consider it a strange thing to do. The MvxRecyclerView can cover a lot of use cases with axml and TemplateSelectors only, but not all of them :) Edit: I'm only noticing this now because the issue it caused was a very subtle one, but: what is the purpose of moving the call to ItemTemplateSelector.GetItemLayoutId to GetItemViewType? Because I'm only seeing downsides:
All of this makes me feel like I'm not supposed to subclass the MvxRecyclerAdapter. Is that your official view on these classes, that they are to be used as-is only? I don't really want to have to choose between having the Mvx features and being able to add my own features. |
This comment was marked as abuse.
This comment was marked as abuse.
@softlion Ah, I didn't know that! That's interesting, that makes it make more sense. It's a bit unfortunate that it doesn't match with the TemplateSelector's viewtype anymore but changing that would break stuff for a lot more people, I get that you don't want to do that. Thank you for replying! |
✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)
Bug fix + refactor of MvxRecyclerViewAdapter and MvxRecyclerViewHolder
🆕 What is the new behavior (if this is a feature change)?
Fixes the above crash and inconsistencies
Allows extensibility through new virtual methods:
Also improved cleaning up of resources when Dispose is called from the Java side
💥 Does this PR introduce a breaking change?
No
🐛 Recommendations for testing
📝 Links to relevant issues/docs
Fixes #3295
🤔 Checklist before submitting