1.7 KiB
1.7 KiB
Issue #19: Add drag-and-drop song reordering in the GUI
Summary
Add drag-and-drop reordering of songs in the GUI song list. When songs.order is "manual", users can drag songs to rearrange them. The custom order is passed to the pipeline at build time. When order is "alphabetical", drag-and-drop is disabled with a hint.
AC Verification Checklist
- Songs can be reordered via drag-and-drop
- Reordered list is used when building (overrides config order)
- Visual indicator shows drop target (highlight)
- Order can be reset via a button
- Reordering only enabled when songs.order is "manual"
- When alphabetical, list shows alphabetical order and drag is disabled (with hint)
- GUI remains responsive during drag operations
Implementation Steps
Step 1: Add customSongOrder parameter to SongbookPipeline.build()
Add an optional customSongOrder: List<String>? = null parameter. When provided, use this ordered list of file names to sort the parsed songs instead of the config-based sort.
Step 2: Create ReorderableSongList composable
Build a song list that supports drag-and-drop reordering:
- Use
detectDragGesturesAfterLongPresson each item to detect drag start - Track the dragged item index and current hover position
- Show a visual indicator (highlighted background) at the drop target
- On drop, reorder the list
Step 3: Integrate into App.kt
- Track
songsOrderconfig value ("alphabetical" or "manual") - Track
originalSongslist (from file loading) to support reset - When manual: enable drag-and-drop, show reset button
- When alphabetical: disable drag-and-drop, show hint
- Pass custom order (file names) to pipeline on build
Step 4: Add reset button
"Reihenfolge zurücksetzen" button restores songs to originalSongs.