`dispatchGesture` ignore overlay view - java

I'm using the dispatchGesture API from Android accessibility.
I've added an overlay to the screen and I'm looking for a way to dispatchGesture behind the overlay (the overlay is what's intercepting the original gesture) since otherwise the gesture is dispatched on my OverlayView and don't play back in the app.
Is there any way to do this with the accessibility API?
For context - I want to be able to help people record actions in Android and replay them for accessibility.

Alas, there is no way to do this generally. A touchable overlay will capture all touches, as you're observing. It's not possible to do general-purpose filtering of touch events.
You've probably already thought of this, but if you're playing back pre-recorded gestures, you can remove your overlay before you dispatch them.
The general purpose filtering API doesn't exist because it's very difficult to filter touch events outside the system process without introducing serious jank.

You must use FLAG_NOT_TOUCHABLE params flag for your view and then dispatch your click.

Related

Android set an Accessibility Focus listener

What I want is to have a listener when a certain element (like a button, an image, a view or anything else) became accessibility focused. I found stuff like mybutton.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED) but then I don't know what to do next, how to handle it.
My main purpose is to make a sound when an element became focused instead of reading his accessibility name.
Any suggestion?
Im not much of an Android developer, but i think the event you are using is sending information to the screen reader. You would need the opposite of that.
I think the answer to this question could help you
Google talkback API to get current focus item in android
Best of luck, sounds like a cool app for visually impaired children

What calls the Android View.OnClickListener API methods?

I have been learning OOP for about 2 to 3 years, but I am still really confused about interfaces.
In Java for example there is an interface called View.OnClickListener.
Now I know the class which implements this interface will have to provide body for its abstract methods, but what I do not get is that in the API documentation its written that the onClick method is called when a view is clicked.
So who calls this method? Is there any other class which implements the interface and then somehow call the method when view is clicked?
Link (https://developer.android.com/reference/android/view/View.OnClickListener)
You are probably a lot less confused about interfaces than you think.
Basically, GUI frameworks like Android's view framework, classic Java Swing, JavaFX, Eclipse SWT and so on are all big and complicated1. But they all work by turning the application "upside down". Instead of your application code controlling everything, the framework is in control. Your application registers a bunch of listeners or "call backs". Then it hans over control to the framework, and waits to be called back to do something.
The GUI framework will have a master "event thread" that reads the stream of low level events coming from the device (clicks and movement from the mouse, or touch screen events, key presses and release on the keyboard, etcetera). For each one, it maps the low level event to the appropriate part of your application, and then calls your application to say something has happened.
Suppose that an Android user taps her finger on the screen. The framework will translate the touch screen event's physical screen position to virtual screen location of some "component" of your app. If that the component was a button, and you had (previously) registered an OnClickListener for that button, the framework would find the button, and call the listener's onclick() method to tell your application "this button has just been clicked".
It is all rather simple and elegant ... and good sound OOP. But the relationship between your code and the framework is upside down to what you would expect.
1 - and too complicated for most people to fully understand. Though in fact, you don't need to fully understand them to use them.
Those methods are called by the Android framework itself. This is one of the useful things the framework does on your behalf, so that you don't need to interpret raw user finger input and figure out what constitutes a "click"!
From https://developer.android.com/guide/topics/ui/ui-events (my emphasis):
Within the various View classes that you'll use to compose your layout, you may notice several public callback methods that look useful for UI events. These methods are called by the Android framework when the respective action occurs on that object.
For onClick specifically, that same page says:
This is called when the user either touches the item (when in touch mode), or focuses upon the item with the navigation-keys or trackball and presses the suitable "enter" key or presses down on the trackball.

Batik (1.8) SVG, Enabling Mouse Interaction with Graphics Nodes

Trying to enable mouse interaction with the SVGDom via a JSVGCanvas instance. I've seen the advice to simply add an EventListener to a specific node, such as
myNode.addEventListener("mouseover", myListener, true);
I have done that, but I am not getting any events fired. I've also tried it with the "click" event. Nothing seems to be working.
I am able to render SVG documents (even fairly complex ones), via the setSVGDocument(doc) method. I've also called:
setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC)
all over the place, especially before calling setSVGDocument. I'm not getting any sort of mouse feedback via the rendered SVG. Is there a way of testing that the interactions are happening at a low level? Does one have to register one of those mouse Interactors to enable mouse-actions? Also, does the SVGDOMImplementation version matter? I'm not using the SVG12DOMImplemenation, but the earlier/standard one.
Advice very appreciated. Thanks.

Registering Coords for two fingers

I want to build an android application that would register the x,y for two fingers on the screen at the same time. Is this possible or does android not allow that?
Your View can keep track of multiple touches in its onTouch method be monitoring the events with the ACTION_POINTER_DOWN flag. Check out this post, and its links, for more help.

Animation support for Android SDK 1.5?

I'm trying to add some animations to my application. I've essentially got a few menu screens, that all eventually lead to the main application that is a surface view. I want to add some nice animations between screen like fading in and out between screens. What's the easiest way to do this that is supported by SDK1.5 and above (I want to target most users)?
I'm confused by what is and isn't supported in SDK1.5. My belief at the moment is that animations between different activities is not supported in 1.5 but animations in things like ViewFlipper are. It seems the easiest way is to set up a ViewFlipper, put each of my screens in that, set the animation settings and then use this to get nice transitions.
Also, is there a way to override the "no animations" setting that can be found in the phone's main settings screen under display? I'm making a game, so presentation is important, so I want to be sure that whatever I use will cause an animation regardless of this global setting.
My belief at the moment is that
animations between different
activities is not supported in 1.5 but
animations in things like ViewFlipper
are.
Correct.
It seems the easiest way is to set up
a ViewFlipper, put each of my screens
in that, set the animation settings
and then use this to get nice
transitions.
Either that or just directly apply AlphaAnimation and kin to your Views.
is there a way to override the "no
animations" setting that can be found
in the phone's main settings screen
under display?
No, but bear in mind that is only for inter-activity animations.
I'm making a game, so presentation is
important, so I want to be sure that
whatever I use will cause an animation
regardless of this global setting.
Then do not rely upon global settings. Which, in this case, means do not rely upon inter-activity animations.

Categories

Resources