Enabled Swiping with multiple DragEdges
You should really consider adding the ability to swipe to multiple directions. I.E. - left and right, or left and top for example.
Ok, I think I'll add this feature.
#22 @tasti
I would also really like to see this feature! :)
Hey,
when is this planned? We'd need it quite soon.
@mario Sorry for my late, recently a little busy, I'll add this feature ASAP.
I'm very interested in this feature! you are awesome!
I'm very interested in this feature! you are awesome! thanks
+1! so excited to see it in action
Any updates on this issue?
Hey, great library! Seriously, best one out there by a long way. I really need this feature as well. In particular I need a left and right swipe. Just wanted to see if you were planning on doing it soon? I need it urgently, so I was thinking of doing it myself.
The logic I had in mind was as follows:
- Modify the attribute file to allow selections like this : left|right or left|top
- Get this list in an mDragEdges variable
- To ensure that minimum changes are required, I was thinking that instead of inserting logic for multiple directions in all your switch case statements, I'd still keep the single mDragEdge variable. When the user starts swiping in any direction, I'd check if that direction exists in the mDragEdges list, and I'd set the mDragEdge variable. So the rest of the logic can be as it currently is, as long as the user declares the views they need (bottom, left, etc.).
Does this approach make sense? Do you think it'll work?
@HarshEvilGeek A really brilliant idea on this problem, it should work, but maybe still a lot of coding works.
@HarshEvilGeek You are really awesome! Welcome to send a pull request, I'll test your great work later.
@HarshEvilGeek Welcome to chat here, if you have any new idea or questions. https://gitter.im/daimajia/AndroidSwipeLayout
Hi, sorry, guess my initial comment got deleted:
Hi, for those who are interested, I created a fork and have made the required the changes.
https://github.com/HarshEvilGeek/AndroidSwipeLayout
If you're planning on using it, there are a few logical changes. In the current state, you need to set 2 view groups in your swipe layout, one of them for the background, one for the surface (the library will otherwise throw an IllegalArgumentException)
Now you need to set 1 + number of drag edges you're enabling in your xml file. I'll use those view groups in the order in which you add the drag edges. So if you say:
swipeLaout.setDragEdges(DragEdge.Left, DragEdge.Right)
The first view group will be on the left side, and the second view group will be on the right side. The last view will be the surface view (as is the case now).
Just download the repository and you'll now be able to swipe sample 1 left and right. There might be a few bugs, will work on it.
Thanks @daimajia again for the excellent library. Glad I could contribute. Will test it a bit and make a pull request
@HarshEvilGeek Issue found: the surface view does not follow your finger when moving.
Oh, woops, I guess I didn't commit that change. Already fixed, thanks. Check now.
@HarshEvilGeek Cool, I tested, it works well.
@HarshEvilGeek issue found: It works incorrect in ListView, you can not drag the surface view back.
@HarshEvilGeek I have to say that you are really excellent~ :+1:
Yeah, the directions on gridview and listview seem to be reversed as well (drag edge is left). I'm guessing the default value is set to one, so that's an easy fix. Will look into the listview issue as well. Haha, @daimajia, thanks, that means a lot coming from you.
@HarshEvilGeek One idea. Just using the order to determine the layout is left or right may be not a good idea right now. I think we can retrieve the layout type by id. using findViewById to get the corresponding layout.