Methods Summary |
---|
protected final android.support.v17.leanback.widget.StaggeredGrid$Location | appendItemToRow(int itemIndex, int rowIndex)
Location loc = new Location(rowIndex);
if (mLocations.size() == 0) {
mFirstIndex = itemIndex;
}
mLocations.addLast(loc);
mProvider.createItem(itemIndex, rowIndex, true);
return loc;
|
public abstract void | appendItems(int toLimit)Append items until the high edge reaches upTo.
|
public final void | debugPrint(java.io.PrintWriter pw)
for (int i = 0, size = mLocations.size(); i < size; i++) {
Location loc = mLocations.get(i);
pw.print("<" + (mFirstIndex + i) + "," + loc.row + ">");
pw.print(" ");
pw.println();
}
|
public final int | getFirstIndex()Returns the first index in the staggered grid.
return mFirstIndex;
|
public final java.util.List[] | getItemPositionsInRows(int startPos, int endPos)Return array of Lists for all rows, each List contains item positions
on that row between startPos(included) and endPositions(included).
Returned value is read only, do not change it.
for (int i = 0; i < mNumRows; i++) {
mTmpItemPositionsInRows[i].clear();
}
if (startPos >= 0) {
for (int i = startPos; i <= endPos; i++) {
mTmpItemPositionsInRows[getLocation(i).row].add(i);
}
}
return mTmpItemPositionsInRows;
|
public final int | getLastIndex()Returns the last index in the staggered grid.
return mFirstIndex + mLocations.size() - 1;
|
public final android.support.v17.leanback.widget.StaggeredGrid$Location | getLocation(int index)Returns the {@link Location} at the given index.
if (mLocations.size() == 0) {
return null;
}
return mLocations.get(index - mFirstIndex);
|
protected final int | getMaxHighRowIndex()
int maxHighRowIndex = 0;
for (int i = 1; i < mNumRows; i++) {
if (mRows[i].high > mRows[maxHighRowIndex].high) {
maxHighRowIndex = i;
}
}
return maxHighRowIndex;
|
protected final int | getMaxLowRowIndex()
int maxLowRowIndex = 0;
for (int i = 1; i < mNumRows; i++) {
if (mRows[i].low > mRows[maxLowRowIndex].low) {
maxLowRowIndex = i;
}
}
return maxLowRowIndex;
|
protected final int | getMinHighRowIndex()
int minHighRowIndex = 0;
for (int i = 1; i < mNumRows; i++) {
if (mRows[i].high < mRows[minHighRowIndex].high) {
minHighRowIndex = i;
}
}
return minHighRowIndex;
|
protected final int | getMinLowRowIndex()
int minLowRowIndex = 0;
for (int i = 1; i < mNumRows; i++) {
if (mRows[i].low < mRows[minLowRowIndex].low) {
minLowRowIndex = i;
}
}
return minLowRowIndex;
|
public final int | getNumRows()Returns the number of rows in the staggered grid.
return mNumRows;
|
public final int | getSize()Returns the size of the saved {@link Location}s.
return mLocations.size();
|
protected final android.support.v17.leanback.widget.StaggeredGrid$Location | prependItemToRow(int itemIndex, int rowIndex)
Location loc = new Location(rowIndex);
mFirstIndex = itemIndex;
mLocations.addFirst(loc);
mProvider.createItem(itemIndex, rowIndex, false);
return loc;
|
public abstract void | prependItems(int toLimit)Prepend items until the low edge reaches downTo.
|
public final void | removeFirst()Removes the first element.
mFirstIndex++;
mLocations.popFirst();
|
public final void | removeLast()Removes the last element.
mLocations.popLast();
|
public void | setProvider(android.support.v17.leanback.widget.StaggeredGrid$Provider provider)Sets the {@link Provider} for this staggered grid.
mProvider = provider;
|
public void | setReversedFlow(boolean reversedFlow)
mReversedFlow = reversedFlow;
|
public final void | setRows(android.support.v17.leanback.widget.StaggeredGrid$Row[] row)Sets the array of {@link Row}s to fill into. For views that represent a
horizontal list, this will be the rows of the view. For views that
represent a vertical list, this will be the columns.
if (row == null || row.length == 0) {
throw new IllegalArgumentException();
}
mNumRows = row.length;
mRows = row;
mTmpItemPositionsInRows = new ArrayList[mNumRows];
for (int i = 0; i < mNumRows; i++) {
mTmpItemPositionsInRows[i] = new ArrayList(32);
}
|
public final void | setStart(int startIndex, int startRow)Set the first item index and the row index to load when there are no
items.
mStartIndex = startIndex;
mStartRow = startRow;
|
public abstract void | stripDownTo(int itemIndex)Strip items, keep a contiguous subset of items; the subset should include
at least one item on every row that currently has at least one item.
TODO: document this better
|