Fixed
Status Update
Comments
sh...@google.com <sh...@google.com>
ap...@google.com <ap...@google.com> #2
I believe that this is following on from
In the linked thread it is suggested that withOnItemActivatedListener
can be used to correctly handle click events on the view. I've had a look through the sample project
For my use-case I would like a reference to the view in the ViewHolder for shared element transitions - setting on onClickListener in the ViewHolder made this easy. I'll have to work around by finding the view holder with the motion event for now.
I think it should be clearer in the version release notes that this behaviour change is present.
sh...@google.com <sh...@google.com> #3
Thanks for the report. The behavior relating to onClick handlers should be consistent from 1.0 to 1.1, so, subject to verification, seems like a bug to me that will need to be addressed as part of the 1.1 release.
ge...@deliveroo.co.uk <ge...@deliveroo.co.uk> #4
Thanks for verifying the first issue.
But your response sounds like you're focusing on that one and consider the second point a non-issue, just because it was already present in 1.0?
Please note that it does not only affect custom OnClickListeners, but also standard widgets like checkboxes. If you click through items (read: click on the items' checkboxes) slowly after activating selection mode, you will only select/unselect further items. If you click faster, selection will skip some items and instead toggle the checkbox. And as I said, even without interactive items, selection just feels utterly sluggish when it skips user clicks. The whole user experience is far, far away from the "good old" list view.
Offtopic: Those new androidx/jetpack libraries don't feel like they're pretty well geared to each other. Combining RecyclerView and SelectionTracker with ItemTouchHelper opens another issue. When using a drag handle within a selectable list item, clicking the handle and starting to move the item slowly will select the item and start selection mode while drag mode is active. It gives weird user experience and requires lots of workarounds to come to a sane "standard" behaviour.
But your response sounds like you're focusing on that one and consider the second point a non-issue, just because it was already present in 1.0?
Please note that it does not only affect custom OnClickListeners, but also standard widgets like checkboxes. If you click through items (read: click on the items' checkboxes) slowly after activating selection mode, you will only select/unselect further items. If you click faster, selection will skip some items and instead toggle the checkbox. And as I said, even without interactive items, selection just feels utterly sluggish when it skips user clicks. The whole user experience is far, far away from the "good old" list view.
Offtopic: Those new androidx/jetpack libraries don't feel like they're pretty well geared to each other. Combining RecyclerView and SelectionTracker with ItemTouchHelper opens another issue. When using a drag handle within a selectable list item, clicking the handle and starting to move the item slowly will select the item and start selection mode while drag mode is active. It gives weird user experience and requires lots of workarounds to come to a sane "standard" behaviour.
Description
Code to reproduce:
The Android ItemTouchHelper class can crash when overriding clearView() in the ItemTouchHelper.Callback because the restore animations are not cancelled when detaching the the touch helper from the RecyclerView. When the restore animation completes, it attempts to invoke clearView() on the callback and calls the method with a null RecyclerView. The RecyclerView parameter is annotated as @NonNull and Kotlin expects a non-nullable value.
This issue was discovered because with new gesture based navigation on Android 10 is it easy to start swiping a list item while attempting to swipe to go back. Our application detaches the touch helper from the RecyclerView whenever a fragment's view is destroyed.
See the Github link for code to reproduce this issue.
Stack trace
------------
java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter recyclerView
at com.victorrendina.touchhelpercrash.SampleItemTouchHelperCallback.clearView(Unknown Source:2)
at androidx.recyclerview.widget.ItemTouchHelper$3.onAnimationEnd(ItemTouchHelper.java:644)
at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:554)
...