public final class

ColumnReorderer

extends Object
implements ColumnReorderDetector.OnColumnReorderListener
java.lang.Object
   ↳ com.shinobicontrols.grids.supplement.ColumnReorderer

Class Overview

An implementation of ColumnReorderDetector.OnColumnReorderListener that reorders the list of Column objects held by the ShinobiGridView at the end of a column reordering event, that is when the user lifts up their finger. This reordering will cause the grid to be visually updated.

With row reordering the ShinobiGridView does not have control over the backing data store and therefore cannot know how to update this in response to row reorder events. With column reordering, however, as the ShinobiGridView maintains a list of its Column objects it is able to update this in response to column reorder events.

This class is one of many that are used by the RowColumnReorderManager to enable column reordering on the ShinobiGridView. In general, the RowColumnReorderManager provides a more convenient way of achieving this. However, for more specialized situations this class can be leveraged in conjunction with other classes to provide the same column reordering behavior.

Summary

Public Constructors
ColumnReorderer()
Public Methods
void onColumnIndexChanged(int columnIndex, int fromColumnIndex, int toColumnIndex, GridRecyclerView gridRecyclerView)

The callback method to be invoked during a reorder event when a column has been moved enough for it to have been deemed to have changed places with an adjacent column.

void onColumnReorderCancelled(int columnIndex, GridRecyclerView gridRecyclerView)

The callback method to be invoked when a reorder event is cancelled.

void onColumnReorderEnded(int columnIndex, int endColumnIndex, GridRecyclerView gridRecyclerView)

The callback method to be invoked when a reorder event that has been performed on a column in the grid has ended.

void onColumnReorderStarted(int columnIndex, GridRecyclerView gridRecyclerView)

The callback method to be invoked when a reorder event is started on a column in the grid.

[Expand]
Inherited Methods
From class java.lang.Object
From interface com.shinobicontrols.grids.supplement.ColumnReorderDetector.OnColumnReorderListener

Public Constructors

public ColumnReorderer ()

Public Methods

public void onColumnIndexChanged (int columnIndex, int fromColumnIndex, int toColumnIndex, GridRecyclerView gridRecyclerView)

The callback method to be invoked during a reorder event when a column has been moved enough for it to have been deemed to have changed places with an adjacent column. This will be called multiple times as the user drags their finger horizontally across the ShinobiGridView.

Parameters
columnIndex the index of the column that is being reordered
fromColumnIndex the index that the column being reordered has moved from due to dragging
toColumnIndex the index that the column being reordered has moved to due to dragging
gridRecyclerView the GridRecyclerView on which the reordering event was initiated

public void onColumnReorderCancelled (int columnIndex, GridRecyclerView gridRecyclerView)

The callback method to be invoked when a reorder event is cancelled. More specifically, this is when the column has been dragged to somewhere deemed invalid for the grid, for example, out of its bounds.

Parameters
columnIndex the index of the column that was being reordered
gridRecyclerView the GridRecyclerView on which the reordering event was initiated

public void onColumnReorderEnded (int columnIndex, int endColumnIndex, GridRecyclerView gridRecyclerView)

The callback method to be invoked when a reorder event that has been performed on a column in the grid has ended. More specifically, this will be called at the end of a drag gesture, that is when the user lifts up their finger.

If at the end of the drag gesture the column has not been dragged far enough from its original position this method will be called with both parameters being the same value.

Parameters
columnIndex the index of the column that is being reordered
endColumnIndex the index that the column being reordered has moved to at the end of the reorder event
gridRecyclerView the GridRecyclerView on which the reordering event was initiated

public void onColumnReorderStarted (int columnIndex, GridRecyclerView gridRecyclerView)

The callback method to be invoked when a reorder event is started on a column in the grid. More specifically, this will be called when the user long presses a column. For the rest of the reorder event this column will be used as the reference point.

Parameters
columnIndex the index of the column that is being reordered
gridRecyclerView the GridRecyclerView on which the reordering event was initiated