Remove menu for home page song collections
This commit is contained in:
@@ -28,7 +28,6 @@ import androidx.compose.ui.res.painterResource
|
|||||||
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.zIndex
|
import androidx.compose.ui.zIndex
|
||||||
import androidx.media3.common.Player
|
|
||||||
import it.vfsfitvnm.route.RouteHandler
|
import it.vfsfitvnm.route.RouteHandler
|
||||||
import it.vfsfitvnm.route.fastFade
|
import it.vfsfitvnm.route.fastFade
|
||||||
import it.vfsfitvnm.vimusic.Database
|
import it.vfsfitvnm.vimusic.Database
|
||||||
@@ -39,7 +38,6 @@ import it.vfsfitvnm.vimusic.models.Playlist
|
|||||||
import it.vfsfitvnm.vimusic.models.SearchQuery
|
import it.vfsfitvnm.vimusic.models.SearchQuery
|
||||||
import it.vfsfitvnm.vimusic.models.SongWithInfo
|
import it.vfsfitvnm.vimusic.models.SongWithInfo
|
||||||
import it.vfsfitvnm.vimusic.services.StopRadioCommand
|
import it.vfsfitvnm.vimusic.services.StopRadioCommand
|
||||||
import it.vfsfitvnm.vimusic.ui.components.LocalMenuState
|
|
||||||
import it.vfsfitvnm.vimusic.ui.components.TopAppBar
|
import it.vfsfitvnm.vimusic.ui.components.TopAppBar
|
||||||
import it.vfsfitvnm.vimusic.ui.components.themed.*
|
import it.vfsfitvnm.vimusic.ui.components.themed.*
|
||||||
import it.vfsfitvnm.vimusic.ui.styling.LocalColorPalette
|
import it.vfsfitvnm.vimusic.ui.styling.LocalColorPalette
|
||||||
@@ -145,7 +143,6 @@ fun HomeScreen() {
|
|||||||
|
|
||||||
host {
|
host {
|
||||||
val player = LocalYoutubePlayer.current
|
val player = LocalYoutubePlayer.current
|
||||||
val menuState = LocalMenuState.current
|
|
||||||
val density = LocalDensity.current
|
val density = LocalDensity.current
|
||||||
|
|
||||||
val thumbnailSize = remember {
|
val thumbnailSize = remember {
|
||||||
@@ -297,6 +294,7 @@ fun HomeScreen() {
|
|||||||
},
|
},
|
||||||
style = typography.m.semiBold,
|
style = typography.m.semiBold,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
.alignByBaseline()
|
||||||
.animateContentSize()
|
.animateContentSize()
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -318,58 +316,21 @@ fun HomeScreen() {
|
|||||||
preferences.homePageSongCollection = nextSongCollection
|
preferences.homePageSongCollection = nextSongCollection
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
// .alignByBaseline()
|
.alignByBaseline()
|
||||||
.padding(horizontal = 16.dp)
|
.padding(horizontal = 16.dp)
|
||||||
.animateContentSize()
|
.animateContentSize()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(R.drawable.ellipsis_horizontal),
|
painter = painterResource(R.drawable.shuffle),
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
colorFilter = ColorFilter.tint(colorPalette.text),
|
colorFilter = ColorFilter.tint(colorPalette.text),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.clickable {
|
.clickable(enabled = songCollection.isNotEmpty()) {
|
||||||
menuState.display {
|
player?.mediaController?.let {
|
||||||
BasicMenu(onDismiss = menuState::hide) {
|
it.sendCustomCommand(StopRadioCommand, Bundle.EMPTY)
|
||||||
MenuEntry(
|
it.forcePlayFromBeginning(songCollection.shuffled().map(SongWithInfo::asMediaItem))
|
||||||
icon = R.drawable.play,
|
|
||||||
text = "Play",
|
|
||||||
enabled = songCollection.isNotEmpty(),
|
|
||||||
onClick = {
|
|
||||||
menuState.hide()
|
|
||||||
player?.mediaController?.let {
|
|
||||||
it.sendCustomCommand(StopRadioCommand, Bundle.EMPTY)
|
|
||||||
it.forcePlayFromBeginning(songCollection.map(SongWithInfo::asMediaItem))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
MenuEntry(
|
|
||||||
icon = R.drawable.shuffle,
|
|
||||||
text = "Shuffle",
|
|
||||||
enabled = songCollection.isNotEmpty(),
|
|
||||||
onClick = {
|
|
||||||
menuState.hide()
|
|
||||||
player?.mediaController?.let {
|
|
||||||
it.sendCustomCommand(StopRadioCommand, Bundle.EMPTY)
|
|
||||||
it.forcePlayFromBeginning(songCollection.shuffled().map(SongWithInfo::asMediaItem))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
MenuEntry(
|
|
||||||
icon = R.drawable.time,
|
|
||||||
text = "Enqueue",
|
|
||||||
enabled = songCollection.isNotEmpty() && player?.playbackState == Player.STATE_READY,
|
|
||||||
onClick = {
|
|
||||||
menuState.hide()
|
|
||||||
player?.mediaController?.enqueue(
|
|
||||||
songCollection.map(SongWithInfo::asMediaItem)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(horizontal = 8.dp, vertical = 8.dp)
|
.padding(horizontal = 8.dp, vertical = 8.dp)
|
||||||
|
|||||||
Reference in New Issue
Block a user