nispok/snackbar

Snackbar not detected by accessibility services

iahvector opened this issue · 0 comments

A snackbar should fire an accessibility event when shown to be read by accessibility like toasts.
As a work around, I add this event listener to all toasts, but this event type was added in API level 16 and I didn't have the chance to test it on an earlier device.

snackbarEventListener = new EventListenerAdapter() {
            @Override
            public void onShow(Snackbar snackbar) {
                snackbar.setContentDescription(snackbar.getText());
                snackbar.sendAccessibilityEvent(AccessibilityEvent.TYPE_ANNOUNCEMENT);
            }
        };