Example #1
0
 @Override
 public void onPopulateAccessibilityEvent(View host, AccessibilityEvent event) {
   super.onPopulateAccessibilityEvent(host, event);
   if (sEventMessage != null) {
     populateEventFromJSON(event, sEventMessage);
     // No matter where the a11y focus is requested, we always force it back to the current vc
     // position.
     event.setSource(host, VIRTUAL_CURSOR_POSITION);
   }
   // We save the hover enter event so that we could reuse it for a subsequent accessibility
   // focus event.
   if (event.getEventType() != AccessibilityEvent.TYPE_VIEW_HOVER_ENTER) sEventMessage = null;
 }
 @Override
 public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
   if (Build.VERSION.SDK_INT >= 14) {
     if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
       // Action mode started
       event.setSource(this);
       event.setClassName(getClass().getName());
       event.setPackageName(getContext().getPackageName());
       event.setContentDescription(mTitle);
     } else {
       super.onInitializeAccessibilityEvent(event);
     }
   }
 }