public interface

ExpandableDraggableItemAdapter

com.h6ah4i.android.widget.advrecyclerview.expandable.ExpandableDraggableItemAdapter<GVH extends android.support.v7.widget.RecyclerView.ViewHolder, CVH extends android.support.v7.widget.RecyclerView.ViewHolder>

Summary

Public Methods
abstract boolean onCheckChildCanDrop(int draggingGroupPosition, int draggingChildPosition, int dropGroupPosition, int dropChildPosition)
Called while dragging in order to check whether the dragging item can be dropped to the specified position.
abstract boolean onCheckChildCanStartDrag(CVH holder, int groupPosition, int childPosition, int x, int y)
Called when user is attempt to drag the child item.
abstract boolean onCheckGroupCanDrop(int draggingGroupPosition, int dropGroupPosition)
Called while dragging in order to check whether the dragging item can be dropped to the specified position.
abstract boolean onCheckGroupCanStartDrag(GVH holder, int groupPosition, int x, int y)
Called when user is attempt to drag the group item.
abstract ItemDraggableRange onGetChildItemDraggableRange(CVH holder, int groupPosition, int childPosition)
abstract ItemDraggableRange onGetGroupItemDraggableRange(GVH holder, int groupPosition)
abstract void onMoveChildItem(int fromGroupPosition, int fromChildPosition, int toGroupPosition, int toChildPosition)
Called when child item is moved.
abstract void onMoveGroupItem(int fromGroupPosition, int toGroupPosition)
Called when group item is moved.

Public Methods

public abstract boolean onCheckChildCanDrop (int draggingGroupPosition, int draggingChildPosition, int dropGroupPosition, int dropChildPosition)

Called while dragging in order to check whether the dragging item can be dropped to the specified position. NOTE: This method will be called when the checkCanDrop option is enabled by setCheckCanDropEnabled(boolean).

Parameters
draggingGroupPosition The group position of the currently dragging item.
draggingChildPosition The child position of the currently dragging item.
dropGroupPosition The group position to check whether the dragging item can be dropped or not.
dropChildPosition The child position to check whether the dragging item can be dropped or not.
Returns
  • Whether can be dropped to the specified position.

public abstract boolean onCheckChildCanStartDrag (CVH holder, int groupPosition, int childPosition, int x, int y)

Called when user is attempt to drag the child item.

Parameters
holder The child ViewHolder which is associated to item user is attempt to start dragging.
groupPosition Group position.
childPosition Child position.
x Touched X position. Relative from the itemView's top-left.
y Touched Y position. Relative from the itemView's top-left.
Returns
  • Whether can start dragging.

public abstract boolean onCheckGroupCanDrop (int draggingGroupPosition, int dropGroupPosition)

Called while dragging in order to check whether the dragging item can be dropped to the specified position. NOTE: This method will be called when the checkCanDrop option is enabled by setCheckCanDropEnabled(boolean).

Parameters
draggingGroupPosition The position of the currently dragging group item.
dropGroupPosition The position of a group item whether to check can be dropped or not.
Returns
  • Whether can be dropped to the specified position.

public abstract boolean onCheckGroupCanStartDrag (GVH holder, int groupPosition, int x, int y)

Called when user is attempt to drag the group item.

Parameters
holder The group ViewHolder which is associated to item user is attempt to start dragging.
groupPosition Group position.
x Touched X position. Relative from the itemView's top-left.
y Touched Y position. Relative from the itemView's top-left.
Returns
  • Whether can start dragging.

public abstract ItemDraggableRange onGetChildItemDraggableRange (CVH holder, int groupPosition, int childPosition)

Parameters
holder The ViewHolder which is associated to item user is attempt to start dragging.
groupPosition Group position.
childPosition Child position.
Returns
  • null: no constraints (= new ItemDraggableRange(0, getGroupCount() - 1)), otherwise: the range specified item can be drag-sortable.

public abstract ItemDraggableRange onGetGroupItemDraggableRange (GVH holder, int groupPosition)

Parameters
holder The ViewHolder which is associated to item user is attempt to start dragging.
groupPosition Group position.
Returns
  • null: no constraints (= new ItemDraggableRange(0, getGroupCount() - 1)), otherwise: the range specified item can be drag-sortable.

public abstract void onMoveChildItem (int fromGroupPosition, int fromChildPosition, int toGroupPosition, int toChildPosition)

Called when child item is moved. Should apply the move operation result to data set.

Parameters
fromGroupPosition Previous group position of the item.
fromChildPosition Previous child position of the item.
toGroupPosition New group position of the item.
toChildPosition New child position of the item.

public abstract void onMoveGroupItem (int fromGroupPosition, int toGroupPosition)

Called when group item is moved. Should apply the move operation result to data set.

Parameters
fromGroupPosition Previous group position of the item.
toGroupPosition New group position of the item.