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

Drag n Drop not working in 4.6.1 #1195

Merged
merged 3 commits into from
Jun 3, 2021
Merged

Conversation

BillCarsonFr
Copy link
Contributor

Fixes #1187

Drag N Drop support is broken in 4.6.1 (working in 4.5). Due to migration of EpoxyTouchHelperCallback from java to kotlin and missing @nullable annotation in ItemTouchHelper

The following can return null (checked in source code)

public ViewHolder chooseDropTarget(@NonNull ViewHolder selected,
                @NonNull List<ViewHolder> dropTargets, int curX, int curY) 

And code calling this is checking for null

 ViewHolder target = mCallback.chooseDropTarget(viewHolder, swapTargets, x, y);
        if (target == null) {
            mSwapTargets.clear();
            mDistances.clear();
            return;
        }

So i simply made the kotlin code using optionals.

I also added a drag n drop activity in sample app to test it.
I notice also that StickyHeaderActivity was not working due to epoxy_view_stub taking all vertical space

Copy link
Contributor

@elihart elihart left a comment

Choose a reason for hiding this comment

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

Great! Thank you for the fix and the improved samples

@elihart elihart merged commit 71d1198 into airbnb:master Jun 3, 2021
@elihart elihart mentioned this pull request Jun 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NullPointerException when using EpoxyTouchHelper.initDragging
2 participants