daimajia / AndroidSwipeLayout

The Most Powerful Swipe Layout!
MIT License
12.38k stars 2.67k forks source link

How to differentiate left swipe and right swipe #186

Closed rex3du closed 9 years ago

rex3du commented 9 years ago

How to differentiate left swipe and right swipe? Currently, I need to trigger different functions when user swipe left and swipe right? Any Suggestions??

Thank you in advance

fritzsche91 commented 9 years ago

I handled it by adding the following code to the onStartOpen(SwipeLayout swipeLayout) method from the added SwipeListener:

SwipeLayout.DragEdge dragEdge = swipeLayout.getDragEdge();

this.isLeftToRightSwipe = SwipeLayout.DragEdge.Left.equals(dragEdge);
if(this.isLeftToRightSwipe) {
    // handle left to right swipe
} else {
    // handle right to left swipe
}
rex3du commented 9 years ago

@fritzsche91 Thank you for solution. It works.