mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 15:50:16 +02:00
Change remove to more context menu button
This commit is contained in:
parent
c72f444448
commit
1af906fe90
2 changed files with 26 additions and 21 deletions
|
|
@ -22,7 +22,7 @@ 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.lazy.rememberLazyListState
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Delete
|
import androidx.compose.material.icons.filled.MoreVert
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.derivedStateOf
|
import androidx.compose.runtime.derivedStateOf
|
||||||
|
|
@ -68,7 +68,7 @@ fun NowPlayingOverlay(
|
||||||
onLongClickSong: (Int, AudioItem) -> Unit,
|
onLongClickSong: (Int, AudioItem) -> Unit,
|
||||||
onClickMore: () -> Unit,
|
onClickMore: () -> Unit,
|
||||||
onMoveQueue: (Int, MoveDirection) -> Unit,
|
onMoveQueue: (Int, MoveDirection) -> Unit,
|
||||||
onClickRemove: (Int, AudioItem) -> Unit,
|
onClickMoreItem: (Int, AudioItem) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
|
|
@ -195,13 +195,13 @@ fun NowPlayingOverlay(
|
||||||
onClick = { onMoveQueue.invoke(index, MoveDirection.DOWN) },
|
onClick = { onMoveQueue.invoke(index, MoveDirection.DOWN) },
|
||||||
)
|
)
|
||||||
Button(
|
Button(
|
||||||
onClick = { onClickRemove.invoke(index, song) },
|
onClick = { onClickMoreItem.invoke(index, song) },
|
||||||
enabled = true,
|
enabled = true,
|
||||||
modifier = Modifier.size(32.dp),
|
modifier = Modifier.size(32.dp),
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Default.Delete,
|
imageVector = Icons.Default.MoreVert,
|
||||||
contentDescription = stringResource(R.string.remove_from_queue),
|
contentDescription = stringResource(R.string.more),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ import androidx.tv.material3.MaterialTheme
|
||||||
import androidx.tv.material3.Text
|
import androidx.tv.material3.Text
|
||||||
import coil3.compose.AsyncImage
|
import coil3.compose.AsyncImage
|
||||||
import com.github.damontecres.wholphin.R
|
import com.github.damontecres.wholphin.R
|
||||||
|
import com.github.damontecres.wholphin.data.model.AudioItem
|
||||||
import com.github.damontecres.wholphin.preferences.AppPreferences
|
import com.github.damontecres.wholphin.preferences.AppPreferences
|
||||||
import com.github.damontecres.wholphin.preferences.UserPreferences
|
import com.github.damontecres.wholphin.preferences.UserPreferences
|
||||||
import com.github.damontecres.wholphin.services.rememberQueue
|
import com.github.damontecres.wholphin.services.rememberQueue
|
||||||
|
|
@ -184,6 +185,24 @@ fun NowPlayingPage(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val showContextForItem =
|
||||||
|
remember {
|
||||||
|
{ fromLongClick: Boolean, index: Int, song: AudioItem ->
|
||||||
|
itemMoreDialog =
|
||||||
|
DialogParams(
|
||||||
|
title = song.title ?: "",
|
||||||
|
fromLongClick = fromLongClick,
|
||||||
|
items =
|
||||||
|
buildMoreDialogForMusicQueue(
|
||||||
|
context = context,
|
||||||
|
actions = actions,
|
||||||
|
item = song,
|
||||||
|
index = index,
|
||||||
|
canRemove = true,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BackHandler(controllerViewState.controlsVisible) {
|
BackHandler(controllerViewState.controlsVisible) {
|
||||||
controllerViewState.hideControls()
|
controllerViewState.hideControls()
|
||||||
|
|
@ -205,22 +224,8 @@ fun NowPlayingPage(
|
||||||
onMoveQueue = { index, direction -> viewModel.moveQueue(index, direction) },
|
onMoveQueue = { index, direction -> viewModel.moveQueue(index, direction) },
|
||||||
onClickMore = { showMoreDialog = true },
|
onClickMore = { showMoreDialog = true },
|
||||||
onClickSong = { index, _ -> viewModel.play(index) },
|
onClickSong = { index, _ -> viewModel.play(index) },
|
||||||
onClickRemove = { index, _ -> viewModel.removeFromQueue(index) },
|
onClickMoreItem = { index, song -> showContextForItem.invoke(false, index, song) },
|
||||||
onLongClickSong = { index, song ->
|
onLongClickSong = { index, song -> showContextForItem.invoke(true, index, song) },
|
||||||
itemMoreDialog =
|
|
||||||
DialogParams(
|
|
||||||
title = song.title ?: "",
|
|
||||||
fromLongClick = true,
|
|
||||||
items =
|
|
||||||
buildMoreDialogForMusicQueue(
|
|
||||||
context = context,
|
|
||||||
actions = actions,
|
|
||||||
item = song,
|
|
||||||
index = index,
|
|
||||||
canRemove = true,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
},
|
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.background(AppColors.TransparentBlack50)
|
.background(AppColors.TransparentBlack50)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue