Example usage for android.view.accessibility AccessibilityEvent setToIndex

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

Introduction

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

Prototype

public void setToIndex(int toIndex) 

Source Link

Document

Sets the index of text selection end or the index of the last visible item when scrolling.

Usage

From source file:com.codetroopers.betterpickers.calendardatepicker.YearPickerView.java

@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED) {
        event.setFromIndex(0);/*from  w  ww.java 2s .c  o  m*/
        event.setToIndex(0);
    }
}

From source file:com.actionbarsherlock.internal.widget.IcsAdapterView.java

@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setScrollable(isScrollableForAccessibility());
    View selectedView = getSelectedView();
    if (selectedView != null) {
        event.setEnabled(selectedView.isEnabled());
    }//from   ww  w. j  a va2  s  . c  om
    event.setCurrentItemIndex(getSelectedItemPosition());
    event.setFromIndex(getFirstVisiblePosition());
    event.setToIndex(getLastVisiblePosition());
    event.setItemCount(getCount());
}

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

/**
 * Resets the focused task./*from   w  w w.j  a v  a2  s. c  o 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));
}

From source file:com.android.launcher2.PagedView.java

@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setScrollable(true);//from www . j a  va2 s.  c o m
    if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED) {
        event.setFromIndex(mCurrentPage);
        event.setToIndex(mCurrentPage);
        event.setItemCount(getChildCount());
    }
}

From source file:com.android.internal.widget.ViewPager.java

@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);

    event.setClassName(ViewPager.class.getName());
    event.setScrollable(canScroll());//from   w  w  w .ja  v  a  2  s . c o  m

    if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED && mAdapter != null) {
        event.setItemCount(mAdapter.getCount());
        event.setFromIndex(mCurItem);
        event.setToIndex(mCurItem);
    }
}