Java Code Examples for android.support.v4.view.accessibility.AccessibilityNodeInfoCompat#setCollectionItemInfo()

The following examples show how to use android.support.v4.view.accessibility.AccessibilityNodeInfoCompat#setCollectionItemInfo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GridLayoutManager.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfoForItem(RecyclerView.Recycler recycler,
        RecyclerView.State state, View host, AccessibilityNodeInfoCompat info) {
    ViewGroup.LayoutParams lp = host.getLayoutParams();
    if (!(lp instanceof LayoutParams)) {
        super.onInitializeAccessibilityNodeInfoForItem(host, info);
        return;
    }
    LayoutParams glp = (LayoutParams) lp;
    int spanGroupIndex = getSpanGroupIndex(recycler, state, glp.getViewLayoutPosition());
    if (mOrientation == HORIZONTAL) {
        info.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(
                glp.getSpanIndex(), glp.getSpanSize(),
                spanGroupIndex, 1,
                mSpanCount > 1 && glp.getSpanSize() == mSpanCount, false));
    } else { // VERTICAL
        info.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(
                spanGroupIndex , 1,
                glp.getSpanIndex(), glp.getSpanSize(),
                mSpanCount > 1 && glp.getSpanSize() == mSpanCount, false));
    }
}
 
Example 2
Source File: StaggeredGridLayoutManager.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfoForItem(RecyclerView.Recycler recycler,
        RecyclerView.State state, View host, AccessibilityNodeInfoCompat info) {
    ViewGroup.LayoutParams lp = host.getLayoutParams();
    if (!(lp instanceof LayoutParams)) {
        super.onInitializeAccessibilityNodeInfoForItem(host, info);
        return;
    }
    LayoutParams sglp = (LayoutParams) lp;
    if (mOrientation == HORIZONTAL) {
        info.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(
                sglp.getSpanIndex(), sglp.mFullSpan ? mSpanCount : 1,
                -1, -1,
                sglp.mFullSpan, false));
    } else { // VERTICAL
        info.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(
                -1, -1,
                sglp.getSpanIndex(), sglp.mFullSpan ? mSpanCount : 1,
                sglp.mFullSpan, false));
    }
}
 
Example 3
Source File: GridLayoutManager.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfoForItem(RecyclerView.Recycler recycler,
        RecyclerView.State state, View host, AccessibilityNodeInfoCompat info) {
    ViewGroup.LayoutParams lp = host.getLayoutParams();
    if (!(lp instanceof LayoutParams)) {
        super.onInitializeAccessibilityNodeInfoForItem(host, info);
        return;
    }
    LayoutParams glp = (LayoutParams) lp;
    int spanGroupIndex = getSpanGroupIndex(recycler, state, glp.getViewLayoutPosition());
    if (mOrientation == HORIZONTAL) {
        info.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(
                glp.getSpanIndex(), glp.getSpanSize(),
                spanGroupIndex, 1,
                mSpanCount > 1 && glp.getSpanSize() == mSpanCount, false));
    } else { // VERTICAL
        info.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(
                spanGroupIndex , 1,
                glp.getSpanIndex(), glp.getSpanSize(),
                mSpanCount > 1 && glp.getSpanSize() == mSpanCount, false));
    }
}
 
Example 4
Source File: StaggeredGridLayoutManager.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfoForItem(RecyclerView.Recycler recycler,
        RecyclerView.State state, View host, AccessibilityNodeInfoCompat info) {
    ViewGroup.LayoutParams lp = host.getLayoutParams();
    if (!(lp instanceof LayoutParams)) {
        super.onInitializeAccessibilityNodeInfoForItem(host, info);
        return;
    }
    LayoutParams sglp = (LayoutParams) lp;
    if (mOrientation == HORIZONTAL) {
        info.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(
                sglp.getSpanIndex(), sglp.mFullSpan ? mSpanCount : 1,
                -1, -1,
                sglp.mFullSpan, false));
    } else { // VERTICAL
        info.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(
                -1, -1,
                sglp.getSpanIndex(), sglp.mFullSpan ? mSpanCount : 1,
                sglp.mFullSpan, false));
    }
}
 
Example 5
Source File: AllAppsGridAdapter.java    From LaunchEnr with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfoForItem(RecyclerView.Recycler recycler,
        RecyclerView.State state, View host, AccessibilityNodeInfoCompat info) {
    super.onInitializeAccessibilityNodeInfoForItem(recycler, state, host, info);

    ViewGroup.LayoutParams lp = host.getLayoutParams();
    AccessibilityNodeInfoCompat.CollectionItemInfoCompat cic = info.getCollectionItemInfo();
    if (!(lp instanceof LayoutParams) || (cic == null)) {
        return;
    }
    LayoutParams glp = (LayoutParams) lp;
    info.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(
            cic.getRowIndex() - getRowsNotForAccessibility(glp.getViewAdapterPosition()),
            cic.getRowSpan(),
            cic.getColumnIndex(),
            cic.getColumnSpan(),
            cic.isHeading(),
            cic.isSelected()));
}
 
Example 6
Source File: GridLayoutManager.java    From letv with Apache License 2.0 6 votes vote down vote up
public void onInitializeAccessibilityNodeInfoForItem(Recycler recycler, State state, View host, AccessibilityNodeInfoCompat info) {
    android.view.ViewGroup.LayoutParams lp = host.getLayoutParams();
    if (lp instanceof LayoutParams) {
        LayoutParams glp = (LayoutParams) lp;
        int spanGroupIndex = getSpanGroupIndex(recycler, state, glp.getViewLayoutPosition());
        if (this.mOrientation == 0) {
            int spanIndex = glp.getSpanIndex();
            int spanSize = glp.getSpanSize();
            boolean z = this.mSpanCount > 1 && glp.getSpanSize() == this.mSpanCount;
            info.setCollectionItemInfo(CollectionItemInfoCompat.obtain(spanIndex, spanSize, spanGroupIndex, 1, z, false));
            return;
        }
        int spanIndex2 = glp.getSpanIndex();
        int spanSize2 = glp.getSpanSize();
        boolean z2 = this.mSpanCount > 1 && glp.getSpanSize() == this.mSpanCount;
        info.setCollectionItemInfo(CollectionItemInfoCompat.obtain(spanGroupIndex, 1, spanIndex2, spanSize2, z2, false));
        return;
    }
    super.onInitializeAccessibilityNodeInfoForItem(host, info);
}
 
Example 7
Source File: GridLayoutManager.java    From adt-leanback-support with Apache License 2.0 6 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfoForItem(RecyclerView.Recycler recycler,
        RecyclerView.State state, View host, AccessibilityNodeInfoCompat info) {
    ViewGroup.LayoutParams lp = host.getLayoutParams();
    if (!(lp instanceof LayoutParams)) {
        super.onInitializeAccessibilityNodeInfoForItem(host, info);
        return;
    }
    LayoutParams glp = (LayoutParams) lp;
    int spanGroupIndex = getSpanGroupIndex(recycler, state, glp.getViewPosition());
    if (mOrientation == HORIZONTAL) {
        info.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(
                glp.getSpanIndex(), glp.getSpanSize(),
                spanGroupIndex, 1,
                mSpanCount > 1 && glp.getSpanSize() == mSpanCount, false));
    } else { // VERTICAL
        info.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(
                spanGroupIndex , 1,
                glp.getSpanIndex(), glp.getSpanSize(),
                mSpanCount > 1 && glp.getSpanSize() == mSpanCount, false));
    }
}
 
Example 8
Source File: StaggeredGridLayoutManager.java    From adt-leanback-support with Apache License 2.0 6 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfoForItem(RecyclerView.Recycler recycler,
        RecyclerView.State state, View host, AccessibilityNodeInfoCompat info) {
    ViewGroup.LayoutParams lp = host.getLayoutParams();
    if (!(lp instanceof LayoutParams)) {
        super.onInitializeAccessibilityNodeInfoForItem(host, info);
        return;
    }
    LayoutParams sglp = (LayoutParams) lp;
    if (mOrientation == HORIZONTAL) {
        info.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(
                sglp.getSpanIndex(), sglp.mFullSpan ? mSpanCount : 1,
                -1, -1,
                sglp.mFullSpan, false));
    } else { // VERTICAL
        info.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(
                -1, -1,
                sglp.getSpanIndex(), sglp.mFullSpan ? mSpanCount : 1,
                sglp.mFullSpan, false));
    }
}
 
Example 9
Source File: StaggeredGridLayoutManager.java    From letv with Apache License 2.0 5 votes vote down vote up
public void onInitializeAccessibilityNodeInfoForItem(Recycler recycler, State state, View host, AccessibilityNodeInfoCompat info) {
    android.view.ViewGroup.LayoutParams lp = host.getLayoutParams();
    if (lp instanceof LayoutParams) {
        LayoutParams sglp = (LayoutParams) lp;
        if (this.mOrientation == 0) {
            info.setCollectionItemInfo(CollectionItemInfoCompat.obtain(sglp.getSpanIndex(), sglp.mFullSpan ? this.mSpanCount : 1, -1, -1, sglp.mFullSpan, false));
            return;
        } else {
            info.setCollectionItemInfo(CollectionItemInfoCompat.obtain(-1, -1, sglp.getSpanIndex(), sglp.mFullSpan ? this.mSpanCount : 1, sglp.mFullSpan, false));
            return;
        }
    }
    super.onInitializeAccessibilityNodeInfoForItem(host, info);
}