Ignore Immersive mode swipe - android

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.

Related

Unity Swipe Controls

I am currently building a game in Unity intending for android devices. Right now for development purposes I am coding by the keyboard controls. What would be the simplest and effective way of approaching the actions when the screen is swiped? I want to access the events screen is swiped left right back or front.
Easiest way to plug into the drag (and other) events is by using EventTrigger component on a UI element (for example Image)

Altering the global/master UI from a background app in android

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.

How to detect certain gestures?

SO i am building a game in which i want to be able to allow the user to do certain actions based on the gesture on the screen.
For example, the user makes a circle with their finger on the screen and then something will happen.
Or the user makes a triangle and then something happens..
Is there any way to detect this type of gestures?
This guy wrote an awesome post on the topic with source included:
http://www.androiddevblog.net/android/gesture-detection-in-android-part-2-of-2

live wallpaper - detecting touches when navigation menu is open

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.

What is gesture in Android

I would like to know what is meant by gestures in typical mobiles more specifically android ones. Android supports gesture recognition.
Is a gesture termed as when user
holds the device and shakes it(say
upwards, downwards or side- side)?
Is a gesture termed as when a
finger is placed on the screen and
traced UP,DOWN,RIGHT,LEFT? If so
what is the difference between touch
screen and gestures.
I am confused between 1) and 2) option.
What is a gesture exactly?
As I understand it, a gesture is anytime a user touches the screen and does a pre-defined motion that the system understands. I would venture to say that shaking the phone is not a gesture, but a function of detecting changes in the accelerometers.
From Android's reference web page, a gesture is a hand-drawn shape on a touch screen. It can have one or multiple strokes. Each stroke is a sequence of timed points. A user-defined gesture can be recognized by a GestureLibrary.
https://developer.android.com/reference/android/gesture/Gesture.html
I see gestures as being a type of input pattern that you expect from the user. I.e., you can setup mouse gestures in web browsers to do things like going "Forward" or "Back" in the browse by doing a specific "gesture" (maybe middle mouse button click and moving the mouse left goes "Back").
I'll give a brief answer to your bonus question: Yes, it's quite possible to to character recognition from input gestures on Android. In fact, at least one major vendor has already ported an existing handwriting engine to that platform. Works beautifully, but there's a lot of legal and marketing cruft to take care of as well before it ends up on real devices :(

Categories

Resources