I have a RecyclerView that uses an ItemTouchHelper. However, items do not move when I attempt to drag them. In my ItemTouchHelper, OnMove is called (and it does return true), and GetMovementFlags includes ActionStateDrag as part of it's MakeFlag. While I am attempting to drag the item that I am attempting to drag, the other items move as expected (the RecyclerView is used to allow the user to reorder the items), but the item being dragged does not move, although it is moved in the Adapter. Here is my OnMove method:
public override bool OnMove(RecyclerView rv, RecyclerView.ViewHolder dragged, RecyclerView.ViewHolder target)
{
int draggedindex = dragged.AdapterPosition;
int targetindex = target.AdapterPosition;
if (targetindex < ((rv.GetAdapter() as PlayerNameInputAdapter).ItemCount - 1))
{
(rv.GetAdapter() as PlayerNameInputAdapter).Players.Move(draggedindex, targetindex);
(rv.GetAdapter() as PlayerNameInputAdapter).NotifyItemMoved(draggedindex, targetindex);
}
return true;
}
After dragging has completed, the (not) dragged item remains in it's original position, although it is moved in the Adapter. What is the problem?