I have a live wallpaper which responds to touch and swipe/move events.
If I press the applications button on my phone, I get a menu with all my installed apps. My problem is that when I scroll through my list of installed applications, it triggers the touch and move events on my - out of sight - wallpaper beneath. The wallpaper is still hogging resources drawing and updating anyway, and while scrolling through my installed apps, it can become slightly sluggish.
I was wondering if there was a way to determine if either: the menu is open, or preferably - whether or not the livewallpaper is actually visible or not.
EDIT - I can only think to listen for ACTION_MOVE events in WallpaperEngine. If you detect one without onOffsetChanged being called then you can assume the menu is open and disable touch events.
Related
I am trying to automate a user experience on AndroidTV Apps which don't have a standard android view hierarchy (probably written using openGL framework).
I can provide the dump of the view of any of these apps if needed.
I'm trying to fire a click event for a particular button, say 'ABC' which is present at the 'x y' coordinates on the screen.
For native android ATV apps, I can do that by firing an 'adb tap x y' event or UiDevice.click(x,y).
However, I'm not able to do so with Netflix, Prime, Youtube or Hulu Apps for ATV.
The click/tap is actually triggered on the screen, but the button doesn't respond to that.
Maybe because it's part of just a View(Framelayout) and not actually a button in the openGL world.
I don't want to use the D-Pad Remote Control events for this.
(Maybe, shift focus to that coordinate and then press dpad centre can. work)
Is there any way I can achieve that ?
Is it possible for an android app to run in the background, listen to specific triggers and modify the visible application content in the screen (in both system and third party apps)?
For an example, A 2 finger tap should lead to a ripple effect on the screen. If the temperature is high, The screen turns more reddish. If I say "do a barrel roll", The entire UI does a "barrel-roll" like the google Easter egg. And this should happen whether the user is in the homescreen, settings or his Instagram.
The best working example I can give is the built-in "Magnification Gesture" provided by Android. Three taps anywhere will zoom everything up except for the keyboard and the navigation bar. And it doesn't zoom as an image, the touch points are preserved.
Is this possible to do without or with root? Do I need a framework like Xposed?
Thanks.
Background
I've made a live wallpaper that can handle touch events .
The problem
There are some cases which I don't want it to handle touches (or listen to other events). This help prevent weird drawing and also save on the battery a bit.
For example, on Lollipop, I've noticed that when you show the recent tasks screen, the live wallpaper still has focus. This didn't happen on pre-Lollipop, because the recent tasks screen took over everything on the screen.
Another example is the wallpaper-chooser, even if you just show thumbnails of all live wallpapers, you would still show your own and handle touch events, as if the user is on the launcher.
However, when you show the notification bar or the menu of the launcher (by pressing the menu button), the live wallpaper will not get any touch events.
You can see those issues on other live wallpapers, like "Magic fluids free" for example.
Again, the problem is that on some cases, there is no way to disable the touch events, because you can't know when they happen (recent tasks and wallpaper chooser are such examples).
What I've tried
There isn't much to do. all of the methods of the Engine class failed to find the state of the sceneraios I've written about:
onOffsetsChanged, onVisibilityChanged, onSurfaceChanged, onSurfaceRedrawNeeded, onOffsetsChanged
The question
Is there any way to overcome this issue?
To stop listening to events in case the live wallpaper isn't on focus?
How about setting
setTouchEventsEnabled(false);
in your WallpaperService Engine class, when you don't want touchs to be handled, and set it to true when you do.
With the game running in Android 4.4's Fullscreen Immersive Mode, the user swipes from the edge of the screen to show the notification / status bar & the Menu buttons bar
However, these swipes are also passed to the game underneath as downward swipes
Is there an official / clean way to ignore those swipes other than hard-coding a specific are of the screen to ignore down swipes from?
In K, there is no way to do this. The system receives motion events in parallel to your application, not before. This avoids introducing latency and gives apps/games the ability to implement gestures using these events.
Bear in mind that even if a gesture starts near the edge, it may not end up meeting the requirements for an edge swipe by the time the gesture ends. You may want to look at the gesture definition in AOSP if you are trying to avoid it.
i want the exact the same thing. i am developing a drawing APP and want to turn on immessive mode. but when swipin, the touch event is passed in, which results a wrong drawing curve. this is not acceptable. it would be great if if the gesture just eat the event instead of dispatch to my app.
i'd suggest fire an CANCEL event to APP once the system gesture is detected and fired.
I'm creating a live wallpaper for Android and ran into an issue with the manual scrolling (without using the onOffsetsChanged method). The scrolling works like a charm except for one, but very unpleasent side-effect - when a user opens the "AllApps" screen and this screen is semi-transparent (like on the Xperia phones), the wallpaper keeps on reacting the touch events when the user goes through screens with his/her installed apps and scrolls.
I understand that nothing is changed from the wallpaper's "point of view" if this screen is semi-transparent. It keeps on rendering and continues to process all the touch events.
So, the question is - is there a way to track down the moment when a user opens the "AllApps" screen and stop processing touch events until this screen is closed? Any ideas?