This PR improves drag & drop by merging the best ideas from the previous DragDropManager and ItemTouchHelper into a new class with a new workflow, DragDropHelper. There's also a tiny fix to StickyHeadersLinearLayoutManager's position tracking on moves, detected while implementing it.
Reasons for not sticking with DragDropManager:
Fairly complex
Uses a Bitmap and not the view itself, which makes the workflow more complex and results in a ton of limitations
Reasons for not sticking with ItemTouchHelper:
Fairly complex
Lots of supported features, which cripples some interactions of the drag & drop itself
Buggy when swapping fast, even on simple lists (I don't think their prepareForDrop workflow is working as well as they think...)
What does DragDropHelper bring to the table:
Much simpler implementation than both DragDropManager (multiple classes, 220% larger) and `ItemTouchHelper (single class, but 421% larger)
Nice callback workflow like ItemTouchHelper
Stable and functional implementation, for simple and complex lists, like DragDropManager
What does DragDropHelper NOT bring to the table:
Support for all built-in LayoutManagers. This would be doable, but supporting LinearLayoutManager is good enough for most cases and massively simplifies things.
This PR improves drag & drop by merging the best ideas from the previous
DragDropManager
andItemTouchHelper
into a new class with a new workflow,DragDropHelper
. There's also a tiny fix toStickyHeadersLinearLayoutManager
's position tracking on moves, detected while implementing it.Reasons for not sticking with
DragDropManager
:Bitmap
and not the view itself, which makes the workflow more complex and results in a ton of limitationsReasons for not sticking with
ItemTouchHelper
:prepareForDrop
workflow is working as well as they think...)What does
DragDropHelper
bring to the table:DragDropManager
(multiple classes, 220% larger) and `ItemTouchHelper (single class, but 421% larger)ItemTouchHelper
DragDropManager
What does
DragDropHelper
NOT bring to the table:LayoutManager
s. This would be doable, but supportingLinearLayoutManager
is good enough for most cases and massively simplifies things.Thanks for reviewing!