need xy OnTap

Post your questions and help other users.

Moderator: Martin

Post Reply
Mucatigoa
Posts: 5
Joined: 09 Nov 2014 17:30

need xy OnTap

Post by Mucatigoa » 09 Nov 2014 17:38

I want an overlay that knows where it was tapped = relative X Y coords. Like an Ontap function. As a bonus, if any tap/swipe occurred outside the overlay.

Can this be done with a widget?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: need xy OnTap

Post by Martin » 10 Nov 2014 16:24

No sorry, that's currently not possible with a widget. Watching taps outside the widget is also not possible and I think that this can not be done anymore on newer versions of Android.
On a rooted device you could try to react to touch input using trigger Command Output and command getevent. This post contains some hints to react to volume buttons but touch input should also be visible in the output of the command when I recall correctly.

User avatar
Bushmills
Posts: 286
Joined: 23 Sep 2014 21:56

Re: need xy OnTap

Post by Bushmills » 10 Nov 2014 17:18

How about a 0% opacity widget overlay with dimensions of screen?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: need xy OnTap

Post by Martin » 10 Nov 2014 17:26

This would consume the touch event which might not be the desired result, but otherwise this should work.

Mucatigoa
Posts: 5
Joined: 09 Nov 2014 17:30

Re: need xy OnTap

Post by Mucatigoa » 10 Nov 2014 19:29

Another way is with a grid of very small buttons...

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: need xy OnTap

Post by Martin » 10 Nov 2014 21:19

Version 1.25 will provide variables screen_x and screen_y to the executed clickable action (for example action Execute Flows assigned as the single action of a widget). This only works for overlays but not for regular widgets placed on the launcher/lock screen. Note that the widget consumes the touch event so it's a good idea to use a widget that does not cover the entire screen like I did ;) .

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: need xy OnTap

Post by MURTUMA » 10 Nov 2014 21:23

When the overlay consumes the click event, maybe it's possible to reproduce it with control ui action underneath the overlay?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: need xy OnTap

Post by Martin » 12 Nov 2014 15:45

Unfortunately Control UI has to use the accessibility features to simulate clicks on user interface elements which does not work on all elements (games, graphical elements etc.).
On a rooted device you could use Execute Root Command: input tap x y to simulate touch input that will work on more user interface elements.

Post Reply