-
Notifications
You must be signed in to change notification settings - Fork 511
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 #171: Introduce support for diffing subsets of data in generic RecyclerView adapter #1359
Fix #171: Introduce support for diffing subsets of data in generic RecyclerView adapter #1359
Conversation
app/src/main/java/org/oppia/app/recyclerview/RecyclerDataDiffCallback.kt
Outdated
Show resolved
Hide resolved
Aha, this is very interesting. :) I want to take a closer look at this, but I probably won't be able to until early next week. In the meantime, @anandwana001 could you add tests for the diffing logic? I think we should try to encapsulate what the desired API of the adapter is via tests, even if we choose a different implementation. |
Sure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @anandwana001! This looks really good. Left a few comments, otherwise waiting for tests.
app/src/main/java/org/oppia/app/recyclerview/RecyclerDataDiffCallback.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/oppia/app/recyclerview/RecyclerDataDiffCallback.kt
Show resolved
Hide resolved
app/src/main/java/org/oppia/app/recyclerview/BindableAdapter.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/oppia/app/recyclerview/BindableAdapter.kt
Outdated
Show resolved
Hide resolved
Could you give some hints, like what all cases we can cover with test? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @anandwana001! Left some more comments, mostly regarding the new tests.
app/src/main/java/org/oppia/app/recyclerview/BindableAdapter.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/oppia/app/recyclerview/RecyclerDataDiffCallback.kt
Show resolved
Hide resolved
app/src/sharedTest/java/org/oppia/app/recyclerview/BindableAdapterTest.kt
Outdated
Show resolved
Hide resolved
… introduce-diffing-generic-recyclerview
… introduce-diffing-generic-recyclerview # Conflicts: # app/src/sharedTest/java/org/oppia/app/recyclerview/BindableAdapterTest.kt
… introduce-diffing-generic-recyclerview
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @anandwana001 --I took another pass on this.
app/src/main/java/org/oppia/app/recyclerview/BindableAdapter.kt
Outdated
Show resolved
Hide resolved
app/src/sharedTest/java/org/oppia/app/recyclerview/BindableAdapterTest.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/oppia/app/recyclerview/BindableAdapter.kt
Outdated
Show resolved
Hide resolved
app/src/sharedTest/java/org/oppia/app/recyclerview/BindableAdapterTest.kt
Outdated
Show resolved
Hide resolved
app/src/sharedTest/java/org/oppia/app/recyclerview/BindableAdapterTest.kt
Outdated
Show resolved
Hide resolved
@BenHenning @rt4914 Added one test where I am checking if reminding is happening or not if in future we move to their implementation this test will fail as DiffUtil support no binding of the same data. |
@anandwana001 Actually I will defer with Ben on the test case approach because I am not confident about the correct approach in this case. |
Apologies for the delay, but I will need to take a pass on this PR tomorrow. I ran out of time to do so today. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @anandwana001! The test seems like a great start. I left some comments to help generalize it to multiple behaviors.
app/src/sharedTest/java/org/oppia/app/recyclerview/BindableAdapterTest.kt
Outdated
Show resolved
Hide resolved
app/src/sharedTest/java/org/oppia/app/recyclerview/BindableAdapterTest.kt
Show resolved
Hide resolved
app/src/sharedTest/java/org/oppia/app/recyclerview/BindableAdapterTest.kt
Outdated
Show resolved
Hide resolved
app/src/sharedTest/java/org/oppia/app/recyclerview/BindableAdapterTest.kt
Outdated
Show resolved
Hide resolved
app/src/sharedTest/java/org/oppia/app/recyclerview/BindableAdapterTest.kt
Outdated
Show resolved
Hide resolved
… introduce-diffing-generic-recyclerview
… introduce-diffing-generic-recyclerview
… introduce-diffing-generic-recyclerview
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @anandwana001! This looks good to me. Please address my last comment—either @rt4914 or I can verify it’s correct.
app/src/sharedTest/java/org/oppia/app/recyclerview/BindableAdapterTest.kt
Outdated
Show resolved
Hide resolved
… introduce-diffing-generic-recyclerview
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
… introduce-diffing-generic-recyclerview
This PR also solves #508 |
@anandwana001 did you verify that the exploration player & all interactions still work? It seems this caused some regressions: #1625 and #1626. |
Explanation
Fix #171
Introduced a diffing logic using
DiffUtil
.Added test cases which passed with
diffutil
implementation.How to test
Check all possible screens where RecyclerView is used.
Checklist