mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 07:29:14 +01:00
address feedback: immediate navigation, now-playing fade, stack focus, sheet polish
- menu actions run before the sheet collapses, so tapping an album/artist navigates immediately instead of waiting for the dismiss; the sheet still animates closed - host the sheet in the app shell so it survives the navigation it triggers - now playing fades out (rather than sliding) when its menu navigates to an album/artist, and navigates first - navigating to a detail screen already on top of the stack focuses it instead of pushing a duplicate - drop the drag handle from both sheets, even the menu header's left/top margins, and add a bottom margin
This commit is contained in:
@@ -61,9 +61,9 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.subtracks.data.model.Album
|
||||
import com.subtracks.data.model.Artist
|
||||
import com.subtracks.data.model.CoverArtRef
|
||||
import com.subtracks.ui.components.ContextMenuHost
|
||||
import com.subtracks.ui.components.CoverArt
|
||||
import com.subtracks.ui.components.ItemActions
|
||||
import com.subtracks.ui.components.ItemContextMenu
|
||||
import com.subtracks.ui.components.MenuTarget
|
||||
import com.subtracks.ui.components.rememberViewportFill
|
||||
import com.subtracks.ui.theme.ArtworkColors
|
||||
@@ -91,6 +91,7 @@ fun ArtistDetailRoute(
|
||||
onBack: () -> Unit,
|
||||
onAlbumClick: (Album) -> Unit,
|
||||
onViewAlbum: (String) -> Unit,
|
||||
contextMenuHost: ContextMenuHost? = null,
|
||||
viewModel: ArtistDetailViewModel = koinViewModel(key = artistId) { parametersOf(artistId) },
|
||||
) {
|
||||
val artist by viewModel.artist.collectAsStateWithLifecycle(initialValue = null)
|
||||
@@ -98,7 +99,6 @@ fun ArtistDetailRoute(
|
||||
val art by viewModel.art.collectAsStateWithLifecycle()
|
||||
val artThumbnail by viewModel.artThumbnail.collectAsStateWithLifecycle()
|
||||
val shortcutArt = remember(coverArtId) { coverArtId?.let { viewModel.coverArt(it, true) } }
|
||||
var menuTarget by remember { mutableStateOf<MenuTarget?>(null) }
|
||||
val actions =
|
||||
ItemActions(
|
||||
playAlbum = { viewModel.playAlbum(it.id) },
|
||||
@@ -115,12 +115,9 @@ fun ArtistDetailRoute(
|
||||
coverArt = viewModel::coverArt,
|
||||
onBack = onBack,
|
||||
onAlbumClick = onAlbumClick,
|
||||
onAlbumLongClick = { menuTarget = it },
|
||||
onMore = { artist?.let { menuTarget = MenuTarget.Artist(it, artThumbnail ?: art) } },
|
||||
onAlbumLongClick = { contextMenuHost?.show(it, actions) },
|
||||
onMore = { artist?.let { contextMenuHost?.show(MenuTarget.Artist(it, artThumbnail ?: art), actions) } },
|
||||
)
|
||||
menuTarget?.let { target ->
|
||||
ItemContextMenu(target = target, actions = actions, onDismiss = { menuTarget = null })
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
|
||||
Reference in New Issue
Block a user