Android Question Activity.ACTION_UP event.

pantaraf

Member
Licensed User
Longtime User
Hi,
I'm trying to deal with panel sliding, using the code from SlidingPanels. I've removed the left and right buttons.
B4X:
Sub Panels_Touch (Action As Int, X As Float, Y As Float)
    Select Action
        Case Activity.ACTION_DOWN
            startX = X
            startY = Y
        Case Activity.ACTION_UP
            If Abs(Y - startY) > 20%y Then Return
            If X - startX > 30%x  Then 'AND btnRight.Enabled = True
                ChangePanel(False)
            Else If startX - X > 30%x  Then 'AND btnLeft.Enabled =
                ChangePanel(True)
            End If
    End Select
End Sub
Each panel has a sub that recalls the above one.
B4X:
Sub pnl201L_Touch (Action As Int, X As Float, Y As Float)
   Panels_Touch (Action, X, Y)
End Sub

On a device (eeePad) the ACTION_UP event is hard to fire up. No way how hard or fast I swipe the screen, it just doesn't fire up or it seem to be random, the same gesture fires the event 1 time out of 10. The sliding panels are loaded into a ScrollView and then loaded with different layouts.
I have some questions to understand better how and when the ACTION_UP event rises.
1)Does the ACTION_UP event rise when the finger leaves the screen?
2)If I start the swipe touch on the "listening" panel but I end the gesture on a not "listening" view (i.e. a label), is the ACTION_UP event fired? Or does the label consume (hide) the event?
3)I've looked for docs but I couldn't find it in deep. Am I missing something?
4)looking over the forum I've found the interesting Gesture Detector lib. Is it a better way to deal with sliding views?

Thank you in advance!
Raffaele
 
Top