Java Accessibility: Emulate ARIA role "alert" - java

I'm writing a Java app and I'm making sure that every bit of it is compatible with screen readers. Having worked with screen readers in the past when doing web development, I assumed, perhaps foolishly, that the behaviour would be much the same in Java.
What I'm particularly struggling with is with providing alert text without popping up a dialog. I am providing a status update which is useful information but doesn't require any user interaction.
In a browser, all I had to do was give a DIV the ARIA role "alert" (Alert Role).
Now I'm trying to accomplish the same thing with Swing components but I don't see any clear way to do it. The Java accessibility package has an Alert role (AccessibleRole class) whose description suggests the same behaviour but I don't see any Swing components that use it or a way to make them change roles (seems to be hard-coded).
The How to Support Assistive Technologies guide touches on the idea of creating custom components but barely scratches the surface and doesn't seem to mention the Alert class.
Any idea what some good next steps might be?

Related

Tooltip/mouseover text in an AnyLogic simulation user interface screen?

I would like to know if it is possible implement tooltip (mouse over) text within an AnyLogic simulation, whereby the simulation user can hover the mouse over a Radio Button or Edit Box, for example, and get context dependent help message.
I note that the AnyLogic IDE provides this for (some of) the palette icons to assist the developer, so there is support in Java presumably using setToolTipText(), but is such a feature available also to the simulation model user?
If this is do-able, an AnyLogic-specific example would be highly appreciated.
this is not possible anymore since AnyLogic UI is not using Java anymore (since they switched to web-based animation).
Unfortunately, we are bound to what AnyLogic provides us for UI capability. A while ago, they said they would add a "on hover" field for UI components but haven't yet. Do push them (support#anylogic.com) to keep this on their agenda, I would love that as well.
PS: Previously (AL7), you could use a MouseListener class
PPS: (ad) We have developed a UI library that gives you similar capability. Not hovering but standardized help messages similar to mobile app notifications: http://materialdesignforanylogic.com/

Automating a task for an app that isn't mine

I haven't found a proper answer for this so far so hopefully I can get one on this thread:
I need to automate a task as follows (on an app that isn't mine):
(1) Kill the android app
(2) Open it again
(3) Click a specific button in it (which is in fixed position) and wait 60 seconds.
I've found answers for 1&2, but I'm thinking 3 may be harder because I don't really have an API or something simple to access the button except tapping it in the screen (the application is not mine obviously), and I'm looking to find the best way to automate this task.
Is it a markup based app?
Unfortunately I don't have personal experience with this scenario, but it may be worth looking into WebDriver, or more specifically a tool called Appium. Appium is geared towards automated testing, but the jist as I understand it would be to use it to leverage WebDriver to target the button your looking for based on a selector.
The upside to this would be that if the author of the button changes attributes such as the location or size of the button, it would be less likely to affect your app. However this would only be relevant if it's markup based I'm pretty sure.

Custom Lock Screen Implementation Techniques

So, I have been exploring many similar questions across website (this, this and this and many more). People wanting to implement their own custom lock screen (not talking about widgets). So far there have been two implementation techniques which users are using.
Home Screen Replacement. In this technique its suggested to create a home screen application, where after unlock logic the default screen shows up. I believe that in this situation developer has to disable Home, Search, Menu and Back button when the lock screen is visible and to implement the Screen off-on logic.
An application. In this technique a normal app is made where after unlock logic the default screen shows up. I believe that in this situation developer has to disable Home, Search, Menu and Back button when the lock screen is visible and to implement the Screen off-on logic.
Now, I don't understand that what is the difference between two approaches? StackOverflow community seems to stress more on the home screen replacement technique. I am very new to Android development so I might be missing some aspect about it. Please suggest that which approach should I use and why? (also, which is easy?).
Thanks so much!
I would use the first method, but only for usability reasons. Because it gives the user a choice to easily revert back to the original homescreen/lockscreen if he chooses not to make the new one a default choice yet.
I'm afraid both strategies you described are quite difficult (depending on the api level range you want it to work on). The difficulty is not in their difference, the difficulty is in overriding the buttons (as Google makes it more difficult by closing down security loopholes for the newer api levels).
PS: Please note that Jellybean has a new Daydream functionality. If customizing the lockscreen is all you need. That may be the way to go since Jellybean is much more secure in that respect and more difficult to work with than the previous api levels otherwise.
Also, consider using the HTC screenlock api for HTC devices. This way, your solution won't be too hacky at least for their newer devices. And perhaps, do a version for rooted devices as well, since that too should be easy, for users who already have obtained root on their device. Don't discount the rooted market, users with root access do spend a disproportionate amount of money on applications in Google Play. That much is obvious if you just take a look at some of the rough numbers of downloads for paid applications that say (for root only) that Google Play gives you.

how does android understand which home screen is being viewed by the user?

I wanted to understand how does the Android OS figure out which home screen the user is viewing currently and render the appropriate icons and widgets on that screen based on the user's left or right swipe on the touch screen of the device.
The OS must save a state of the screen and IDs or something relative to the objects placed on the screen to retrieve the state each time the screen becomes visible.
From my research I understand that Android OS treats all the 7-8 homescreens on devices as one single host.
Also my question might seem vague, but the reason why I am asking is because it seems reasonable that app widgets on android devices, update not only when the phone is awake but also only when the app widget itself is visible. I know that Google has declined the enhancement request by many others but I don't think that is good enough. Link here.
That is the reason why I am trying to give it a shot to understand and implement it for my app with whatever Android knows about the state of the home screens.
Any help or insight is much appreciated. Also the experts out there let me know if you think this can be even implemented for one off apps at all?
Well, as the link you posted clearly states, there's no way to know.
Also, if you consider the fact that "Home" is just an application like all the others, it makes even less sense to have a unified API for that. A lot of people use Launcher Pro or similar applications, which would probably not implement it.

Design a GUI for a J2ME app

How do I create a J2ME app for cellphones with a GUI similar to the menus you see in Java games? I've tried MIDlets with Netbeans but they only show you one GUI element at a time. (textbox, choice, login, etc)
And which Java IDE would you typically design these GUIs in? Netbeans or Eclipse? and is IntelliJ IDEA usable for this aswell?
Do I have to write/get a library that draws GUI controls to screen via bitmap functions .. and keeps track of the keys pressed for focus?
Try to use LWUIT - nice UI toolkit for j2me:
https://lwuit.dev.java.net/
http://lwuit.blogspot.com/
You can also use minime: http://code.google.com/p/minime/
It's an open source GUI library for j2me. miniME works on canvas level (lowest level in j2me) to draw every control so your UI will look exactly the same whatever the handset it'll be running on. Other advantage are:
- miniME uses its own event loop to manage user controlled event (botton pressed, softbar, ..), so you Application will "behave" the same whatever the handset.
- miniME support the concept of Views and stack of view, in order to make navigation between different view/screens very easy.
Here is an example: A View is what you have on the screen at a given moment (for example the main menu screen), then to go to a sub menu, you create a new view, and by calling a simple API, you push it in the stack of Views. The previous view (the main menu) is still existing, but inactive. When the sub menu view complete his work (for example, user press back, or do a selection), you can just go back to the previous view by calling a pop api.
Your question is a bit vague to give a specific aswer, but you might want to check out LWUIT or Polish, you can develop both with either Eclipse or Netbeans.
As far as designing GUIs go, neither IDE will help from a visual perspective. J2ME UI development is all done in code, beyond creating any initial graphics in a proper graphics editor you don't get to see your output until you test.
Read up on the LCDUI package documentation which explains how the UI classes work and the differences between the 'High-level' and 'low-level' APIs.
I can't comment on which IDE to use - but I do know that to create custom UI (like the ones you see in J2ME games), you have to explicitly draw the GUI controls.
Beware that you may need to customize the GUI depending on the target phones. You have to cater for different screen sizes, key pad configurations, default theme etc. This would probably mean that you need different builds for things like different screen sizes which would drive up your Java Verified certification costs (if you need it).
You may be able to find a set of nice looking UI controls that you can buy online and use (try J2ME Polish). The easy way out of course, is to use default J2ME controls :)
Links to many j2me GUI libraries: link1, link2
I know that kuix is not bad and free - watch demo.
But i prefer to make my own gui elements - this is much more flexible (but takes some time).
As for IDE - you may want to make some kind of gui-editor tool, construct interface in it, save result to some file, and read it from your app.
It's way too cumbersome to write your own GUI, especially since there are so many available these days. If you're familiar with desktop development in VB.Net and C#, you might find "J2ME GUI" easy to use. You can download it from http://www.garcer.com/. It has a similar feel and makes it easy to learn. This is the kind of GUI that I expected to come standard with MIDP2 when I started mobile development. Would have solved a lot of issues.
If you are familiar with web stuffs then you can use KUIX (kalmeo.org/home/index) framework having xml and css supports. In place of It you can use also Polish framework (www.j2mepolish.org) it's also uses the xml in easy way rather than kalmeo kuix framework.

Categories