Java 类android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.CollectionItemInfoCompat 实例源码
项目:letv
文件:GridLayoutManager.java
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);
}
项目:boohee_v5.6
文件:GridLayoutManager.java
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);
}
项目:MaterialPreference
文件:PreferenceCategory.java
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfoCompat info) {
super.onInitializeAccessibilityNodeInfo(info);
CollectionItemInfoCompat existingItemInfo = info.getCollectionItemInfo();
if (existingItemInfo == null) {
return;
}
final CollectionItemInfoCompat newItemInfo = CollectionItemInfoCompat.obtain(
existingItemInfo.getRowIndex(),
existingItemInfo.getRowSpan(),
existingItemInfo.getColumnIndex(),
existingItemInfo.getColumnSpan(),
true /* heading */,
existingItemInfo.isSelected());
info.setCollectionItemInfo(newItemInfo);
}
项目:FMTech
文件:RecyclerView.java
public void onInitializeAccessibilityNodeInfoForItem(RecyclerView.Recycler paramRecycler, RecyclerView.State paramState, View paramView, AccessibilityNodeInfoCompat paramAccessibilityNodeInfoCompat)
{
int i;
if (canScrollVertically())
{
i = getPosition(paramView);
if (!canScrollHorizontally()) {
break label48;
}
}
label48:
for (int j = getPosition(paramView);; j = 0)
{
paramAccessibilityNodeInfoCompat.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain$430787b1(i, 1, j, 1, false));
return;
i = 0;
break;
}
}
项目:FLauncher
文件:AllAppsGridAdapter.java
@Override
public void onInitializeAccessibilityNodeInfoForItem(Recycler recycler,
State state, View host, AccessibilityNodeInfoCompat info) {
int viewType = getItemViewType(host);
// Only initialize on node that is meaningful. Subtract empty row count.
if (viewType == ICON_VIEW_TYPE || viewType == PREDICTION_ICON_VIEW_TYPE) {
super.onInitializeAccessibilityNodeInfoForItem(recycler, state, host, info);
CollectionItemInfoCompat itemInfo = info.getCollectionItemInfo();
if (itemInfo != null) {
final CollectionItemInfoCompat dstItemInfo = CollectionItemInfoCompat.obtain(
itemInfo.getRowIndex() - getEmptyRowForAccessibility(viewType),
itemInfo.getRowSpan(),
itemInfo.getColumnIndex(),
itemInfo.getColumnSpan(),
itemInfo.isHeading(),
itemInfo.isSelected());
info.setCollectionItemInfo(dstItemInfo);
}
}
}
项目:talkback
文件:CollectionState.java
private static boolean updateSingleTableHeader(@Nullable AccessibilityNodeInfoCompat node,
CollectionInfoCompat collectionInfo,
SparseArray<CharSequence> rowHeaders,
SparseArray<CharSequence> columnHeaders) {
if (node == null) {
return false;
}
CharSequence headingName = getHeaderText(node);
CollectionItemInfoCompat itemInfo = node.getCollectionItemInfo();
if (itemInfo != null && headingName != null) {
@RowColumnTransition int headingType = getTableHeading(itemInfo, collectionInfo);
if ((headingType & TYPE_ROW) != 0) {
rowHeaders.put(itemInfo.getRowIndex(), headingName);
}
if ((headingType & TYPE_COLUMN) != 0) {
columnHeaders.put(itemInfo.getColumnIndex(), headingName);
}
return headingType != TYPE_NONE;
}
return false;
}
项目:talkback
文件:CollectionState.java
/**
* In this method, only one cell per row and per column can be the row or column header.
* Additionally, a cell can be a row or column header but not both.
*
* @return {@code TYPE_ROW} or {@ocde TYPE_COLUMN} for row or column headers;
* {@code TYPE_INDETERMINATE} for cells marked as headers that are neither row nor column
* headers; {@code TYPE_NONE} for all other cells.
*/
private static @TableHeadingType int getTableHeading(@NonNull CollectionItemInfoCompat item,
@NonNull CollectionInfoCompat collection) {
if (item.isHeading()) {
if (item.getRowSpan() == 1 && item.getColumnSpan() == 1) {
if (getRowIndex(item, collection) == 0) {
return TYPE_COLUMN;
}
if (getColumnIndex(item, collection) == 0) {
return TYPE_ROW;
}
}
return TYPE_INDETERMINATE;
}
return TYPE_NONE;
}
项目:talkback
文件:CursorControllerAppTest.java
@MediumTest
public void testMore() {
setContentView(R.layout.cursor_test);
AccessibilityNodeInfoCompat teamsList = getNodeForId(R.id.teams_list);
AccessibilityNodeInfoCompat oldTeam = teamsList.getChild(0);
CollectionItemInfoCompat oldItemInfo = oldTeam.getCollectionItemInfo();
assertEquals(0, oldItemInfo.getRowIndex());
mCursorController.setCursor(oldTeam); // Put cursor in the list view so that it will scroll.
waitForAccessibilityIdleSync();
mCursorController.more();
waitForAccessibilityIdleSync();
// The first item in the list should have scrolled out of view. The first visible item in
// the list should now be something different.
AccessibilityNodeInfoCompat newTeam = teamsList.getChild(0);
CollectionItemInfoCompat newItemInfo = newTeam.getCollectionItemInfo();
assertNotEquals(0, newItemInfo.getRowIndex());
}
项目:letv
文件:RecyclerView.java
public void onInitializeAccessibilityNodeInfoForItem(Recycler recycler, State state, View host, AccessibilityNodeInfoCompat info) {
int rowIndexGuess;
int columnIndexGuess;
if (canScrollVertically()) {
rowIndexGuess = getPosition(host);
} else {
rowIndexGuess = 0;
}
if (canScrollHorizontally()) {
columnIndexGuess = getPosition(host);
} else {
columnIndexGuess = 0;
}
info.setCollectionItemInfo(CollectionItemInfoCompat.obtain(rowIndexGuess, 1, columnIndexGuess, 1, false, false));
}
项目:letv
文件:StaggeredGridLayoutManager.java
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);
}
项目:boohee_v5.6
文件:RecyclerView.java
public void onInitializeAccessibilityNodeInfoForItem(Recycler recycler, State state, View host, AccessibilityNodeInfoCompat info) {
int rowIndexGuess;
int columnIndexGuess;
if (canScrollVertically()) {
rowIndexGuess = getPosition(host);
} else {
rowIndexGuess = 0;
}
if (canScrollHorizontally()) {
columnIndexGuess = getPosition(host);
} else {
columnIndexGuess = 0;
}
info.setCollectionItemInfo(CollectionItemInfoCompat.obtain(rowIndexGuess, 1, columnIndexGuess, 1, false, false));
}
项目:boohee_v5.6
文件:StaggeredGridLayoutManager.java
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);
}
项目:talkback
文件:CollectionState.java
@Nullable private static ListItemState getListItemStateKitKat(
AccessibilityNodeInfoCompat collectionRoot,
AccessibilityNodeInfoCompat announcedNode,
boolean computeHeaders,
boolean computeNumbering) {
if (collectionRoot == null || collectionRoot.getCollectionInfo() == null) {
return null;
}
// Checking the ancestors should incur zero performance penalty in the typical case
// where list items are direct descendants. Assuming list items are not deeply
// nested, any performance penalty would be minimal.
AccessibilityNodeInfoCompat collectionItem = AccessibilityNodeInfoUtils
.getSelfOrMatchingAncestor(announcedNode, collectionRoot, FILTER_COLLECTION_ITEM);
if (collectionItem == null) {
return null;
}
CollectionInfoCompat collection = collectionRoot.getCollectionInfo();
CollectionItemInfoCompat item = collectionItem.getCollectionItemInfo();
boolean heading = computeHeaders && item.isHeading();
int index;
if (getCollectionAlignmentInternal(collection) == ALIGNMENT_VERTICAL) {
index = getRowIndex(item, collection);
} else {
index = getColumnIndex(item, collection);
}
collectionItem.recycle();
return new ListItemState(heading, index, computeNumbering);
}
项目:talkback
文件:CollectionState.java
@Nullable private static TableItemState getTableItemStateKitKat(
AccessibilityNodeInfoCompat collectionRoot,
AccessibilityNodeInfoCompat announcedNode,
SparseArray<CharSequence> rowHeaders,
SparseArray<CharSequence> columnHeaders,
boolean computeHeaders,
boolean computeNumbering) {
if (collectionRoot == null || collectionRoot.getCollectionInfo() == null) {
return null;
}
// Checking the ancestors should incur zero performance penalty in the typical case
// where list items are direct descendants. Assuming list items are not deeply
// nested, any performance penalty would be minimal.
AccessibilityNodeInfoCompat collectionItem = AccessibilityNodeInfoUtils
.getSelfOrMatchingAncestor(announcedNode, collectionRoot, FILTER_COLLECTION_ITEM);
if (collectionItem == null) {
return null;
}
CollectionInfoCompat collection = collectionRoot.getCollectionInfo();
CollectionItemInfoCompat item = collectionItem.getCollectionItemInfo();
int heading = computeHeaders ? getTableHeading(item, collection) : TYPE_NONE;
int rowIndex = getRowIndex(item, collection);
int columnIndex = getColumnIndex(item, collection);
CharSequence rowName = rowIndex != -1 ? rowHeaders.get(rowIndex) : null;
CharSequence columnName = columnIndex != -1 ? columnHeaders.get(columnIndex) : null;
collectionItem.recycle();
return new TableItemState(
heading,
rowName,
columnName,
rowIndex,
columnIndex,
computeNumbering);
}
项目:talkback
文件:CollectionState.java
/**
* @return -1 if there is no valid row index for the item; otherwise the item's row index
*/
private static int getRowIndex(@NonNull CollectionItemInfoCompat item,
@NonNull CollectionInfoCompat collection) {
if (item.getRowSpan() == collection.getRowCount()) {
return -1;
} else if (item.getRowIndex() < 0) {
return -1;
} else {
return item.getRowIndex();
}
}
项目:talkback
文件:CollectionState.java
/**
* @return -1 if there is no valid column index for the item; otherwise the item's column index
*/
private static int getColumnIndex(@NonNull CollectionItemInfoCompat item,
@NonNull CollectionInfoCompat collection) {
if (item.getColumnSpan() == collection.getColumnCount()) {
return -1;
} else if (item.getColumnIndex() < 0) {
return -1;
} else {
return item.getColumnIndex();
}
}
项目:talkback
文件:CursorControllerAppTest.java
@MediumTest
public void testLess() {
setContentView(R.layout.cursor_test);
final ListView teamsListView = (ListView) getViewForId(R.id.teams_list);
final int lastTeamIndex = teamsListView.getCount() - 1;
// Scroll the list view down to display the last item before beginning the test.
getInstrumentation().runOnMainSync(new Runnable() {
@Override
public void run() {
teamsListView.setSelection(lastTeamIndex);
}
});
getInstrumentation().waitForIdleSync();
waitForAccessibilityIdleSync();
AccessibilityNodeInfoCompat teamsList = getNodeForId(R.id.teams_list);
AccessibilityNodeInfoCompat oldTeam = teamsList.getChild(teamsList.getChildCount() - 1);
CollectionItemInfoCompat oldItemInfo = oldTeam.getCollectionItemInfo();
assertEquals(lastTeamIndex, oldItemInfo.getRowIndex());
mCursorController.setCursor(oldTeam); // Put cursor in the list view so that it will scroll.
waitForAccessibilityIdleSync();
mCursorController.less();
waitForAccessibilityIdleSync();
// The last item in the list should have scrolled out of view. The last visible item
// should be something different.
teamsList.refresh(); // We need to update the list view's child count.
AccessibilityNodeInfoCompat newTeam = teamsList.getChild(teamsList.getChildCount() - 1);
CollectionItemInfoCompat newItemInfo = newTeam.getCollectionItemInfo();
assertNotEquals(lastTeamIndex, newItemInfo.getRowIndex());
}
项目:FMTech
文件:GridLayoutManager.java
public final void onInitializeAccessibilityNodeInfoForItem(RecyclerView.Recycler paramRecycler, RecyclerView.State paramState, View paramView, AccessibilityNodeInfoCompat paramAccessibilityNodeInfoCompat)
{
ViewGroup.LayoutParams localLayoutParams = paramView.getLayoutParams();
if (!(localLayoutParams instanceof LayoutParams))
{
super.onInitializeAccessibilityNodeInfoForItem(paramView, paramAccessibilityNodeInfoCompat);
return;
}
LayoutParams localLayoutParams1 = (LayoutParams)localLayoutParams;
int i = getSpanGroupIndex(paramRecycler, paramState, localLayoutParams1.mViewHolder.getLayoutPosition());
if (this.mOrientation == 0)
{
int i2 = localLayoutParams1.mSpanIndex;
int i3 = localLayoutParams1.mSpanSize;
int i4 = this.mSpanCount;
boolean bool2 = false;
if (i4 > 1)
{
int i5 = localLayoutParams1.mSpanSize;
int i6 = this.mSpanCount;
bool2 = false;
if (i5 == i6) {
bool2 = true;
}
}
paramAccessibilityNodeInfoCompat.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain$430787b1(i2, i3, i, 1, bool2));
return;
}
int j = localLayoutParams1.mSpanIndex;
int k = localLayoutParams1.mSpanSize;
int m = this.mSpanCount;
boolean bool1 = false;
if (m > 1)
{
int n = localLayoutParams1.mSpanSize;
int i1 = this.mSpanCount;
bool1 = false;
if (n == i1) {
bool1 = true;
}
}
paramAccessibilityNodeInfoCompat.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain$430787b1(i, 1, j, k, bool1));
}