mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 15:29:15 +01:00
revert the mini player to a solid, slightly desaturated colour
This commit is contained in:
@@ -4,7 +4,6 @@ import androidx.compose.foundation.basicMarquee
|
|||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
@@ -20,19 +19,22 @@ import androidx.compose.material3.CircularProgressIndicator
|
|||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.graphics.lerp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.subtracks.data.model.CoverArtRef
|
import com.subtracks.data.model.CoverArtRef
|
||||||
import com.subtracks.playback.PlaybackState
|
import com.subtracks.playback.PlaybackState
|
||||||
import com.subtracks.ui.components.CoverArt
|
import com.subtracks.ui.components.CoverArt
|
||||||
import com.subtracks.ui.theme.ArtworkColors
|
import com.subtracks.ui.theme.ArtworkColors
|
||||||
import com.subtracks.ui.theme.ArtworkTheme
|
import com.subtracks.ui.theme.ArtworkTheme
|
||||||
import com.subtracks.ui.theme.HeroGradient
|
import com.subtracks.ui.theme.toHsl
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun MiniPlayer(
|
fun MiniPlayer(
|
||||||
@@ -46,7 +48,13 @@ fun MiniPlayer(
|
|||||||
) {
|
) {
|
||||||
val item = state.item ?: return
|
val item = state.item ?: return
|
||||||
ArtworkTheme(artwork) {
|
ArtworkTheme(artwork) {
|
||||||
Box(
|
Surface(
|
||||||
|
color =
|
||||||
|
artwork?.let {
|
||||||
|
val (hue, saturation, lightness) = lerp(it.scheme.surfaceContainerHigh, it.gradientHigh, 0.5f).toHsl()
|
||||||
|
Color.hsl(hue, saturation * 0.65f, lightness)
|
||||||
|
} ?: MaterialTheme.colorScheme.surfaceContainerHigh,
|
||||||
|
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||||
modifier =
|
modifier =
|
||||||
modifier.fillMaxWidth().clickable(
|
modifier.fillMaxWidth().clickable(
|
||||||
interactionSource = remember { MutableInteractionSource() },
|
interactionSource = remember { MutableInteractionSource() },
|
||||||
@@ -54,12 +62,6 @@ fun MiniPlayer(
|
|||||||
onClick = onExpand,
|
onClick = onExpand,
|
||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
HeroGradient(
|
|
||||||
colors = artwork,
|
|
||||||
scrollPx = { 0f },
|
|
||||||
compact = true,
|
|
||||||
modifier = Modifier.matchParentSize(),
|
|
||||||
)
|
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
|
|||||||
@@ -210,7 +210,6 @@ fun HeroGradient(
|
|||||||
colors: ArtworkColors?,
|
colors: ArtworkColors?,
|
||||||
scrollPx: () -> Float,
|
scrollPx: () -> Float,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
compact: Boolean = false,
|
|
||||||
) {
|
) {
|
||||||
val high = colors?.gradientHigh ?: MaterialTheme.colorScheme.surfaceContainerHigh
|
val high = colors?.gradientHigh ?: MaterialTheme.colorScheme.surfaceContainerHigh
|
||||||
val low = colors?.gradientLow ?: MaterialTheme.colorScheme.background
|
val low = colors?.gradientLow ?: MaterialTheme.colorScheme.background
|
||||||
@@ -219,7 +218,7 @@ fun HeroGradient(
|
|||||||
val seed = colors?.blobSeed ?: 0
|
val seed = colors?.blobSeed ?: 0
|
||||||
|
|
||||||
Canvas(modifier) {
|
Canvas(modifier) {
|
||||||
val period = size.height * if (compact) 1f else PERIOD_SCREENS
|
val period = size.height * PERIOD_SCREENS
|
||||||
if (period <= 0f) return@Canvas
|
if (period <= 0f) return@Canvas
|
||||||
val scroll = scrollPx()
|
val scroll = scrollPx()
|
||||||
val phase = scroll.mod(period)
|
val phase = scroll.mod(period)
|
||||||
@@ -234,15 +233,10 @@ fun HeroGradient(
|
|||||||
)
|
)
|
||||||
if (accents.isNotEmpty()) {
|
if (accents.isNotEmpty()) {
|
||||||
val random = Random(seed)
|
val random = Random(seed)
|
||||||
repeat(if (compact) 3 else BLOB_COUNT) { index ->
|
repeat(BLOB_COUNT) { index ->
|
||||||
val centerX = size.width * (0.10f + random.nextFloat() * 0.80f)
|
val centerX = size.width * (0.10f + random.nextFloat() * 0.80f)
|
||||||
val baseY = period * BLOB_ZONE * random.nextFloat()
|
val baseY = period * BLOB_ZONE * random.nextFloat()
|
||||||
val radius =
|
val radius = size.width * (0.45f + random.nextFloat() * 0.35f)
|
||||||
if (compact) {
|
|
||||||
size.height * (0.70f + random.nextFloat() * 0.70f)
|
|
||||||
} else {
|
|
||||||
size.width * (0.45f + random.nextFloat() * 0.35f)
|
|
||||||
}
|
|
||||||
val alpha = 0.50f + random.nextFloat() * 0.32f
|
val alpha = 0.50f + random.nextFloat() * 0.32f
|
||||||
val accent = accents[index % accents.size]
|
val accent = accents[index % accents.size]
|
||||||
for (shift in -1..1) {
|
for (shift in -1..1) {
|
||||||
@@ -259,7 +253,6 @@ fun HeroGradient(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (compact) return@Canvas
|
|
||||||
val darkenStart = size.height * DARKEN_START_SCREENS - scroll
|
val darkenStart = size.height * DARKEN_START_SCREENS - scroll
|
||||||
val darkenEnd = size.height * DARKEN_END_SCREENS - scroll
|
val darkenEnd = size.height * DARKEN_END_SCREENS - scroll
|
||||||
drawRect(
|
drawRect(
|
||||||
|
|||||||
Reference in New Issue
Block a user