Sub Class_Globals
Private Root As B4XView 'ignore
Private xui As XUI 'ignore
Private StartX As Float
Private IsSwiping As Boolean
Private Threshold As Int = 100dip
End Sub
Public Sub Initialize As Object
Return Me
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.Color=Colors.Blue
End Sub
Private Sub Root_Touch (Action As Int, X As Float, Y As Float)
Select Action
Case Root.TOUCH_ACTION_DOWN
StartX = X
IsSwiping = True
Case Root.TOUCH_ACTION_MOVE
If IsSwiping Then
Dim dx As Float = X - StartX
If dx > 0 Then
Root.Left = dx
End If
End If
Case Root.TOUCH_ACTION_UP
If IsSwiping Then
Dim dx As Float = X - StartX
If dx > Threshold Then
B4XPages.ClosePage(Me)
Else
Root.Left = 0
End If
IsSwiping = False
End If
End Select
End Sub