Code example for SparseIntArray

Methods: append, get

0
	protected void onItemAddedToList(int position, boolean flow) {
		super.onItemAddedToList(position, flow);
 
		if (isHeaderOrFooterPosition(position) == false) {
			Column col = getNextColumn(flow, position);
			mItems.append(position, col.getIndex());
		} 
	} 
 
	@Override 
	protected void onLayoutSync(int syncPos) {
		for (Column c : mColumns) {
			c.save();
		} 
	} 
 
	@Override 
	protected void onLayoutSyncFinished(int syncPos) {
		for (Column c : mColumns) {
			c.clear();
		} 
	} 
 
	@Override 
	protected void onAdjustChildViews(boolean down) {
 
		int firstItem = getFirstVisiblePosition();
		if (down == false && firstItem == 0) {
			final int firstColumnTop = mColumns[0].getTop();
			for (Column c : mColumns) {
				final int top = c.getTop();
				c.offsetTopAndBottom(firstColumnTop - top);
			} 
		} 
		super.onAdjustChildViews(down);
	} 
 
	@Override 
	protected int getFillChildBottom() { 
		int result = Integer.MAX_VALUE;
		for (Column c : mColumns) {
			int bottom = c.getBottom();
			result = result > bottom ? bottom : result;
		} 
		return result;
	} 
 
	@Override 
	protected int getFillChildTop() { 
		int result = Integer.MIN_VALUE;
		for (Column c : mColumns) {
			int top = c.getTop();
			result = result < top ? top : result;
		} 
		return result;
	} 
 
	@Override 
	protected int getScrollChildBottom() { 
		int result = Integer.MIN_VALUE;
		for (Column c : mColumns) {
			int bottom = c.getBottom();
			result = result < bottom ? bottom : result;
		} 
		return result;
	} 
 
	@Override 
	protected int getScrollChildTop() { 
		int result = Integer.MAX_VALUE;
		for (Column c : mColumns) {
			int top = c.getTop();
			result = result > top ? top : result;
		} 
		return result;
	} 
 
	@Override 
	protected int getItemLeft(int pos) {
 
		if (isHeaderOrFooterPosition(pos))
			return mFixedColumn.getColumnLeft();
 
		return getColumnLeft(pos);
	} 
 
	@Override 
	protected int getItemTop(int pos) {
 
		if (isHeaderOrFooterPosition(pos))
			return mFixedColumn.getBottom();
 
		int colIndex = mItems.get(pos, -1);
		if (colIndex == -1)
			return getFillChildBottom(); 
 
		return mColumns[colIndex].getBottom();
	} 
 
	@Override 
	protected int getItemBottom(int pos) {
 
		if (isHeaderOrFooterPosition(pos))
			return mFixedColumn.getTop();
 
		int colIndex = mItems.get(pos, -1);
		if (colIndex == -1)
			return getFillChildTop(); 
 
		return mColumns[colIndex].getTop();
	} 
 
	private Column getNextColumn(boolean flow, int position) {
 
		int colIndex = mItems.get(position, -1);
		if (colIndex != -1) {
			return mColumns[colIndex];
		} 
 
		position = Math.max(0, position - getHeaderViewsCount());