public class

ItemPositionUpdater

extends Object
java.lang.Object
   ↳ com.shinobicontrols.grids.supplement.ItemPositionUpdater

Class Overview

Convenience class to provide an updated series of item positions, following a row or column reorder. In most cases the item positions which are updated will be those of items that have been selected or hidden. The ItemStateManager, for example, makes use of this class to ensure consistency of hidden items after a row or column reorder event.

Note: This class does not update any item positions on the ShinobiGridView. It provides an updated series of item positions, which can then be used to perform update operations on the ShinobiGridView.

Summary

Public Constructors
ItemPositionUpdater()
Public Methods
int[] getUpdatedPositionsAfterColumnReorder(int columnIndex, int endColumnIndex, GridRecyclerView gridRecyclerView, int[] positionsOfItemsBeforeColumnReorder)

Returns the updated positions of items on the ShinobiGridView following a column reorder.

int[] getUpdatedPositionsAfterRowReorder(int rowIndex, int endRowIndex, GridRecyclerView gridRecyclerView, int[] positionsOfItemsBeforeRowReorder)

Returns the updated positions of items on the ShinobiGridView following a row reorder.

[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ItemPositionUpdater ()

Public Methods

public int[] getUpdatedPositionsAfterColumnReorder (int columnIndex, int endColumnIndex, GridRecyclerView gridRecyclerView, int[] positionsOfItemsBeforeColumnReorder)

Returns the updated positions of items on the ShinobiGridView following a column reorder. In most cases the item positions which are updated will be those of items that have been selected or hidden.

Typically this method will be useful when updating the positions of selected or hidden items, following a column reorder.

Note: This method does not update any item positions on the ShinobiGridView, nor does it check that the given values for columnIndex and endColumnIndex exist in the grid beyond checking they are non-negative and not equal. It provides an updated series of item positions, which can then be used to perform update operations on the ShinobiGridView.

Parameters
columnIndex the index of the column at the start of the column reorder
endColumnIndex the index of the column at the end of the column reorder
gridRecyclerView the GridRecyclerView whose columns have been reordered
positionsOfItemsBeforeColumnReorder the positions of the items before the column reorder occurred, these will remain unchanged
Returns
  • a new array containing the updated positions of the items, taking into account the column reorder

public int[] getUpdatedPositionsAfterRowReorder (int rowIndex, int endRowIndex, GridRecyclerView gridRecyclerView, int[] positionsOfItemsBeforeRowReorder)

Returns the updated positions of items on the ShinobiGridView following a row reorder. In most cases the item positions which are updated will be those of items that have been selected or hidden.

Typically this method will be useful when updating the positions of selected or hidden items, following a row reorder.

Note: This method does not update any item positions on the ShinobiGridView, nor does it check that the given values for rowIndex and endRowIndex exist in the grid beyond checking they are non-negative and not equal. It provides an updated series of item positions, which can then be used to perform update operations on the ShinobiGridView.

Parameters
rowIndex the index of the row at the start of the row reorder
endRowIndex the index of the row at the end of the row reorder
gridRecyclerView the GridRecyclerView whose rows have been reordered
positionsOfItemsBeforeRowReorder the positions of the items before the row reorder occurred, these will remain unchanged
Returns
  • a new array containing the updated positions of the items, taking into account the row reorder