Play on clothes

I have an Android Wear app in which I use a transparent overlay view to receive touch events. I need to be able to receive all touch events that occur anywhere on the screen, and also be able to see their coordinates.

All the studies I found say that I can’t get all the touch events and pass them on. However, Wear Mini Launcher and Swipify are both doing something like this.

This is where I looked:

It should be possible. Maybe the overlay look is not suitable for this? Any pointers?

+3
source share
1 answer

I had quite a few problems with this using the same links that you provided. But then I found this: http://www.piwai.info/chatheads-basics/

This is basically similar to other solutions, except that the arguments of WindowManager LayoutParams are TYPE_PHONE and FLAG_NOT_FOCUSABLE .

This solution not only worked for me (I tested on LG Urbane), the onTouchEvent had all the actions (down, move and up) that the other solutions said you won’t get.

Since all sensory events are transmitted through the view, in theory we can use gesture detectors to receive callbacks for things like double taps and outliers. I have not tried this yet.

Regardless of what the link above should help you overcome the initial problems you are facing.

+1
source

Source: https://habr.com/ru/post/975843/


All Articles