B4A Class Draggable View [Edited - Swipe Gesture]

Discussion in 'Additional libraries, classes and official updates' started by Mike1970, May 20, 2019.

  1. Mike1970

    Mike1970 Active Member Licensed User

    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:
      ...
      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:
      ...
      If x > downx Then 'Write "<" if you want swipe right to left
      ...
      And

      Code:
      ...
      If (panel1.Left+panel1.Width >= Tpoint) Then 'write "(panel1.Left <= Tpoint)" to swipe right to left
      ...
    Like so:
    ezgif.com-optimize(4).gif


    Read
    the notes i wrote in the code!
     

    Attached Files:

    Last edited: May 20, 2019
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice