Example usage for android.view.accessibility AccessibilityEvent getScrollX

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

Introduction

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

Prototype

public int getScrollX() 

Source Link

Document

Gets the scroll offset of the source left edge in pixels.

Usage

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

private int getScrollDirection(AccessibilityEvent event) {
    //check scroll of AdapterViews
    if (event.getFromIndex() > mLastScrollFromIndex || event.getToIndex() > mLastScrollToIndex) {
        return MOVING_FORWARDS;
    } else if (event.getFromIndex() < mLastScrollFromIndex || event.getToIndex() < mLastScrollToIndex) {
        return MOVING_BACKWARDS;
    }//from  www  .j  a v  a2 s  . co m

    //check scroll of ScrollViews
    if (event.getScrollX() > mLastScrollX || event.getScrollY() > mLastScrollY) {
        return MOVING_FORWARDS;
    } else if (event.getScrollX() < mLastScrollX || event.getScrollY() < mLastScrollY) {
        return MOVING_BACKWARDS;
    }

    return MOVING_UNDEFINED_DIRECTION;
}

From source file:com.android.talkback.eventprocessor.ProcessorFocusAndSingleTap.java

private @TraversalStrategy.SearchDirectionOrUnknown int getScrollDirection(AccessibilityEvent event) {
    //check scroll of AdapterViews
    if (event.getFromIndex() > mLastScrollFromIndex || event.getToIndex() > mLastScrollToIndex) {
        return TraversalStrategy.SEARCH_FOCUS_FORWARD;
    } else if (event.getFromIndex() < mLastScrollFromIndex || event.getToIndex() < mLastScrollToIndex) {
        return TraversalStrategy.SEARCH_FOCUS_BACKWARD;
    }// w  w  w . ja v  a  2s. c o m

    //check scroll of ScrollViews
    if (event.getScrollX() > mLastScrollX || event.getScrollY() > mLastScrollY) {
        return TraversalStrategy.SEARCH_FOCUS_FORWARD;
    } else if (event.getScrollX() < mLastScrollX || event.getScrollY() < mLastScrollY) {
        return TraversalStrategy.SEARCH_FOCUS_BACKWARD;
    }

    return TraversalStrategy.SEARCH_FOCUS_UNKNOWN;
}