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

Enable/Disable swipe in one direction depending on position #6

Closed
sheharyarn opened this issue Dec 30, 2014 · 2 comments
Closed

Enable/Disable swipe in one direction depending on position #6

sheharyarn opened this issue Dec 30, 2014 · 2 comments

Comments

@sheharyarn
Copy link

This is a feature request; To allow swipe in only one direction for Rows (or both depending on the requirements). This would mean replacing hasActions with two methods: swipesLeft and swipesRight:

// Example Implementation

@Override
public boolean swipesLeft(int position) {
    // Swipe Left for only Odd Rows
    return position % 2 == 1;
}

@Override    
public boolean swipesRight(int position) {
    // Swipe Right for only Even Rows
    return position % 2 == 0;
}
@wdullaer
Copy link
Owner

I don't think it is possible to do this properly using hasActions.
hasActions is called when you touch a row, before you are actually swiping. I only know the direction when the swipe starts. If I'd want to implement something like this that leaves me two options:

  1. Visualize the swipe and stop it if hasActions returns false on the current direction, which would give this weird bumping effect
  2. Wait until after hasActions comes back before visualizing the swipe, but that might feel laggy (this is conjecture though, I haven't tried it)

I'm also not convinced that this leads to a good user experience. I've personally always hated apps that allow me to swipe on a list row in one direction but not another.

@sheharyarn sheharyarn changed the title Feature Request: Enable/Disable swipe in one direction depending on position Enable/Disable swipe in one direction depending on position Jan 18, 2015
@sheharyarn
Copy link
Author

Awesome! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants