Unofficial YouTube Music / Spotify Premium client for Android, built in Liquid Glass. Audio effects, Spotify Connect, listening history, 8 languages. Rust core on librespot.
Kotlin alternativeandroidandroid-applicationclientglassmorphisminnertubelibrespotliquid-glassspotifyspotify-connectspotifyapiyoutube-musicyoutube-playerytdlnis
Keep menus readable and the glass whole at any setting
Lelonio8dc61e542569
diff --git a/app/src/main/java/dev/lelonio/square/ui/components/FriendsPanel.kt b/app/src/main/java/dev/lelonio/square/ui/components/FriendsPanel.ktindex 3085faa..fe7968a 100644--- a/app/src/main/java/dev/lelonio/square/ui/components/FriendsPanel.kt+++ b/app/src/main/java/dev/lelonio/square/ui/components/FriendsPanel.kt@@ -107,11 +107,15 @@ fun BoxScope.FriendsPanel(modifier = Modifier.align(Alignment.Center),) {val shape = RoundedCornerShape(32.dp)+ // Back closes it, as it closes the track menu (#132).+ androidx.activity.compose.BackHandler(onBack = onDismiss)GlassSurface(backdrop = backdrop,shape = shape,surfaceColor = Color.White.copy(alpha = 0.08f),blurScale = 23.0f,+ // Never clear, whatever the frost is set to; see TrackSheet.+ minBlurDp = 24f,modifier = Modifier.padding(horizontal = 22.dp).fillMaxWidth()diff --git a/app/src/main/java/dev/lelonio/square/ui/components/SharedTrackCard.kt b/app/src/main/java/dev/lelonio/square/ui/components/SharedTrackCard.ktindex 83a72f8..8b3f471 100644--- a/app/src/main/java/dev/lelonio/square/ui/components/SharedTrackCard.kt+++ b/app/src/main/java/dev/lelonio/square/ui/components/SharedTrackCard.kt@@ -104,11 +104,15 @@ fun BoxScope.SharedTrackCard(val shape = RoundedCornerShape(36.dp)val palette by rememberArtworkPalette(track?.artworkUrl)+ // Back closes it, as it closes the track menu (#132).+ androidx.activity.compose.BackHandler(onBack = onDismiss)GlassSurface(backdrop = backdrop,shape = shape,surfaceColor = Color.White.copy(alpha = 0.07f),blurScale = 23.0f,+ // Never clear, whatever the frost is set to; see TrackSheet.+ minBlurDp = 24f,modifier = Modifier.padding(horizontal = 26.dp).fillMaxWidth()diff --git a/app/src/main/java/dev/lelonio/square/ui/components/TrackSheet.kt b/app/src/main/java/dev/lelonio/square/ui/components/TrackSheet.ktindex e253d1b..0da2ae6 100644--- a/app/src/main/java/dev/lelonio/square/ui/components/TrackSheet.kt+++ b/app/src/main/java/dev/lelonio/square/ui/components/TrackSheet.kt@@ -94,6 +94,12 @@ fun BoxScope.TrackSheet(exit = scaleOut(tween(160), targetScale = 0.94f) + fadeOut(tween(140)),modifier = Modifier.align(Alignment.Center),) {+ // Back closes the sheet, as it closes every other modal. Without it+ // the only way out was a tap beside a sheet tall enough to leave+ // almost nothing beside it, and back went to the page underneath+ // instead (#132). Registered here, as the sheet appears, so it is the+ // last one registered and the one the system asks.+ androidx.activity.compose.BackHandler(onBack = onDismiss)val shape = RoundedCornerShape(30.dp)GlassSurface(backdrop = backdrop,@@ -104,6 +110,9 @@ fun BoxScope.TrackSheet(// through sharper inside the sheet than outside it — the one thing// that reads as a mistake rather than as a material.blurScale = 23.0f,+ // And never clear, whatever the frost is set to: these rows are+ // read over a page full of other rows.+ minBlurDp = SheetMinBlurDp,modifier = Modifier.padding(horizontal = 28.dp).fillMaxWidth()@@ -112,7 +121,14 @@ fun BoxScope.TrackSheet(// Swallows the tap that would otherwise close the sheet..clickable(interactionSource = null, indication = null) {},) {- Column(Modifier.padding(vertical = 22.dp)) {+ // A veil of the page's own colour under the rows. With the frost+ // and the tint both turned down, the glass alone let the lines+ // behind it through as bright as the menu's own (#132).+ Column(+ Modifier+ .background(MaterialTheme.colorScheme.surface.copy(alpha = SheetVeilAlpha))+ .padding(vertical = 22.dp),+ ) {Row(Modifier.fillMaxWidth()@@ -192,3 +208,9 @@ fun TrackSheetAction(/** Light: the page behind is already blurred, so this only has to be a surface. */private val SheetFilm = Color.White.copy(alpha = 0.16f)++/** The least the sheet blurs; see GlassSurface's minBlurDp. */+private const val SheetMinBlurDp = 24f++/** How much of the page's colour the sheet always keeps under its rows. */+private const val SheetVeilAlpha = 0.45fdiff --git a/app/src/main/java/dev/lelonio/square/ui/glass/GlassEffect.kt b/app/src/main/java/dev/lelonio/square/ui/glass/GlassEffect.ktindex fbba462..f98aada 100644--- a/app/src/main/java/dev/lelonio/square/ui/glass/GlassEffect.kt+++ b/app/src/main/java/dev/lelonio/square/ui/glass/GlassEffect.kt@@ -195,6 +195,9 @@ enum class GlassComponent {*/internal const val LENS_MAX_DP = 48f+/** How far the bend may go for each unit of depth; see the lens in liquidGlass. */+private const val MAX_BEND_PER_DEPTH = 2.5f+/*** How much of a pane's shorter side the lens may approach, per edge.*@@ -628,9 +631,18 @@ fun Modifier.liquidGlass(// the limit the slider stops doing anything on short surfaces,// and goes on working on every tall one.val reach = minOf(size.width, size.height) * LENS_MAX_SHARE+ val depth = lensHeightPx.coerceAtMost(reach)lens(- refractionHeight = lensHeightPx.coerceAtMost(reach),- refractionAmount = lensAmountPx.coerceAtMost(reach),+ refractionHeight = depth,+ // And no further than the band it bends in can carry. A+ // bend many times the depth reads its light from well past+ // the recorded layer, where there is only the layer's edge+ // repeated: white streaks across the bar, and the page+ // smeared through it while scrolling (#133). The defaults+ // sit at one and a half; this only stops the extremes.+ refractionAmount = lensAmountPx+ .coerceAtMost(reach)+ .coerceAtMost(depth * MAX_BEND_PER_DEPTH),depthEffect = config.depthEffect,chromaticAberration = config.chromaticAberration,)diff --git a/app/src/main/java/dev/lelonio/square/ui/glass/LiquidBottomTabs.kt b/app/src/main/java/dev/lelonio/square/ui/glass/LiquidBottomTabs.ktindex f991499..f611938 100644--- a/app/src/main/java/dev/lelonio/square/ui/glass/LiquidBottomTabs.kt+++ b/app/src/main/java/dev/lelonio/square/ui/glass/LiquidBottomTabs.kt@@ -336,12 +336,14 @@ fun LiquidBottomTabs(child.placeRelative((width - expandedWidth) / 2, (height - expandedHeight) / 2)}}+ val dispersion = LocalGlassEffectConfig.current.chromaticAberrationval slotLens: BackdropEffectScope.() -> Unit = {val progress = dampedDragAnimation.pressProgresslens(10f.dp.toPx() * progress,14f.dp.toPx() * progress,- chromaticAberration = true+ // LOCAL CHANGE: follows the colour-splitting switch (#133).+ chromaticAberration = dispersion)}diff --git a/app/src/main/java/dev/lelonio/square/ui/glass/SquareBottomBar.kt b/app/src/main/java/dev/lelonio/square/ui/glass/SquareBottomBar.ktindex a85cc29..b0c5d8d 100644--- a/app/src/main/java/dev/lelonio/square/ui/glass/SquareBottomBar.kt+++ b/app/src/main/java/dev/lelonio/square/ui/glass/SquareBottomBar.kt@@ -322,6 +322,7 @@ fun FoldingTabs(// in a `graphicsLayer` and a `layout`, so it travels and grows without// recomposing anything.if (backdrop != null) {+ val dispersion = LocalGlassEffectConfig.current.chromaticAberrationBox(Modifier.puckLayout(@@ -334,7 +335,10 @@ fun FoldingTabs(.drawBackdrop(backdrop = backdrop,shape = { ContinuousCapsule() },- effects = { lens(10f.dp.toPx(), 14f.dp.toPx(), chromaticAberration = true) },+ // The colour splitting follows its switch, here as on+ // every other pane: fixed on, the puck kept a rainbow+ // edge with the setting off (#133).+ effects = { lens(10f.dp.toPx(), 14f.dp.toPx(), chromaticAberration = dispersion) },highlight = { Highlight.Default.copy(alpha = 0.35f) },shadow = { Shadow(alpha = 0.35f) },onDrawSurface = { drawRect(puckColor) },diff --git a/app/src/main/java/dev/lelonio/square/ui/player/AddToPlaylistSheet.kt b/app/src/main/java/dev/lelonio/square/ui/player/AddToPlaylistSheet.ktindex 1059aa9..102e891 100644--- a/app/src/main/java/dev/lelonio/square/ui/player/AddToPlaylistSheet.kt+++ b/app/src/main/java/dev/lelonio/square/ui/player/AddToPlaylistSheet.kt@@ -95,6 +95,8 @@ fun AddToPlaylistSheet(exit = slideOutVertically(tween(180)) { it / 6 } + fadeOut(tween(150)),modifier = Modifier.align(Alignment.BottomCenter),) {+ // Back closes it, as it closes the track menu (#132).+ androidx.activity.compose.BackHandler(onBack = onDismiss)GlassSurface(backdrop = backdrop,shape = RoundedCornerShape(28.dp),@@ -103,6 +105,8 @@ fun AddToPlaylistSheet(// layer, so at the usual radius the rows underneath came through// sharper inside the sheet than outside it.blurScale = 23.0f,+ // Never clear, whatever the frost is set to; see TrackSheet.+ minBlurDp = 24f,modifier = Modifier.padding(16.dp).fillMaxWidth()diff --git a/app/src/main/java/dev/lelonio/square/ui/player/GlassSurface.kt b/app/src/main/java/dev/lelonio/square/ui/player/GlassSurface.ktindex a5ea7c9..a3cbb23 100644--- a/app/src/main/java/dev/lelonio/square/ui/player/GlassSurface.kt+++ b/app/src/main/java/dev/lelonio/square/ui/player/GlassSurface.kt@@ -85,6 +85,14 @@ fun GlassSurface(* refraction cannot follow, or a moving player falls back to.*/surfaceColor: Color = Color.Unspecified,+ /**+ * The least this pane blurs, whatever the setting says.+ *+ * For the panes whose job is to stand in front of the page: a menu over a+ * list, with the frost turned down to nothing, showed the list sharp+ * through its own rows and could not be read (#132).+ */+ minBlurDp: Float = 0f,content: @Composable () -> Unit,) {// The same material the bottom bar is made of, so one app has one glass.@@ -103,7 +111,7 @@ fun GlassSurface(val config = dev.lelonio.square.ui.glass.LocalGlassEffectConfig.current// The refraction is part of that recipe now, and it is the reason this takes// a shape it can bend light along. Anything else keeps the film below.- val blurDp = (config.blurRadius * blurScale).coerceAtLeast(0f)+ val blurDp = (config.blurRadius * blurScale).coerceAtLeast(minBlurDp)val cornerShape = shape as? CornerBasedShapeif (cornerShape == null) {Box(