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

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

Introduction

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

Prototype

public void addLast(int e) 

Source Link

Document

Add an integer at end 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();
    }/*  w w w.  jav  a 2s .  c om*/
    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;
}