Diolor / Swipecards

A Tinder-like Android library to create the swipe cards effect. You can swipe left or right to like or dislike the content.
Apache License 2.0
2.34k stars 583 forks source link

Disable card vertical movement? #123

Closed joaodias closed 9 years ago

joaodias commented 9 years ago

Hi guys ! Is it possible somehow to disable the card's vertical movement? I mean, when you drag the card, it only allows it to move either right or left. No up or down movement at all and no angle rotation on the card (last one I know is possible with app:rotation_degrees="0").

alexwalterbos commented 9 years ago

You can include the library source in your project and disable these lines:

https://github.com/Diolor/Swipecards/blob/master/library/src/main/java/com/lorentzos/flingswipe/FlingCardListener.java#L142 https://github.com/Diolor/Swipecards/blob/master/library/src/main/java/com/lorentzos/flingswipe/FlingCardListener.java#L147 https://github.com/Diolor/Swipecards/blob/master/library/src/main/java/com/lorentzos/flingswipe/FlingCardListener.java#L152 https://github.com/Diolor/Swipecards/blob/master/library/src/main/java/com/lorentzos/flingswipe/FlingCardListener.java#L163

I have not tested this, but that should work since those statements calculate and apply the offset in the y direction.

joaodias commented 9 years ago

Thanks! It worked :+1: