Example usage for android.view.accessibility AccessibilityEvent setScrollY

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

Introduction

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

Prototype

public void setScrollY(int scrollY) 

Source Link

Document

Sets the scroll offset of the source top edge in pixels.

Usage

From source file:me.lizheng.deckview.views.DeckView.java

/**
 * Resets the focused task./*w w  w. ja  v  a 2 s.  co m*/
 */
//    void resetFocusedTask() {
//        if ((0 <= mFocusedTaskIndex) && (mFocusedTaskIndex < mCallback.getData().size())) {
//            DeckChildView tv = getChildViewForTask(mCallback.getData().get(mFocusedTaskIndex));
//            if (tv != null) {
//                tv.unsetFocusedTask();
//            }
//        }
//        mFocusedTaskIndex = -1;
//    }

@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    int childCount = getChildCount();
    if (childCount > 0) {
        @SuppressWarnings("unchecked")
        DeckChildView<T> backMostTask = (DeckChildView) getChildAt(0);
        @SuppressWarnings("unchecked")
        DeckChildView<T> frontMostTask = (DeckChildView) getChildAt(childCount - 1);
        event.setFromIndex(mCallback.getData().indexOf(backMostTask.getAttachedKey()));
        event.setToIndex(mCallback.getData().indexOf(frontMostTask.getAttachedKey()));
    }
    event.setItemCount(mCallback.getData().size());
    event.setScrollY(mStackScroller.mScroller.getCurrY());
    //        event.setMaxScrollY(mStackScroller.progressToScrollRange(mLayoutAlgorithm.mMaxScrollP));
}