Example usage for android.view.accessibility AccessibilityEvent setCurrentItemIndex

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

Introduction

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

Prototype

public void setCurrentItemIndex(int currentItemIndex) 

Source Link

Document

Sets the index of the source in the list of items that can be visited.

Usage

From source file:org.chromium.chrome.browser.widget.ToolbarProgressBar.java

@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setCurrentItemIndex((int) (mTargetProgress * 100));
    event.setItemCount(100);/*from w  ww.jav a  2  s  .c  om*/
}

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

@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setItemCount(mMax);//from  w w  w .j av  a 2s  .c o  m
    event.setCurrentItemIndex(mProgress);
}

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   w w w.  j a va  2s .c o  m
    event.setCurrentItemIndex(getSelectedItemPosition());
    event.setFromIndex(getFirstVisiblePosition());
    event.setToIndex(getLastVisiblePosition());
    event.setItemCount(getCount());
}

From source file:com.albedinsky.android.ui.widget.BaseProgressBar.java

/**
 *///  w  ww.ja  v a  2  s. c o  m
@Override
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void onInitializeAccessibilityEvent(@NonNull AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setClassName(BaseProgressBar.class.getName());
    event.setItemCount(mMax);
    event.setCurrentItemIndex(mProgress);
}

From source file:com.albedinsky.android.support.ui.widget.BaseProgressBar.java

/**
 *///from   w  ww .  java 2 s  .com
@Override
public void onInitializeAccessibilityEvent(@NonNull AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setClassName(BaseProgressBar.class.getName());
    event.setItemCount(mMax);
    event.setCurrentItemIndex(mProgress);
}

From source file:com.huewu.pla.lib.internal.PLAListView.java

@Override
public boolean dispatchPopulateAccessibilityEvent(final AccessibilityEvent event) {
    final boolean populated = super.dispatchPopulateAccessibilityEvent(event);

    // If the item count is less than 15 then subtract disabled items from
    // the count and
    // position. Otherwise ignore disabled items.
    if (!populated) {
        int itemCount = 0;
        int currentItemIndex = getSelectedItemPosition();

        final ListAdapter adapter = getAdapter();
        if (adapter != null) {
            final int count = adapter.getCount();
            if (count < 15) {
                for (int i = 0; i < count; i++) {
                    if (adapter.isEnabled(i)) {
                        itemCount++;//from   ww w.j a v a2 s  .c o m
                    } else if (i <= currentItemIndex) {
                        currentItemIndex--;
                    }
                }
            } else {
                itemCount = count;
            }
        }

        event.setItemCount(itemCount);
        event.setCurrentItemIndex(currentItemIndex);
    }

    return populated;
}

From source file:com.huewu.pla.lib.internal.PLA_ListView.java

@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
    boolean populated = super.dispatchPopulateAccessibilityEvent(event);

    // If the item count is less than 15 then subtract disabled items from
    // the count and
    // position. Otherwise ignore disabled items.
    if (!populated) {
        int itemCount = 0;
        int currentItemIndex = getSelectedItemPosition();

        ListAdapter adapter = getAdapter();
        if (adapter != null) {
            final int count = adapter.getCount();
            if (count < 15) {
                for (int i = 0; i < count; i++) {
                    if (adapter.isEnabled(i)) {
                        itemCount++;/*w  w  w.j  ava2s  . co  m*/
                    } else if (i <= currentItemIndex) {
                        currentItemIndex--;
                    }
                }
            } else {
                itemCount = count;
            }
        }

        event.setItemCount(itemCount);
        event.setCurrentItemIndex(currentItemIndex);
    }

    return populated;
}

From source file:org.bangbang.support.v4.widget.HListView.java

@Override
    public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
        boolean populated = super.dispatchPopulateAccessibilityEvent(event);

        // If the item count is less than 15 then subtract disabled items from the count and
        // position. Otherwise ignore disabled items.
        if (!populated) {
            int itemCount = 0;
            int currentItemIndex = getSelectedItemPosition();

            ListAdapter adapter = getAdapter();
            if (adapter != null) {
                final int count = adapter.getCount();
                if (count < 15) {
                    for (int i = 0; i < count; i++) {
                        if (adapter.isEnabled(i)) {
                            itemCount++;
                        } else if (i <= currentItemIndex) {
                            currentItemIndex--;
                        }//from  w ww .  ja v  a2  s  . c  om
                    }
                } else {
                    itemCount = count;
                }
            }

            event.setItemCount(itemCount);
            event.setCurrentItemIndex(currentItemIndex);
        }

        return populated;
    }