Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ internal fun LandscapeCredits(
),
onClick = onToggleLike,
active = liked,
showDisc = false,
haptic = if (liked) Haptic.ToggleOff else Haptic.ToggleOn,
)
Spacer(Modifier.width(8.dp))
Expand All @@ -484,6 +485,7 @@ internal fun LandscapeCredits(
icon = if (showRevertCue) Icons.AutoMirrored.Rounded.Undo else Icons.Rounded.MoreHoriz,
contentDescription = stringResource(Res.string.more),
onClick = onOpenMenu,
showDisc = false,
modifier = Modifier.menuAnchor(),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3785,6 +3785,7 @@ fun NowPlayingScreen(
),
onClick = onToggleLike,
active = liked,
showDisc = false,
haptic = if (liked) Haptic.ToggleOff else Haptic.ToggleOn,
)
Spacer(Modifier.width(8.dp))
Expand Down Expand Up @@ -3823,6 +3824,7 @@ fun NowPlayingScreen(
lyricsShareGlyphVisible -> lyricPicker.beginPicking
else -> onOpenMenu
},
showDisc = false,
haptic = if (lyricsShareGlyphVisible && !showRevertCue) {
Haptic.Select
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,19 +723,18 @@ internal fun PlayerActionRow(
private const val CIRCLE_DISC_DODGE_GAIN = 2.5f

/**
* Translucent circular button used for the track menu and the like control.
* Circular hit target used for the track menu and the like control.
*
* [active] brightens the disc rather than only the glyph: this sits on album
* artwork of any colour, and a white icon on a white-ish sleeve has no tint
* change left to make. The filled star carries the state as a shape too —
* see [BitChordIcons.StarFilled].
* [active] brightens the optional disc rather than only the glyph. Set
* [showDisc] to false when the controls should float freely over artwork.
*/
@Composable
internal fun CircleGlyph(
icon: ImageVector,
contentDescription: String,
onClick: () -> Unit,
active: Boolean = false,
showDisc: Boolean = true,
haptic: Haptic = Haptic.Tap,
modifier: Modifier = Modifier,
) {
Expand All @@ -761,18 +760,20 @@ internal fun CircleGlyph(
// The disc carries the blend, dodged as the bottom row's glyphs are, and
// the glyph sits on it in plain white. The ink is mixed in at a few times
// the plain disc's strength: a dodge laid on this thinly is next to nothing.
Box(
Modifier
.matchParentSize()
.vibrantChrome(chrome)
.background(
if (chrome) {
VibrantChromeInk.copy(alpha = (discAlpha * CIRCLE_DISC_DODGE_GAIN).coerceAtMost(1f))
} else {
Color.White.copy(alpha = discAlpha)
},
),
)
if (showDisc) {
Box(
Modifier
.matchParentSize()
.vibrantChrome(chrome)
.background(
if (chrome) {
VibrantChromeInk.copy(alpha = (discAlpha * CIRCLE_DISC_DODGE_GAIN).coerceAtMost(1f))
} else {
Color.White.copy(alpha = discAlpha)
},
),
)
}
Crossfade(
targetState = icon,
animationSpec = tween(durationMillis = 180),
Expand All @@ -782,7 +783,7 @@ internal fun CircleGlyph(
imageVector = glyph,
contentDescription = contentDescription,
tint = Color.White,
modifier = Modifier.size(19.dp),
modifier = Modifier.size(24.dp),
)
}
}
Expand Down
Loading