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

Drawer swipe [#905] #907

Merged
merged 7 commits into from
Jul 5, 2020
Merged

Drawer swipe [#905] #907

merged 7 commits into from
Jul 5, 2020

Conversation

RobbWatershed
Copy link
Contributor

@RobbWatershed RobbWatershed commented Jul 4, 2020

Implementation for drawer swipe, as described in #905

Usage

  • Very similar to SimpleSwipeCallback
  • Give max drawer width (in dp) to withSwipeLeft and withSwipeRight during construction
  • Corresponding ViewHolder must implement IDrawerSwipeableViewHolder to indicate which View will slide with the swipe gesture. The views below may display clickable buttons
  • Use SimpleSwipeDrawerDragCallback to enable drag + swipe

Important / For your consideration

When the sliding view has been swiped, the buttons located below are visible on screen, however, when tapping on them, the default Android touch even dispatch mechanism doesn't transmit the tap event to the buttons : any click on the exposed surface just swipes the item back to where it came.

To enable the touch events to actually reach the buttons below, I had to implement a small hack that uses OnTouchListener (see SimpleSwipeDrawerCallback.RecyclerTouchTransmitter).

It works well but has a price : any OnTouchListener the user would have previously set on the RecyclerView will be overriden by FastAdapter's own OnTouchListener.

Is that acceptable to you ?


drawerSwipe

@mikepenz
Copy link
Owner

mikepenz commented Jul 5, 2020

Thank you so much for the PR I'll have a look and will try to find a good answer for the touch listener situation :)

@mikepenz mikepenz self-requested a review July 5, 2020 15:42
@mikepenz
Copy link
Owner

mikepenz commented Jul 5, 2020

I have had a look on your implementation and tried a few different things in regards to the on touch listener, but I couldn't find anything alternative for now. I suppose it is fine as it is a very special usecase, and if a user needs something even more complex than the simple prepared functionalities may not be enough regardless :)

Sadly it seems we can't really animate the collapsing of the item. which would make it's UX even more amazing.

Thank you so much for your PR and work :)

@mikepenz mikepenz merged commit c6b7ec9 into mikepenz:develop Jul 5, 2020
@mikepenz
Copy link
Owner

mikepenz commented Jul 5, 2020

Thanks for your contributions. They are added and released in v5.2.0 :)

Also I have added a mention to you in the README as a thanks to your contributions

@RobbWatershed
Copy link
Contributor Author

Awesome 😁 Thank you for your trust and enthusiastic responsiveness Mike !

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.

2 participants