Example usage for android.view.accessibility AccessibilityEvent TYPE_TOUCH_INTERACTION_END

List of usage examples for android.view.accessibility AccessibilityEvent TYPE_TOUCH_INTERACTION_END

Introduction

In this page you can find the example usage for android.view.accessibility AccessibilityEvent TYPE_TOUCH_INTERACTION_END.

Prototype

int TYPE_TOUCH_INTERACTION_END

To view the source code for android.view.accessibility AccessibilityEvent TYPE_TOUCH_INTERACTION_END.

Click Source Link

Document

Represents the event of the user ending to touch the screen.

Usage

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

public static int[] getAllEventTypes() {
    return new int[] { AccessibilityEvent.TYPE_ANNOUNCEMENT, AccessibilityEvent.TYPE_ASSIST_READING_CONTEXT,
            AccessibilityEvent.TYPE_GESTURE_DETECTION_END, AccessibilityEvent.TYPE_GESTURE_DETECTION_START,
            AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED,
            AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END,
            AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START,
            AccessibilityEvent.TYPE_TOUCH_INTERACTION_END, AccessibilityEvent.TYPE_TOUCH_INTERACTION_START,
            AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED,
            AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED, AccessibilityEvent.TYPE_VIEW_CLICKED,
            AccessibilityEvent.TYPE_VIEW_CONTEXT_CLICKED, AccessibilityEvent.TYPE_VIEW_FOCUSED,
            AccessibilityEvent.TYPE_VIEW_HOVER_ENTER, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT,
            AccessibilityEvent.TYPE_VIEW_LONG_CLICKED, AccessibilityEvent.TYPE_VIEW_SCROLLED,
            AccessibilityEvent.TYPE_VIEW_SELECTED, AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED,
            AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED,
            AccessibilityEvent.TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
            AccessibilityEvent.TYPE_WINDOWS_CHANGED, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED,
            AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED };
}

From source file:com.android.talkback.tutorial.TutorialMainFragment.java

@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    if (mOffButton == null || mParentLayout == null) {
        return;//from   w w  w  . j  av  a2s  . co m
    }

    // There are three types of areas that we're detecting: the button area, areas of the
    // activity that are a11y-focusable, and areas of the activity that are blank.
    // 1) The HoverTrackingButton keeps track of the button area.
    // 2) The HoverTrackingLinearLayout keeps track of blank activity areas.
    // 3) We use TYPE_VIEW_HOVER_ENTER to track a11y-focusable activity areas.
    // The user must begin and end the touch interaction within the Turn TalkBack Off button
    // without moving their finger into other areas of the activity in order to turn TB off.

    switch (event.getEventType()) {
    case AccessibilityEvent.TYPE_TOUCH_INTERACTION_START:
        mOtherViewHovered = false;
        mOffButton.clearTracking();
        mParentLayout.clearTracking();
        break;
    case AccessibilityEvent.TYPE_TOUCH_INTERACTION_END:
        if (mOffButton.didHoverEnter() && !mParentLayout.didHoverEnter() && !mOtherViewHovered) {
            if (TalkBackService.getInstance() != null) {
                TalkBackService.getInstance().disableTalkBack();
            }
        }
        break;
    case AccessibilityEvent.TYPE_VIEW_HOVER_ENTER:
        CharSequence className = event.getClassName();
        // Hovering over the button gives an event with TUTORIAL_CLASS_NAME class.
        // But empty areas of the activity should be tracked by HoverTrackingLinearLayout.
        if (className == null || !className.equals(TUTORIAL_CLASS_NAME)) {
            mOtherViewHovered = true;
        }
        break;
    }
}

From source file:com.android.screenspeak.eventprocessor.ProcessorVolumeStream.java

@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    switch (event.getEventType()) {
    case AccessibilityEvent.TYPE_TOUCH_INTERACTION_START:
        mTouchingScreen = true;//from  w ww .  j  a v  a2 s  .  com
        break;
    case AccessibilityEvent.TYPE_TOUCH_INTERACTION_END:
        mTouchingScreen = false;
        break;
    }
}