Swipe and Select Links using FantomCX

Pierrou

Active member
Joined
Jul 6, 2017
Messages
230
Hi,
I hope my question is not too vague I'm working on a mobile app using the FantomCX framework
It's the program for a film festival I'm part of. You'e supposed to be able to swipe up and down through the times and titles of the day.
When touching a film title, you get a screen with a picture and the synopsis for that film (using fE.TouchCheck() and the OnObjectTouch Method).
Right now I'm struggling with accidentally touching and activating those touchable links (i.e. the film titles) while swiping, whenever the finger starts the swipe from one of the screen titles.
Is there an "official" or obvious way to achieve what I'm trying to do?
Many thanks if a FantomCX specialist can help me.
 

Attachments

  • 1631969671391.png
    1631969671391.png
    237.1 KB · Views: 9
Last edited:

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
3,135
I can look into this tommorow. Do you have
some code to share, so can have a test case?
 

Pierrou

Active member
Joined
Jul 6, 2017
Messages
230
I will try to pack up some standalone code thanks (I guess sending the whole project and its somewhat messy code won't help?)
Thanks a lot!
 

Pierrou

Active member
Joined
Jul 6, 2017
Messages
230
OK this is an archive including the whole project. I took away the workarounds I tried to use to avoid accidental clicking so everytime the user's finger touches a link, it opens the link.
I hope you get to figure out what I've been trying to do, if not I probably can clean it or comment it some more. Thank you if you can look into it! (if it turns out you can't no problem of course)

EDIT : the version I just uploaded seems to be working like it's supposed to, so maybe I can send it to testers first and you won't have to waste your time on this, although there probably is a better way to do it.
 
Last edited:

Jimmy

Active member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
878
I can't help much and I don't know French but I must say that I do hope you get it fixed in time,
there's a lot of heartwarming pictures in there and I enjoyed seeing Cerberus being used for this! Good luck!
 

Pierrou

Active member
Joined
Jul 6, 2017
Messages
230
Thanks, now that you say it, that's right (except for the one with the drugs and another one which I put as temporary inside jokes since I hadn't received the right pictures yet) these are mostly nice and heartwarming pictures. It's a film festival about speech therapy, since that's my job, and it takes place in my hometown. My own film is "film3".
The new beta is on Google Play for the staff to try.
 

Pierrou

Active member
Joined
Jul 6, 2017
Messages
230
So it appears to be working perfectly on some phones and tablets while the links won't open on some others. I'm desperate.
 
Last edited:

Pierrou

Active member
Joined
Jul 6, 2017
Messages
230
One part I'm not sure about is :
Code:
If TouchHit(0)
                fE.TouchCheck()
            EndIf
Or should it be :
Code:
If TouchDown(0)
                fE.TouchCheck()
            EndIf
Or simply :
Code:
                fE.TouchCheck()
inside the OnUpdate() Method?
 

Pierrou

Active member
Joined
Jul 6, 2017
Messages
230
On some phones, apparently nothing happens indeed. I was using
Code:
If TouchDown(0)
      fE.TouchCheck()
EndIf
On my Xiaomi Mi2 phone and my Samsung A7 tablet everything is OK. I replaced TouchDown with TouchHit just to see if that changes anything, waiting for the testers' feedback.
 

Pierrou

Active member
Joined
Jul 6, 2017
Messages
230
Ouich, everything is in french. I don't speak that language.
And there aren't many comments sorry
If there still is a problem (which I don't know yet) it must be somewhere between the TouchCheck() part in OnUpdate() and OnTouchObject().
Being new to FantomCX and not very used to the Android platform, I'm not quite sure what I'm doing right or wrong.
 

Pierrou

Active member
Joined
Jul 6, 2017
Messages
230
Update sorry for the messy thread : using the code in the archive :
One user reports she can access to the link by touching twice, like a double-click, and another one tells me he still can't open links when touching the titles.
 

Jimmy

Active member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
878
Does it work always in HTML for everyone / all devices?

I'm thinking two things it could be:
1) is the logic for setting the flags e.g. justclicked = true
2) or if it just android..android have static screensize maybe there's something about the scaling but the touch twice things suggest something about the flags

EDIT
One last thing is maybe trusting index 0 every time might be wrong. I don't have enough devices to test on so I havnt't tried this but 've had it in the back of my mind if anything like this happens.
What I mean is, index 0 might get active first but after that maybe some other index takes over as they might partially overlap a second, so 0 could not be trusted as the only active "first" touch. On some devices the timing might be different. I would put this low on the debug list though. Trusting 0 index always worked so far for me to Android though (knock on wood). Reading things like Touch(0) just ONCE per frame into a variable is good practice I think.
 
Last edited:

Pierrou

Active member
Joined
Jul 6, 2017
Messages
230
You're probably right about double-clicking and the flags but I can't see what's wrong with it right now.
EDIT : I've been able to try it on a quite old Samsung smartphone, and I noticed that since I used TouchHit one had to tap quickly to select the link.
Also, there began to be some lag when touching objects one after another quicky especially in the upper "menu" or if you swiped up or down a few times and then selected a link. I don't know how it all, works, if the input event are somehow queued and how, when you do things slowly and quietly on that phone it's quite OK, I don't know what to do with it right now.
And finally the colleague who thought she had to double touch on her own Samsung phone can see her phone does the same as what I described just above.
 
Last edited:

Jimmy

Active member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
878
Ya, I have difficulty to understand the code as it has complex logic for an outsider,
but I don't see an immidiate setting of the flag after a touchdown so it might be that.
 

Pierrou

Active member
Joined
Jul 6, 2017
Messages
230
justClicked is set to True whenever an object is touched inside the OnObjectTouch method, and it is set to False when it has just been set to True And there is no Touchdown, inside the OnUpdate Method. It is also set to False inside the OnSwipeDone method, whenever the user swipes, that should cover most of the cases if not all of them.
 

Pierrou

Active member
Joined
Jul 6, 2017
Messages
230
OK adding some "DeadSwipeDeadDist fE.SetSwipeDeadDist(20) and replacing TouchHit() by TouchDown in the previous code seems to do the trick, sorry for wasting your time with this let's go back to testing on more phones
 
Top Bottom