May 20, 2019 Hi everyone, this class is an edit of this class from Erel: https://www.b4x.com/android/forum/threads/classes-are-soon-coming.18395/ I've done some changes to achieve an animated "Swipe gesture (left to right)" If you swipe all the way right to the trigger point, you can trigger an event, definable in the class. (I will modify it soon) Code: Copy ... If (panel1.Left+panel1.Width >= Tpoint) Then CallSub(Main, "Swipe_Output") '********************************* CHANGE THIS CALL TO CALL YOUR SUB innerView.SetLayoutAnimated(150,LeftPoint,innerView.Top,innerView.Width,innerView.Height) ... If you release before reaching the trigger point the view automatically goes back to the original spot. You can set the triggerPoint You can't swipe right to left (but if you want, you can apply some changes) Code: Copy ... If x > downx Then 'Write "<" if you want swipe right to left ... And Code: Copy ... If (panel1.Left+panel1.Width >= Tpoint) Then 'write "(panel1.Left <= Tpoint)" to swipe right to left ... Like so: Read the notes i wrote in the code! Attachments DraggableView (Swipe Gesture).zip DraggableView (Swipe Gesture).zip 11 KB · Views: 749 Last edited: May 20, 2019 Click to expand...
Hi everyone, this class is an edit of this class from Erel: https://www.b4x.com/android/forum/threads/classes-are-soon-coming.18395/ I've done some changes to achieve an animated "Swipe gesture (left to right)" If you swipe all the way right to the trigger point, you can trigger an event, definable in the class. (I will modify it soon) Code: Copy ... If (panel1.Left+panel1.Width >= Tpoint) Then CallSub(Main, "Swipe_Output") '********************************* CHANGE THIS CALL TO CALL YOUR SUB innerView.SetLayoutAnimated(150,LeftPoint,innerView.Top,innerView.Width,innerView.Height) ... If you release before reaching the trigger point the view automatically goes back to the original spot. You can set the triggerPoint You can't swipe right to left (but if you want, you can apply some changes) Code: Copy ... If x > downx Then 'Write "<" if you want swipe right to left ... And Code: Copy ... If (panel1.Left+panel1.Width >= Tpoint) Then 'write "(panel1.Left <= Tpoint)" to swipe right to left ... Like so: Read the notes i wrote in the code!