Example usage for android.view ViewGroup requestSendAccessibilityEvent

List of usage examples for android.view ViewGroup requestSendAccessibilityEvent

Introduction

In this page you can find the example usage for android.view ViewGroup requestSendAccessibilityEvent.

Prototype

@Override
    public boolean requestSendAccessibilityEvent(View child, AccessibilityEvent event) 

Source Link

Usage

From source file:com.android.yijiang.kzx.widget.betterpickers.TouchExplorationHelper.java

/**
 * Populates an event of the specified type with information about an item and attempts to send it up through the
 * view hierarchy./*from   w w  w .ja va  2s  .  c  o m*/
 *
 * @param item The item for which to send an event.
 * @param eventType The type of event to send.
 * @return {@code true} if the event was sent successfully.
 */
public boolean sendEventForItem(T item, int eventType) {
    if (!mManager.isEnabled()) {
        return false;
    }

    final AccessibilityEvent event = getEventForItem(item, eventType);
    final ViewGroup group = (ViewGroup) mParentView.getParent();

    return group.requestSendAccessibilityEvent(mParentView, event);
}

From source file:org.holoeverywhere.widget.datetimepicker.TouchExplorationHelper.java

/**
 * Populates an event of the specified type with information about an item
 * and attempts to send it up through the view hierarchy.
 *
 * @param item      The item for which to send an event.
 * @param eventType The type of event to send.
 * @return {@code true} if the event was sent successfully.
 *///w  w  w . j  a  v  a2  s  .co m
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public boolean sendEventForItem(T item, int eventType) {
    if (!mManager.isEnabled() || Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        return false;
    }

    final AccessibilityEvent event = getEventForItem(item, eventType);
    final ViewGroup group = (ViewGroup) mParentView.getParent();

    return group.requestSendAccessibilityEvent(mParentView, event);
}

From source file:com.doomonafireball.betterpickers.TouchExplorationHelper.java

/**
 * Populates an event of the specified type with information about an item
 * and attempts to send it up through the view hierarchy.
 * // w w w  . j a v  a  2  s. c  om
 * @param item
 *            The item for which to send an event.
 * @param eventType
 *            The type of event to send.
 * @return {@code true} if the event was sent successfully.
 */
@SuppressLint("NewApi")
public boolean sendEventForItem(T item, int eventType) {
    if (!mManager.isEnabled()) {
        return false;
    }

    final AccessibilityEvent event = getEventForItem(item, eventType);
    final ViewGroup group = (ViewGroup) mParentView.getParent();

    return group.requestSendAccessibilityEvent(mParentView, event);
}

From source file:com.android.utils.ExploreByTouchHelper.java

/**
 * Populates an event of the specified type with information about an item
 * and attempts to send it up through the view hierarchy.
 * <p>//  w w w . j  a  va  2 s  . c o m
 * You should call this method after performing a user action that normally
 * fires an accessibility event, such as clicking on an item.
 *
 * <pre>public void performItemClick(T item) {
 *   ...
 *   sendEventForVirtualViewId(item.id, AccessibilityEvent.TYPE_VIEW_CLICKED);
 * }
 * </pre>
 *
 * @param virtualViewId The virtual view id for which to send an event.
 * @param eventType The type of event to send.
 * @return {@code true} if the event was sent successfully.
 */
boolean sendEventForVirtualViewId(int virtualViewId, int eventType) {
    if ((virtualViewId == INVALID_ID) || !mManager.isEnabled()) {
        return false;
    }

    final ViewGroup group = (ViewGroup) mHost.getParent();
    if (group == null) {
        return false;
    }

    final AccessibilityEvent event;
    if (virtualViewId == ROOT_ID) {
        event = getEventForRoot(eventType);
    } else {
        event = getEventForVirtualViewId(virtualViewId, eventType);
    }

    return group.requestSendAccessibilityEvent(mHost, event);
}

From source file:com.googlecode.eyesfree.utils.ExploreByTouchHelper.java

/**
 * Populates an event of the specified type with information about an item
 * and attempts to send it up through the view hierarchy.
 * <p>/*from   ww w .  j ava  2s.  co  m*/
 * You should call this method after performing a user action that normally
 * fires an accessibility event, such as clicking on an item.
 *
 * <pre>public void performItemClick(T item) {
 *   ...
 *   sendEventForVirtualViewId(item.id, AccessibilityEvent.TYPE_VIEW_CLICKED);
 * }
 * </pre>
 *
 * @param virtualViewId The virtual view id for which to send an event.
 * @param eventType The type of event to send.
 * @return {@code true} if the event was sent successfully.
 */
public boolean sendEventForVirtualViewId(int virtualViewId, int eventType) {
    if ((virtualViewId == INVALID_ID) || !mManager.isEnabled()) {
        return false;
    }

    final ViewGroup group = (ViewGroup) mHost.getParent();
    if (group == null) {
        return false;
    }

    final AccessibilityEvent event;
    if (virtualViewId == ROOT_ID) {
        event = getEventForRoot(eventType);
    } else {
        event = getEventForVirtualViewId(virtualViewId, eventType);
    }

    return group.requestSendAccessibilityEvent(mHost, event);
}