Example usage for android.view.accessibility AccessibilityEvent getScrollY

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

Introduction

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

Prototype

public int getScrollY() 

Source Link

Document

Gets the scroll offset of the source top 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;
    }//w w  w.  java2 s .  c  o  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 2 s  .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;
}