feat: drag-to-reorder queue and a compact mobile player
- long-press and drag queue rows, with auto-scroll near the edges - pin the now-playing row above the upcoming queue - move add-to-mood actions into an overflow menu so the title and artist get the full width on narrow phones
This commit is contained in:
1 parent
3b40726edb
commit
a63ee62673
3 files changed
+201
-42
No files matched your search
@@ -40,10 +40,13 @@ a server-driven radio session and songs are added from Deezer or YouTube Music.
|
|||||||
- Two add-to-mood actions in the player:
|
- Two add-to-mood actions in the player:
|
||||||
- **Add to current mood** (the mood of the active radio session)
|
- **Add to current mood** (the mood of the active radio session)
|
||||||
- **Choose another mood** (picker)
|
- **Choose another mood** (picker)
|
||||||
- A queue sheet from the player: the current track plus every upcoming track,
|
- A queue sheet from the player: the current track is pinned, upcoming tracks
|
||||||
with move up/down and remove. Changes are persisted locally.
|
can be reordered by **long-press and drag** or removed. Changes are persisted
|
||||||
|
locally.
|
||||||
- **Previous** from the player: after two seconds of playback it restarts the
|
- **Previous** from the player: after two seconds of playback it restarts the
|
||||||
current track; before that it restores the last played track.
|
current track; before that it restores the last played track.
|
||||||
|
- The bottom player keeps the cover and title/artist readable on narrow phones;
|
||||||
|
add-to-mood actions moved into the overflow menu.
|
||||||
- **Scrubbing**: the progress slider can be dragged on every platform. Android and
|
- **Scrubbing**: the progress slider can be dragged on every platform. Android and
|
||||||
web seek natively; desktop restarts the decoder at the requested position.
|
web seek natively; desktop restarts the decoder at the requested position.
|
||||||
- **Mood settings**: name, description, discovery hint, genres, collection share,
|
- **Mood settings**: name, description, discovery hint, genres, collection share,
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
package win.taptap.musicmanager.client.ui
|
package win.taptap.musicmanager.client.ui
|
||||||
|
|
||||||
|
import androidx.compose.foundation.gestures.detectDragGesturesAfterLongPress
|
||||||
|
import androidx.compose.foundation.gestures.scrollBy
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.heightIn
|
import androidx.compose.foundation.layout.heightIn
|
||||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
@@ -13,13 +16,14 @@ import androidx.compose.foundation.layout.size
|
|||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.itemsIndexed
|
import androidx.compose.foundation.lazy.itemsIndexed
|
||||||
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.AddCircleOutline
|
import androidx.compose.material.icons.rounded.AddCircleOutline
|
||||||
import androidx.compose.material.icons.rounded.Bedtime
|
import androidx.compose.material.icons.rounded.Bedtime
|
||||||
import androidx.compose.material.icons.rounded.Close
|
import androidx.compose.material.icons.rounded.Close
|
||||||
import androidx.compose.material.icons.rounded.KeyboardArrowDown
|
import androidx.compose.material.icons.rounded.DragHandle
|
||||||
import androidx.compose.material.icons.rounded.KeyboardArrowUp
|
import androidx.compose.material.icons.rounded.MoreVert
|
||||||
import androidx.compose.material.icons.rounded.Pause
|
import androidx.compose.material.icons.rounded.Pause
|
||||||
import androidx.compose.material.icons.rounded.PlayArrow
|
import androidx.compose.material.icons.rounded.PlayArrow
|
||||||
import androidx.compose.material.icons.rounded.PlaylistAdd
|
import androidx.compose.material.icons.rounded.PlaylistAdd
|
||||||
@@ -37,23 +41,33 @@ import androidx.compose.material3.Surface
|
|||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.graphicsLayer
|
||||||
|
import androidx.compose.ui.input.pointer.pointerInput
|
||||||
|
import androidx.compose.ui.platform.LocalDensity
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.window.Dialog
|
import androidx.compose.ui.window.Dialog
|
||||||
|
import androidx.compose.ui.zIndex
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
|
import kotlin.math.roundToInt
|
||||||
import win.taptap.musicmanager.client.store.AppState
|
import win.taptap.musicmanager.client.store.AppState
|
||||||
import win.taptap.musicmanager.client.store.AppStore
|
import win.taptap.musicmanager.client.store.AppStore
|
||||||
|
|
||||||
|
private val QUEUE_ROW_HEIGHT = 58.dp
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun PlayerBar(state: AppState, store: AppStore) {
|
fun PlayerBar(state: AppState, store: AppStore) {
|
||||||
val song = state.current ?: return
|
val song = state.current ?: return
|
||||||
var picker by remember { mutableStateOf(false) }
|
var picker by remember { mutableStateOf(false) }
|
||||||
var sleepMenu by remember { mutableStateOf(false) }
|
var sleepMenu by remember { mutableStateOf(false) }
|
||||||
|
var moreMenu by remember { mutableStateOf(false) }
|
||||||
var queueOpen by remember { mutableStateOf(false) }
|
var queueOpen by remember { mutableStateOf(false) }
|
||||||
var dragSeconds by remember(song.id) { mutableStateOf<Float?>(null) }
|
var dragSeconds by remember(song.id) { mutableStateOf<Float?>(null) }
|
||||||
val sleepRemaining = state.sleepTimerRemainingSeconds
|
val sleepRemaining = state.sleepTimerRemainingSeconds
|
||||||
@@ -90,6 +104,36 @@ fun PlayerBar(state: AppState, store: AppStore) {
|
|||||||
IconButton(onClick = { queueOpen = true }) {
|
IconButton(onClick = { queueOpen = true }) {
|
||||||
Icon(Icons.Rounded.QueueMusic, contentDescription = "Queue")
|
Icon(Icons.Rounded.QueueMusic, contentDescription = "Queue")
|
||||||
}
|
}
|
||||||
|
Box {
|
||||||
|
IconButton(onClick = { moreMenu = true }) {
|
||||||
|
Icon(Icons.Rounded.MoreVert, contentDescription = "More actions")
|
||||||
|
}
|
||||||
|
DropdownMenu(
|
||||||
|
expanded = moreMenu,
|
||||||
|
onDismissRequest = { moreMenu = false },
|
||||||
|
) {
|
||||||
|
DropdownMenuItem(
|
||||||
|
text = { Text("Add to current mood") },
|
||||||
|
leadingIcon = {
|
||||||
|
Icon(Icons.Rounded.AddCircleOutline, contentDescription = null)
|
||||||
|
},
|
||||||
|
onClick = {
|
||||||
|
moreMenu = false
|
||||||
|
store.addCurrentToMood(null)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
DropdownMenuItem(
|
||||||
|
text = { Text("Add to another mood") },
|
||||||
|
leadingIcon = {
|
||||||
|
Icon(Icons.Rounded.PlaylistAdd, contentDescription = null)
|
||||||
|
},
|
||||||
|
onClick = {
|
||||||
|
moreMenu = false
|
||||||
|
picker = true
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
Box {
|
Box {
|
||||||
IconButton(onClick = { sleepMenu = true }) {
|
IconButton(onClick = { sleepMenu = true }) {
|
||||||
Icon(
|
Icon(
|
||||||
@@ -130,9 +174,11 @@ fun PlayerBar(state: AppState, store: AppStore) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.fillMaxWidth().padding(start = 12.dp, end = 8.dp, bottom = 8.dp),
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(start = 12.dp, end = 8.dp, bottom = 8.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.spacedBy(10.dp),
|
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||||
) {
|
) {
|
||||||
Cover(store, song.id, Modifier.size(48.dp), size = 160)
|
Cover(store, song.id, Modifier.size(48.dp), size = 160)
|
||||||
Column(Modifier.weight(1f)) {
|
Column(Modifier.weight(1f)) {
|
||||||
@@ -166,25 +212,36 @@ fun PlayerBar(state: AppState, store: AppStore) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
IconButton(onClick = { store.addCurrentToMood(null) }) {
|
IconButton(
|
||||||
Icon(Icons.Rounded.AddCircleOutline, contentDescription = "Add to current mood")
|
onClick = { store.previous() },
|
||||||
|
modifier = Modifier.size(40.dp),
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
Icons.Rounded.SkipPrevious,
|
||||||
|
contentDescription = "Previous",
|
||||||
|
modifier = Modifier.size(26.dp),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
IconButton(onClick = { picker = true }) {
|
IconButton(
|
||||||
Icon(Icons.Rounded.PlaylistAdd, contentDescription = "Add to another mood")
|
onClick = { store.togglePlayPause() },
|
||||||
}
|
modifier = Modifier.size(48.dp),
|
||||||
IconButton(onClick = { store.previous() }) {
|
) {
|
||||||
Icon(Icons.Rounded.SkipPrevious, contentDescription = "Previous")
|
|
||||||
}
|
|
||||||
IconButton(onClick = { store.skip() }) {
|
|
||||||
Icon(Icons.Rounded.SkipNext, contentDescription = "Skip")
|
|
||||||
}
|
|
||||||
IconButton(onClick = { store.togglePlayPause() }) {
|
|
||||||
Icon(
|
Icon(
|
||||||
if (state.playing) Icons.Rounded.Pause else Icons.Rounded.PlayArrow,
|
if (state.playing) Icons.Rounded.Pause else Icons.Rounded.PlayArrow,
|
||||||
contentDescription = if (state.playing) "Pause" else "Play",
|
contentDescription = if (state.playing) "Pause" else "Play",
|
||||||
modifier = Modifier.size(30.dp),
|
modifier = Modifier.size(30.dp),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
IconButton(
|
||||||
|
onClick = { store.skip() },
|
||||||
|
modifier = Modifier.size(40.dp),
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
Icons.Rounded.SkipNext,
|
||||||
|
contentDescription = "Skip",
|
||||||
|
modifier = Modifier.size(26.dp),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -208,12 +265,43 @@ fun PlayerBar(state: AppState, store: AppStore) {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun QueueDialog(state: AppState, store: AppStore, onDismiss: () -> Unit) {
|
private fun QueueDialog(state: AppState, store: AppStore, onDismiss: () -> Unit) {
|
||||||
|
val listState = rememberLazyListState()
|
||||||
|
var draggingIndex by remember { mutableStateOf<Int?>(null) }
|
||||||
|
var dragPointerY by remember { mutableStateOf(0f) }
|
||||||
|
var grabOffset by remember { mutableStateOf(0f) }
|
||||||
|
val edgePx = with(LocalDensity.current) { 48.dp.toPx() }
|
||||||
|
|
||||||
|
fun queueIndexAt(y: Float): Int? =
|
||||||
|
listState.layoutInfo.visibleItemsInfo
|
||||||
|
.firstOrNull { y >= it.offset && y < it.offset + it.size }
|
||||||
|
?.index
|
||||||
|
|
||||||
|
LaunchedEffect(draggingIndex) {
|
||||||
|
while (draggingIndex != null) {
|
||||||
|
val y = dragPointerY
|
||||||
|
val edge = edgePx
|
||||||
|
val viewport = listState.layoutInfo.viewportEndOffset.toFloat()
|
||||||
|
if (y < edge) {
|
||||||
|
listState.scrollBy(-18f)
|
||||||
|
} else if (y > viewport - edge) {
|
||||||
|
listState.scrollBy(18f)
|
||||||
|
}
|
||||||
|
val from = draggingIndex
|
||||||
|
val to = queueIndexAt(y)
|
||||||
|
if (from != null && to != null && to != from) {
|
||||||
|
store.moveInQueue(from, to)
|
||||||
|
draggingIndex = to
|
||||||
|
}
|
||||||
|
delay(16)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Dialog(onDismissRequest = onDismiss) {
|
Dialog(onDismissRequest = onDismiss) {
|
||||||
Surface(
|
Surface(
|
||||||
shape = RoundedCornerShape(18.dp),
|
shape = RoundedCornerShape(18.dp),
|
||||||
color = MaterialTheme.colorScheme.surface,
|
color = MaterialTheme.colorScheme.surface,
|
||||||
tonalElevation = 6.dp,
|
tonalElevation = 6.dp,
|
||||||
modifier = Modifier.fillMaxWidth().heightIn(max = 600.dp),
|
modifier = Modifier.fillMaxWidth().heightIn(max = 620.dp),
|
||||||
) {
|
) {
|
||||||
Column {
|
Column {
|
||||||
Row(
|
Row(
|
||||||
@@ -223,7 +311,11 @@ private fun QueueDialog(state: AppState, store: AppStore, onDismiss: () -> Unit)
|
|||||||
Column(Modifier.weight(1f)) {
|
Column(Modifier.weight(1f)) {
|
||||||
Text("Queue", style = MaterialTheme.typography.titleMedium)
|
Text("Queue", style = MaterialTheme.typography.titleMedium)
|
||||||
Text(
|
Text(
|
||||||
"${state.queue.size} upcoming",
|
if (state.queue.isEmpty()) {
|
||||||
|
"Nothing queued"
|
||||||
|
} else {
|
||||||
|
"${state.queue.size} upcoming · long-press and drag to reorder"
|
||||||
|
},
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
)
|
)
|
||||||
@@ -231,17 +323,23 @@ private fun QueueDialog(state: AppState, store: AppStore, onDismiss: () -> Unit)
|
|||||||
TextButton(onClick = onDismiss) { Text("Close") }
|
TextButton(onClick = onDismiss) { Text("Close") }
|
||||||
}
|
}
|
||||||
HorizontalDivider()
|
HorizontalDivider()
|
||||||
LazyColumn(Modifier.fillMaxWidth().heightIn(max = 480.dp)) {
|
|
||||||
state.current?.let { song ->
|
state.current?.let { song ->
|
||||||
item(key = "current") {
|
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.fillMaxWidth().padding(horizontal = 20.dp, vertical = 10.dp),
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 20.dp, vertical = 10.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
) {
|
) {
|
||||||
Cover(store, song.id, Modifier.size(40.dp), size = 96)
|
Cover(store, song.id, Modifier.size(40.dp), size = 96)
|
||||||
Column(Modifier.weight(1f)) {
|
Column(Modifier.weight(1f)) {
|
||||||
Text(song.title, style = MaterialTheme.typography.bodyLarge, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
Text(
|
||||||
|
song.title,
|
||||||
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
)
|
||||||
Text(
|
Text(
|
||||||
"Now playing",
|
"Now playing",
|
||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
@@ -249,29 +347,85 @@ private fun QueueDialog(state: AppState, store: AppStore, onDismiss: () -> Unit)
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
HorizontalDivider()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.queue.isEmpty()) {
|
if (state.queue.isEmpty()) {
|
||||||
item {
|
|
||||||
Text(
|
Text(
|
||||||
"Nothing queued. Start a mood to build a radio queue.",
|
"Nothing queued. Start a mood to build a radio queue.",
|
||||||
modifier = Modifier.padding(20.dp),
|
modifier = Modifier.padding(20.dp),
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.pointerInput(Unit) {
|
||||||
|
detectDragGesturesAfterLongPress(
|
||||||
|
onDragStart = { offset ->
|
||||||
|
val index = queueIndexAt(offset.y)
|
||||||
|
val info = listState.layoutInfo.visibleItemsInfo
|
||||||
|
.firstOrNull { it.index == index }
|
||||||
|
if (index != null && info != null) {
|
||||||
|
draggingIndex = index
|
||||||
|
dragPointerY = offset.y
|
||||||
|
grabOffset = offset.y - info.offset
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
onDrag = { change, _ ->
|
||||||
|
change.consume()
|
||||||
|
dragPointerY = change.position.y
|
||||||
|
val from = draggingIndex
|
||||||
|
val to = queueIndexAt(change.position.y)
|
||||||
|
if (from != null && to != null && to != from) {
|
||||||
|
store.moveInQueue(from, to)
|
||||||
|
draggingIndex = to
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onDragEnd = { draggingIndex = null },
|
||||||
|
onDragCancel = { draggingIndex = null },
|
||||||
|
)
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
LazyColumn(
|
||||||
|
state = listState,
|
||||||
|
modifier = Modifier.fillMaxWidth().heightIn(max = 500.dp),
|
||||||
|
) {
|
||||||
|
itemsIndexed(state.queue, key = { _, song -> song.id }) { index, song ->
|
||||||
|
val isDragging = index == draggingIndex
|
||||||
|
val rowInfo = if (isDragging) {
|
||||||
|
listState.layoutInfo.visibleItemsInfo
|
||||||
|
.firstOrNull { it.index == index }
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
val translation = if (rowInfo != null) {
|
||||||
|
dragPointerY - rowInfo.offset - grabOffset
|
||||||
|
} else {
|
||||||
|
0f
|
||||||
}
|
}
|
||||||
|
|
||||||
itemsIndexed(state.queue, key = { index, _ -> "queue-$index" }) { index, song ->
|
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.fillMaxWidth().padding(start = 20.dp, end = 8.dp, top = 6.dp, bottom = 6.dp),
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(QUEUE_ROW_HEIGHT)
|
||||||
|
.zIndex(if (isDragging) 1f else 0f)
|
||||||
|
.graphicsLayer {
|
||||||
|
translationY = translation
|
||||||
|
shadowElevation = if (isDragging) 8.dp.toPx() else 0f
|
||||||
|
}
|
||||||
|
.padding(start = 20.dp, end = 8.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.spacedBy(10.dp),
|
horizontalArrangement = Arrangement.spacedBy(10.dp),
|
||||||
) {
|
) {
|
||||||
Cover(store, song.id, Modifier.size(36.dp), size = 96)
|
Cover(store, song.id, Modifier.size(36.dp), size = 96)
|
||||||
Column(Modifier.weight(1f)) {
|
Column(Modifier.weight(1f)) {
|
||||||
Text(song.title, style = MaterialTheme.typography.bodyMedium, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
Text(
|
||||||
|
song.title,
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
)
|
||||||
Text(
|
Text(
|
||||||
song.artist,
|
song.artist,
|
||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
@@ -280,19 +434,19 @@ private fun QueueDialog(state: AppState, store: AppStore, onDismiss: () -> Unit)
|
|||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Icon(
|
||||||
|
Icons.Rounded.DragHandle,
|
||||||
|
contentDescription = "Drag to reorder",
|
||||||
|
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
modifier = Modifier.size(22.dp),
|
||||||
|
)
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = { store.moveInQueue(index, index - 1) },
|
onClick = {
|
||||||
enabled = index > 0,
|
val from = store.state.value.queue
|
||||||
|
.indexOfFirst { it.id == song.id }
|
||||||
|
if (from >= 0) store.removeFromQueue(from)
|
||||||
|
},
|
||||||
) {
|
) {
|
||||||
Icon(Icons.Rounded.KeyboardArrowUp, contentDescription = "Move up")
|
|
||||||
}
|
|
||||||
IconButton(
|
|
||||||
onClick = { store.moveInQueue(index, index + 1) },
|
|
||||||
enabled = index < state.queue.lastIndex,
|
|
||||||
) {
|
|
||||||
Icon(Icons.Rounded.KeyboardArrowDown, contentDescription = "Move down")
|
|
||||||
}
|
|
||||||
IconButton(onClick = { store.removeFromQueue(index) }) {
|
|
||||||
Icon(Icons.Rounded.Close, contentDescription = "Remove from queue")
|
Icon(Icons.Rounded.Close, contentDescription = "Remove from queue")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,4 +455,6 @@ private fun QueueDialog(state: AppState, store: AppStore, onDismiss: () -> Unit)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -63,6 +63,6 @@ Implemented. Concretely:
|
|||||||
playback from device downloads, and no longform/library paths.
|
playback from device downloads, and no longform/library paths.
|
||||||
- The UI has a dedicated Search screen (mood picker, paste URL, downloaded
|
- The UI has a dedicated Search screen (mood picker, paste URL, downloaded
|
||||||
badges) and a Downloads screen. Mood Detail shows songs, add music,
|
badges) and a Downloads screen. Mood Detail shows songs, add music,
|
||||||
recommendation states and the new options. The player keeps queue editing,
|
recommendation states and the new options. The player keeps drag-to-reorder queue editing,
|
||||||
previous/seek and the sleep timer.
|
previous/seek and the sleep timer.
|
||||||
- Device downloads store covers by song id (`<songId>.jpg`).
|
- Device downloads store covers by song id (`<songId>.jpg`).
|
||||||
Reference in new issue
Block a user