Android Question [ closed ] Can 'GestureDetector' disable View event?

anOparator

Active Member
Licensed User
Longtime User
I have lbl1 added to scv1 '(scv1 = ScrollView)
When I swipe the screen GD sometimes fires "lbl1_Click" event.
I've tried using "lbl1.Enabled = False" and "scv1.Enabled = False".
The swipe works but "lbl1_Click" often fires.
Is it possible to stop this Click event?

B4X:
 Sub Activity_Create(FirstTime As Boolean)
   ...
   ...
   scv1.Initialize(800dip)
   lbl1.Initialize("lbl1")
   scv1.Panel.AddView(lbl1, 2dip, 0, 98%x, 800dip)
   Activity.AddView(scv1, 0, 40dip, 100%x, 100%y)
   ...
   ...
End Sub

B4X:
 Sub Activity_Touch (Action As Int, X As Float, Y As Float)
'   lbl1.Enabled = False
   scv1.Enabled = False
End Sub

B4X:
 Sub Gesture_onTouch(Action As Int, X As Float, Y As Float, MotionEvent As Object) As Boolean
'   lbl1.Enabled = False
   scv1.Enabled = False
   If FilterMoveEvents Then
'       lbl1.Enabled = False
'       scv1.Enabled = False
       If Action = GD.ACTION_MOVE Then
           Return True
       Else
           FilterMoveEvents = False
       End If
   End If
   Return DiscardOtherGestures
End Sub
 

anOparator

Active Member
Licensed User
Longtime User
After I posted the question I made a duplicate project, deleted the Object folder & .meta file, also set "DiscardOtherGestures = Checked".
GestureDetector is producing stable swipes after 2 days testing (and I'm happy).
Will look into the XUI stuff after this app is published, thanks for the sample.
 
Upvote 0
Top