// Evaluate the navagational orientation state(s) set for the accessible
// element
final String orientation = Util.getOrientation(statesSet);
final AccessibleText text = context.getAccessibleText();
final int childCount = context.getAccessibleChildCount();
// In cases where there are many components on a
// screen/dialog/menu...most of
// which are not frequently used, it's more practical to set a limit on
// the
// number of components to be read:
// int maxCount = Math.min( childCount, 10);
// and then use maxCount instead of childCount.
switch (context.getAccessibleRole()) {
case AccessibleRole.SCREEN:
if (busy) {
Util.speak("Screen " + name + " loading");
} else {
Util.speak("Screen " + name);
for (int i = 0; i < childCount; i++) {
final AccessibleContext child =
context.getAccessibleChildAt(i);
readChildElement(child);
}
}
break;
case AccessibleRole.TEXT_FIELD:
if (text != null) {
String currentText = text.getWholeText();
currentText = currentText != null ? currentText.trim() : "";
final String textToSpeak =
currentText.length() > 0 ? " with text " + currentText
: " empty";
toSpeak.append(name + " text field " + textToSpeak);
toSpeak.append(focusedText);
toSpeak.append(editableText);
}
break;
case AccessibleRole.LABEL:
toSpeak.append(name);
toSpeak.append(focusableText);
toSpeak.append(focusedText);
toSpeak.append(selectedText);
toSpeak.append(expandedText);
break;
case AccessibleRole.APP_ICON:
toSpeak.append(name + "application icon");
toSpeak.append(focusedText);
break;
case AccessibleRole.ICON:
toSpeak.append(name + " icon ");
toSpeak.append(focusedText);
break;
case AccessibleRole.DATE:
toSpeak.append(name + " date field ");
toSpeak.append(selectedText);
if (text != null) {
toSpeak.append(" with current value " + text.getWholeText());
}
break;
case AccessibleRole.LIST:
if (busy) {