https://kotlinlang.org logo
h

Hristijan

09/12/2023, 11:56 AM
Hey guys, does anyone know if it's possible to long press at two LazyList items simulationsly and select them and all those between them Let's say we have 6 items, I long press on 1 and 4, that means 1,2,3,4 need to be selected
c

curioustechizen

09/12/2023, 12:02 PM
h

Hristijan

09/12/2023, 12:03 PM
I know that, but that is a dragging implementation which is not the same as my use case, my use case is just two clicks at the same time on different positions in the list and selecting everything in between
a

ascii

09/12/2023, 12:09 PM
How you achieve this isn't really Compose-specific, but you could save index on long press (
combinedClickable
), and based on bounds, select everything else in between. Item selection state can depend on these saved indices (e.g.
if (index in <range>)
)
c

curioustechizen

09/12/2023, 12:10 PM
Right I did not mean this is specific to your use case. You can use it for inspiration though.
h

Hristijan

09/12/2023, 12:11 PM
@ascii even if those two items are clicked at the same time?
a

ascii

09/12/2023, 12:39 PM
I don't see why that would change anything. What have you tried so far?
☝️ 1
👍 1