woxblom / DragListView

Drag and drop to reorder items in a list, grid or board for Android. Based on RecyclerView. Also supports swiping items in a list.
Apache License 2.0
693 stars 177 forks source link

how to swap items between two columns #181

Closed Ditscheridou closed 3 years ago

Ditscheridou commented 3 years ago

Hi,

i have a BoardView with the following configuration: column x with row 0,1,2 and column 1 with row 0,1,2. Each column has a own DragItemAdapter. A view look like this: x y 0 0 1 1 2 2

So lets say i want always to swap item x,1 with item y,2. Is this currently supported? I tried a few things, but didn't manage to achieve this behavior. The framework always insert the value instead of swapping it.

woxblom commented 3 years ago

There is no direct method that does this. But I guess you could get the adapter of both the columns and then call removeItem(pos) on both and then addItem(pos, item) on both.