B4A Library [Lib] Gesture Detector

TelKel81

Active Member
Licensed User
How should I transition from a LongPress to "immediately being able to drag" right after the long press ?
The goal is to drag a view towards a new parent after a long press.
 
Last edited:

tufanv

Expert
Licensed User
Longtime User
I have a little problem here. I bind the gesture detector to scrollview. My scrollview has panels like a listview and each have a click eventwhich navigates to another page. I can get swipe msgbox When I swipe scrollview where there is no panel but if there are panels at the area where I swipe, I dont get messages and everytime panel inside the scrollview click event triggers. How can I solve this?
 

frutuopa

Member
Licensed User
Longtime User
Hello ... I've been trying this library and it looks really fantastic .....
I wanted to take advantage of it to create dynamic buttons and be able to drag them over a picture ....

Thanks

Sub Globals
Private pnlFilho2 As Panel
Dim GD As GestureDetector
end sub
Sub Activity_Create(FirstTime As Boolean)

For b=0 To 2

Dim btnDrag As Button
btnDrag.Initialize("btnDrag" & b)

pnlFilho2.AddView(btnDrag,5%x+b*50 , pnlFilho2.Height*0.8, 40dip,40dip)
btnDrag.Text = "B" & (b+1)
btnDrag.TAG = "t" & b
btnDrag.Color=Colors.Yellow
btnDrag.TextColor = Colors.Black

btnDrag.Visible=True
GD.SetOnGestureListener(btnDrag, "Gesture")
Next

end sub

Sub Gesture_onTouch(Action As Int, X As Float, Y As Float, MotionEvent As Object) As Boolean
Log("onTouch action=" & Action & ", x=" & X & ", y=" & Y & ", ev=" & MotionEvent)
Return True
End Sub
Sub Gesture_onDown(X As Float, Y As Float, MotionEvent As Object)
Log(" onDown x = " & X & ", y = " & Y & ", ev = " & MotionEvent)
Log(" pressure = " & GD.getPressure(MotionEvent, 0))
Log(" size = " & GD.getSize(MotionEvent, 0))
End Sub
Sub Gesture_onDrag(deltaX As Float, deltaY As Float, MotionEvent As Object)
Log(" onDrag deltaX = " & deltaX & ", deltaY = " & deltaY & ", ev = " & MotionEvent)
Dim butdrag As Button
butdrag = Sender
Log(butdrag.tag)
butdrag.Left = Max(0, Min(butdrag.Left + deltaX, 100%x - butdrag.Width))
butdrag.Top = Max(0, Min(butdrag.Top + deltaY, 100%y - butdrag.Height))
End Sub
Sub Gesture_onFling(velocityX As Float, velocityY As Float, MotionEvent1 As Object, MotionEvent2 As Object)
Log(" onFling velocityX = " & velocityX & ", velocityY = " & velocityY & ", ev1 = " & MotionEvent1 & ", ev2 = " & MotionEvent2)
End Sub
 

ehsan211

New Member
hello . its my question Too . i try different method but cant solve it
 
This library is really what I have even wanted to achieve. I would be able to monitor finger movements, angle and even pressure strenght on some display place. But I have one programmers plea to all of us.

Because I do not see at all, I AM dependent on Android screen readerandEspecially on Explore by touch Android build in service. This service is not The part of GOogle Accessibility suite. It is Android service which can be called by every app. But it was strongdisadvantage. If Explore by touch service is being actively used, libraryes or code, which detect gestures related feetback can not work.Does somebody of us think,that this long time limitation of ANdroid could be overcomed on future Android versions? Now, visually impaired user must always suspend Android accessibilitysuite or disable Explore by touch feature of this screen reader. In this case, screen reader will never interact with Explore by touch Android service. In this case user can use what ever app he or she is wanting even with gestures feetback.

But one developer from our country have invented one work around. His app can detect, if visually impaired user has used two or three fingers and even The direction of those finger tips movement. I do notknow, if is it because Android accessibility suite export some external APIS of if Explore by touch service allow this.
COuld somebody look at this problem related to conflict between Explore by touch Android service and other apps, which would want to get gestures feetback?
Thank you very very much and thank You for yours very useful library.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…