I'm coding an app specifially designed for the blind and vision impaired and I'm trying to override the behavior of TextView
when specific AccessibilityEvent
are fired. The screen layout consists in 4 TextView
arranged vertically that fill the screen. I just want to change the color of the background to reflect which one is "focused" so in my custom TextView
I have this method
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
System.out.println(event.toString());
if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_HOVER_ENTER ||
event.getEventType() == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED) {
this.setBackgroundColor(mColorArray[2]);
}
if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_HOVER_EXIT ||
event.getEventType() == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED) {
this.setBackgroundColor(mColorArray[0]);
}
return super.dispatchPopulateAccessibilityEvent(event);
}
My problem is that AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED
is never fired. The three others fire correctly when using ExploreByTouch or swiping left/right up/down.
Any help would be greatly appreciated