Example usage for android.support.v4.util CircularIntArray getLast

List of usage examples for android.support.v4.util CircularIntArray getLast

Introduction

In this page you can find the example usage for android.support.v4.util CircularIntArray getLast.

Prototype

public int getLast() 

Source Link

Document

Get last integer of the CircularIntArray.

Usage

From source file:android.support.v17.leanback.widget.StaggeredGrid.java

@Override
public final CircularIntArray[] getItemPositionsInRows(int startPos, int endPos) {
    for (int i = 0; i < mNumRows; i++) {
        mTmpItemPositionsInRows[i].clear();
    }//from   w w w. ja  v  a 2s  .  c o  m
    if (startPos >= 0) {
        for (int i = startPos; i <= endPos; i++) {
            CircularIntArray row = mTmpItemPositionsInRows[getLocation(i).row];
            if (row.size() > 0 && row.getLast() == i - 1) {
                // update continuous range
                row.popLast();
                row.addLast(i);
            } else {
                // add single position
                row.addLast(i);
                row.addLast(i);
            }
        }
    }
    return mTmpItemPositionsInRows;
}