[F/OS] Recycler List View Extension Upgrade - Now with Drag&Drop and ScrollBar

Hi Koders!

I’m excited to share a new extension based on the RecyclerView extension by Zain Ul Hassan. I’ve added some new features, including:

  • Drag-and-Drop: Move items within the list by dragging.
    • By long-pressing on an item.
    • By dragging the drag handle (a dedicated element within the list item).
  • Swipe Actions: Swipe list items to trigger custom actions (e.g., delete or edit).
  • Scrollbar: Smooth scrolling with a visible scrollbar.

:bookmark:New blocks
New Events

component_event

Triggered when the user starts moving an item.

Parameters
position: initial position of the dragged item

component_event (1)

Triggered when the user ends moving an item.

Parameters
startPos: initial position of the dragged item
endPos: the position of the item when the drag was completed

component_event (2)

Triggered when an item in the list is moved.

Parameters
fromPosition: Specifies the current position of the item that the user is dragging, before the list position change occurs.
toPosition: Specifies the new position of the item that is being dragged, after the next list position change occurs.

component_event (3)

Triggered when item is swiped.

Parameters
position: position of the swiped item
direction: “left” or “right” swiping

New Functions

blocks (19)
Initialize RecyclerList inside a layout with some new parameters

Important notes:

  • the Drag&Drop mechanism works well with LinearLayoutManager as layoutManager and Vertical orientation.
  • there are three dragMode options: HandlerDragMode, LongPressDragMode and NoDragMode

component_method

Get component using its id.

New Properties

blocks (20)

Change element opacity while dragging
Important note! Use this block before the block “Initialize”

component_set_get (2)

component_set_get (3)

component_set_get (4)

Set dragMode in the block “Initialize”

component_set_get (5)

Special tag for drag&drop handler. It is necessary when you use DragHandlerMode

Sample
This is a simple project that renders buttons, labels and drag handlers inside cards. When a button is pressed, the label above the list shows the text of the corresponding label inside the card.
sample

The basic description of working with the extension is given here. But it should be noted that the property DragHandleTag is used to create a component, that will be used as a drag handle. Example of using inside OnCreateView :

Example of using inside OnBindView :

Important note: If you use the drag&drop mechanism, be sure to create unique identifiers for each list element. It is strongly recommended not to use identifiers based on the element’s position.

Project Files

DragRecyclerView.aia (159.5 KB)
DragRecyclerView.apk (4.5 MB)


Download Extension

2.0.0

Latest Version


Opensource


5 Likes

thanks for updating this extension
but i tried to use baserow database in this extension doesn’t work
show problem select list item length of list

What about providing a screenshot of your relevant blocks?

Taifun

2 Likes

The Github URL is not working. You might want to correct it.

1 Like

Thank you. Corrected

its working now after using global variable and set this variable to get values after got column from baserow
because i don’t want to use index variable and i need to get all columns at the same time
Thanks

1 Like

glad to hear that everything is working well

1 Like