Search in sources :

Example 36 with AccessibilityEvent

use of android.view.accessibility.AccessibilityEvent in project snackbar by nispok.

the class Snackbar method focusForAccessibility.

private void focusForAccessibility(View view) {
    final AccessibilityEvent event = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_FOCUSED);
    AccessibilityEventCompat.asRecord(event).setSource(view);
    try {
        view.sendAccessibilityEventUnchecked(event);
    } catch (IllegalStateException e) {
    // accessibility is off.
    }
}
Also used : AccessibilityEvent(android.view.accessibility.AccessibilityEvent)

Example 37 with AccessibilityEvent

use of android.view.accessibility.AccessibilityEvent in project XobotOS by xamarin.

the class TextView method sendAccessibilityEventTypeViewTextChanged.

void sendAccessibilityEventTypeViewTextChanged(CharSequence beforeText, int fromIndex, int removedCount, int addedCount) {
    AccessibilityEvent event = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED);
    event.setFromIndex(fromIndex);
    event.setRemovedCount(removedCount);
    event.setAddedCount(addedCount);
    event.setBeforeText(beforeText);
    sendAccessibilityEventUnchecked(event);
}
Also used : AccessibilityEvent(android.view.accessibility.AccessibilityEvent)

Example 38 with AccessibilityEvent

use of android.view.accessibility.AccessibilityEvent in project android_frameworks_base by ResurrectionRemix.

the class PhoneStatusBarView method onRequestSendAccessibilityEventInternal.

@Override
public boolean onRequestSendAccessibilityEventInternal(View child, AccessibilityEvent event) {
    if (super.onRequestSendAccessibilityEventInternal(child, event)) {
        // The status bar is very small so augment the view that the user is touching
        // with the content of the status bar a whole. This way an accessibility service
        // may announce the current item as well as the entire content if appropriate.
        AccessibilityEvent record = AccessibilityEvent.obtain();
        onInitializeAccessibilityEvent(record);
        dispatchPopulateAccessibilityEvent(record);
        event.appendRecord(record);
        return true;
    }
    return false;
}
Also used : AccessibilityEvent(android.view.accessibility.AccessibilityEvent)

Example 39 with AccessibilityEvent

use of android.view.accessibility.AccessibilityEvent in project android_frameworks_base by ResurrectionRemix.

the class ExploreByTouchHelper method invalidateVirtualView.

/**
     * Notifies the accessibility framework that the properties of a particular
     * item have changed.
     * <p>
     * You <b>must</b> call this method after changing any of the properties set
     * in {@link #onPopulateNodeForVirtualView}.
     *
     * @param virtualViewId The virtual view id to invalidate, or
     *                      {@link #HOST_ID} to invalidate the root view.
     * @param changeTypes The bit mask of change types. May be {@code 0} for the
     *                    default (undefined) change type or one or more of:
     *         <ul>
     *         <li>{@link AccessibilityEvent#CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION}
     *         <li>{@link AccessibilityEvent#CONTENT_CHANGE_TYPE_SUBTREE}
     *         <li>{@link AccessibilityEvent#CONTENT_CHANGE_TYPE_TEXT}
     *         <li>{@link AccessibilityEvent#CONTENT_CHANGE_TYPE_UNDEFINED}
     *         </ul>
     */
public void invalidateVirtualView(int virtualViewId, int changeTypes) {
    if (virtualViewId != INVALID_ID && mManager.isEnabled()) {
        final ViewParent parent = mView.getParent();
        if (parent != null) {
            final AccessibilityEvent event = createEvent(virtualViewId, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
            event.setContentChangeTypes(changeTypes);
            parent.requestSendAccessibilityEvent(mView, event);
        }
    }
}
Also used : ViewParent(android.view.ViewParent) AccessibilityEvent(android.view.accessibility.AccessibilityEvent)

Example 40 with AccessibilityEvent

use of android.view.accessibility.AccessibilityEvent in project android_frameworks_base by ResurrectionRemix.

the class AdapterView method onRequestSendAccessibilityEventInternal.

/** @hide */
@Override
public boolean onRequestSendAccessibilityEventInternal(View child, AccessibilityEvent event) {
    if (super.onRequestSendAccessibilityEventInternal(child, event)) {
        // Add a record for ourselves as well.
        AccessibilityEvent record = AccessibilityEvent.obtain();
        onInitializeAccessibilityEvent(record);
        // Populate with the text of the requesting child.
        child.dispatchPopulateAccessibilityEvent(record);
        event.appendRecord(record);
        return true;
    }
    return false;
}
Also used : AccessibilityEvent(android.view.accessibility.AccessibilityEvent)

Aggregations

AccessibilityEvent (android.view.accessibility.AccessibilityEvent)234 AccessibilityManager (android.view.accessibility.AccessibilityManager)47 LargeTest (android.test.suitebuilder.annotation.LargeTest)40 AccessibilityServiceInfo (android.accessibilityservice.AccessibilityServiceInfo)20 ViewParent (android.view.ViewParent)13 TimeoutException (java.util.concurrent.TimeoutException)11 MediumTest (android.test.suitebuilder.annotation.MediumTest)10 IAccessibilityManager (android.view.accessibility.IAccessibilityManager)10 Notification (android.app.Notification)7 ITransientNotification (android.app.ITransientNotification)6 RemoteException (android.os.RemoteException)6 StatusBarNotification (android.service.notification.StatusBarNotification)6 SuppressLint (android.annotation.SuppressLint)5 AccessibilityEventFilter (android.app.UiAutomation.AccessibilityEventFilter)5 OnAccessibilityEventListener (android.app.UiAutomation.OnAccessibilityEventListener)5 ViewGroup (android.view.ViewGroup)5 UiAutomationShellWrapper (com.android.uiautomator.core.UiAutomationShellWrapper)5 SimpleDateFormat (java.text.SimpleDateFormat)5 ArrayList (java.util.ArrayList)5 Date (java.util.Date)5