material-components-android
material-components-android copied to clipboard
[SwipeDismissBehavior]fix SwipeDissmissBehavior not work when down touch event consumed by …
Fix #1333 This bug is caused by two reasons
- Recieving a ACTION_CANCEL event from the CoordinatorLayout when the SwipeDismissBehavior calls requestDisallowInterceptTouchEvent in onViewCaptured.
- ACTION_DOWN consumed by other view, causing the Behavior not to call back onTouchEvent
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
I approved cuz' I didn't see the error mentioned in the issue with this change. But when I took another look, I cannot repro the error messages with the current snapshot. It seems it got fixed at some point (the issue has a bit history now). Could you confirm? If so, I'll close this PR and the issue.
I approved cuz' I didn't see the error mentioned in the issue with this change. But when I took another look, I cannot repro the error messages with the current snapshot. It seems it got fixed at some point (the issue has a bit history now). Could you confirm? If so, I'll close this PR and the issue.
@pekingme Hello, I tested and it still exists. You can use CardSwipeDismissFragment
to test it.
set OnClickListener
to cardContentLayout
. The ACTION_DOWN
consumed by cardContentLayout
cardContentLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
The last master code.
https://user-images.githubusercontent.com/16848272/192931246-1ab78794-032f-4611-8c8f-b88b8b491acf.mp4
After set onClickListener.
https://user-images.githubusercontent.com/16848272/192931539-263317a9-0515-4ff6-afd0-7bedf1b6a651.mp4
After fixed.
https://user-images.githubusercontent.com/16848272/192931656-2b074c1f-7bb5-4e17-942e-bb3744f9e4e5.mp4
Thanks for the recording! Yes, I can reproduce the same behavior with the catalog built externally. Was testing with the catalog built internally. It seems the fix works well with androidx.coordinatorlayout:coordinatorlayout:1.1.0
. But we use a more recent version. If you update androidx.coordinatorlayout:coordinatorlayout
to 1.2.0
, the fix won't work anymore.
I don't see any regression with this fix internally. Let me test this out a bit more. Meanwhile I'm looking for a fix that works with the 1.2.0
and above now. Let me know if you find anything. TIA
Ok, I have updated the fix (internally) to make it works for both 1.1.0 and later version. Should be merged soon.
@pekingme ok~