Move playing song menu button to the bottom

This commit is contained in:
vfsfitvnm
2022-07-23 12:04:46 +02:00
parent a0d3356a62
commit 35887f62f8
2 changed files with 76 additions and 72 deletions

View File

@@ -20,8 +20,11 @@ import it.vfsfitvnm.vimusic.ui.styling.LocalAppearance
@Composable @Composable
fun PlayerBottomSheet( fun PlayerBottomSheet(
layoutState: BottomSheetState, layoutState: BottomSheetState,
isShowingLyrics: Boolean,
onShowLyrics: () -> Unit, onShowLyrics: () -> Unit,
isShowingStatsForNerds: Boolean,
onShowStatsForNerds: () -> Unit, onShowStatsForNerds: () -> Unit,
onShowMenu: () -> Unit,
onGlobalRouteEmitted: () -> Unit, onGlobalRouteEmitted: () -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
@@ -54,6 +57,12 @@ fun PlayerBottomSheet(
.padding(all = 8.dp) .padding(all = 8.dp)
.size(20.dp) .size(20.dp)
) )
Spacer(
modifier = Modifier
.padding(all = 8.dp)
.size(20.dp)
)
} }
Image( Image(
@@ -72,7 +81,7 @@ fun PlayerBottomSheet(
Image( Image(
painter = painterResource(R.drawable.text), painter = painterResource(R.drawable.text),
contentDescription = null, contentDescription = null,
colorFilter = ColorFilter.tint(colorPalette.text), colorFilter = ColorFilter.tint(if (isShowingLyrics) colorPalette.text else colorPalette.textDisabled),
modifier = Modifier modifier = Modifier
.clickable(onClick = onShowLyrics) .clickable(onClick = onShowLyrics)
.padding(all = 8.dp) .padding(all = 8.dp)
@@ -82,12 +91,22 @@ fun PlayerBottomSheet(
Image( Image(
painter = painterResource(R.drawable.information), painter = painterResource(R.drawable.information),
contentDescription = null, contentDescription = null,
colorFilter = ColorFilter.tint(colorPalette.text), colorFilter = ColorFilter.tint(if (isShowingStatsForNerds) colorPalette.text else colorPalette.textDisabled),
modifier = Modifier modifier = Modifier
.clickable(onClick = onShowStatsForNerds) .clickable(onClick = onShowStatsForNerds)
.padding(all = 8.dp) .padding(all = 8.dp)
.size(20.dp) .size(20.dp)
) )
Image(
painter = painterResource(R.drawable.ellipsis_horizontal),
contentDescription = null,
colorFilter = ColorFilter.tint(colorPalette.text),
modifier = Modifier
.clickable(onClick = onShowMenu)
.padding(all = 8.dp)
.size(20.dp)
)
} }
} }
} }

View File

@@ -255,19 +255,19 @@ fun PlayerView(
} }
} }
TopAppBar { PlayerBottomSheet(
Spacer( layoutState = rememberBottomSheetState(64.dp, layoutState.upperBound),
modifier = Modifier isShowingLyrics = isShowingLyrics,
.padding(horizontal = 16.dp, vertical = 8.dp) onShowLyrics = {
.size(24.dp) isShowingStatsForNerds = false
) isShowingLyrics = !isShowingLyrics
},
Image( isShowingStatsForNerds = isShowingStatsForNerds,
painter = painterResource(R.drawable.ellipsis_horizontal), onShowStatsForNerds = {
contentDescription = null, isShowingLyrics = false
colorFilter = ColorFilter.tint(colorPalette.text), isShowingStatsForNerds = !isShowingStatsForNerds
modifier = Modifier },
.clickable { onShowMenu = {
menuState.display { menuState.display {
val resultRegistryOwner = LocalActivityResultRegistryOwner.current val resultRegistryOwner = LocalActivityResultRegistryOwner.current
@@ -319,21 +319,6 @@ fun PlayerView(
onGlobalRouteEmitted = layoutState::collapseSoft, onGlobalRouteEmitted = layoutState::collapseSoft,
) )
} }
}
.padding(horizontal = 16.dp, vertical = 8.dp)
.size(24.dp)
)
}
PlayerBottomSheet(
layoutState = rememberBottomSheetState(64.dp, layoutState.upperBound),
onShowLyrics = {
isShowingStatsForNerds = false
isShowingLyrics = !isShowingLyrics
},
onShowStatsForNerds = {
isShowingLyrics = false
isShowingStatsForNerds = !isShowingStatsForNerds
}, },
onGlobalRouteEmitted = layoutState::collapseSoft, onGlobalRouteEmitted = layoutState::collapseSoft,
modifier = Modifier modifier = Modifier