mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 07:29:14 +01:00
fix up-next drag and previous behaviour
- set lastPosition before seeking in jumpTo. With Dispatchers.Main .immediate the media transition runs synchronously inside the seek, so onPositionChanged saw the old position as an auto-advance and consumed the track you were leaving; previous from a queued track removed it and played the next one. - give the up-next and context sections their own reorderable states. The library only targets items whose key is in that state's reorderableKeys, so a drag can no longer target a row in the other section: no more fighting the section boundary when dragging to the top and no no-op drop below the block. - disable context reordering while shuffled via ReorderableItem(enabled).
This commit is contained in:
@@ -870,12 +870,12 @@ class PlaybackController(
|
||||
endedHandled = false
|
||||
return@withLock
|
||||
}
|
||||
lastPosition = dest
|
||||
shiftWindowLocked(dest)
|
||||
player.ensurePrepared()
|
||||
player.seekToIndex((dest - windowStart).toInt())
|
||||
if (wasEnded) player.play()
|
||||
endedHandled = false
|
||||
lastPosition = dest
|
||||
refresh(dest)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +317,11 @@ fun QueueScreen(
|
||||
var dragId by remember { mutableStateOf<Long?>(null) }
|
||||
var dragFrom by remember { mutableStateOf<Long?>(null) }
|
||||
|
||||
val reorderState =
|
||||
val upNextReorder =
|
||||
rememberReorderableLazyListState(listState) { from, to ->
|
||||
onReorder(from.index, to.index)
|
||||
}
|
||||
val contextReorder =
|
||||
rememberReorderableLazyListState(listState) { from, to ->
|
||||
onReorder(from.index, to.index)
|
||||
}
|
||||
@@ -378,10 +382,11 @@ fun QueueScreen(
|
||||
if (index == 0 || rows[index - 1].upNext != row.upNext) {
|
||||
QueueSectionHeader(if (row.upNext) "Up next" else contextTitle ?: "Next up")
|
||||
}
|
||||
val draggable = row.upNext || !shuffle
|
||||
val enabled = row.upNext || !shuffle
|
||||
ReorderableItem(
|
||||
state = reorderState,
|
||||
state = if (row.upNext) upNextReorder else contextReorder,
|
||||
key = row.id,
|
||||
enabled = enabled,
|
||||
animateItemModifier =
|
||||
Modifier.animateItem(
|
||||
fadeInSpec = tween(150),
|
||||
@@ -395,7 +400,7 @@ fun QueueScreen(
|
||||
floating = isDragging,
|
||||
coverArt = coverArt,
|
||||
dragHandle =
|
||||
if (!draggable) {
|
||||
if (!enabled) {
|
||||
null
|
||||
} else {
|
||||
Modifier.draggableHandle(
|
||||
|
||||
Reference in New Issue
Block a user