public class

RowRangeChangedNotifier

extends Object
implements RowReorderDetector.OnRowReorderListener
java.lang.Object
   ↳ com.shinobicontrols.grids.supplement.RowRangeChangedNotifier

Class Overview

Convenience class to assist with notifying a given GridRecyclerView (which implements HasGridBehavior) of a change in a range of rows.

The notifyAfterRowReorder(int, int, HasGridBehavior) method just needs to be told which row index has been moved and what row index it ended up in. It will do the necessary calculations and will call the notifyRowRangeChanged(int, int) method on the HasGridBehavior for you.

Additionally the RowRangeChangedNotifier implements the RowReorderDetector.OnRowReorderListener interface, calling the notifyAfterRowReorder(int, int, HasGridBehavior) when a row reorder event has ended. This means it can be added to a VisualRowReorderer or a RowReorderDetector to automatically notify the HasGridBehavior when a row reorder event has occurred.

Summary

Public Constructors
RowRangeChangedNotifier()
Public Methods
void notifyAfterRowReorder(int rowIndex, int endRowIndex, HasGridBehavior hasGridBehavior)

Notifies the given HasGridBehavior of a change in a range of rows based on the starting and ending row index of a row that has been reordered.

void onRowIndexChanged(int rowIndex, int fromRowIndex, int toRowIndex, GridRecyclerView gridRecyclerView)

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

void onRowReorderCancelled(int rowIndex, GridRecyclerView gridRecyclerView)

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

void onRowReorderEnded(int rowIndex, int endRowIndex, GridRecyclerView gridRecyclerView)

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

void onRowReorderStarted(int rowIndex, GridRecyclerView gridRecyclerView)

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

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

Public Constructors

public RowRangeChangedNotifier ()

Public Methods

public void notifyAfterRowReorder (int rowIndex, int endRowIndex, HasGridBehavior hasGridBehavior)

Notifies the given HasGridBehavior of a change in a range of rows based on the starting and ending row index of a row that has been reordered.

Parameters
rowIndex the index of the row that has been reordered
endRowIndex the index that the reordered row has been moved to at the end of the reorder event
hasGridBehavior the HasGridBehavior on which the reordering event was initiated, this will be a GridRecyclerView

public void onRowIndexChanged (int rowIndex, int fromRowIndex, int toRowIndex, GridRecyclerView gridRecyclerView)

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

Parameters
rowIndex the index of the row that is being reordered
fromRowIndex the index that the row being reordered has moved from due to dragging
toRowIndex the index that the row being reordered has moved to due to dragging
gridRecyclerView the GridRecyclerView on which the reordering event was initiated

public void onRowReorderCancelled (int rowIndex, GridRecyclerView gridRecyclerView)

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

Parameters
rowIndex the index of the row that was being reordered
gridRecyclerView the GridRecyclerView on which the reordering event was initiated

public void onRowReorderEnded (int rowIndex, int endRowIndex, GridRecyclerView gridRecyclerView)

The callback method to be invoked when a reorder event that is performed on a row 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 row has not been dragged far enough from its original position this method will be called with both parameters being the same value.

Parameters
rowIndex the index of the row that is being reordered
endRowIndex the index that the row being reordered has moved to at the end of the reorder event
gridRecyclerView the GridRecyclerView on which the reordering event was initiated

public void onRowReorderStarted (int rowIndex, GridRecyclerView gridRecyclerView)

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

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