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

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

Introduction

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

Prototype

public int popLast() 

Source Link

Document

Remove last integer from end of the CircularIntArray and return it.

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   ww  w.  jav a 2s  . com*/
    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;
}