Add color styles and a station-colored fog option; compact About with MingCute icons

Styles match Matewave: Fogwave (default), Lavender, Peach, Mint, Sky and
Device (Material You, Android 12+). The fog and the disc ring follow the
style and no longer change with the station unless 'Fog in station color'
is switched on. About now has an Appearance section and grouped link rows.
This commit is contained in:
2026-11-12 16:26:57 +02:00
parent 73dd720533
commit ac19416c00
25 changed files with 679 additions and 178 deletions
@@ -11,11 +11,13 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import cc.skysparkle.fogwave.ui.screens.HomeScreen import cc.skysparkle.fogwave.ui.screens.HomeScreen
import cc.skysparkle.fogwave.ui.theme.AppThemeState
import cc.skysparkle.fogwave.ui.theme.FogwaveTheme import cc.skysparkle.fogwave.ui.theme.FogwaveTheme
class MainActivity : ComponentActivity() { class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
AppThemeState.load(this)
enableEdgeToEdge( enableEdgeToEdge(
statusBarStyle = SystemBarStyle.dark(Color.TRANSPARENT), statusBarStyle = SystemBarStyle.dark(Color.TRANSPARENT),
navigationBarStyle = SystemBarStyle.dark(Color.TRANSPARENT) navigationBarStyle = SystemBarStyle.dark(Color.TRANSPARENT)
@@ -1,40 +1,52 @@
package cc.skysparkle.fogwave.ui.components package cc.skysparkle.fogwave.ui.components
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.animateColorAsState
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.border import androidx.compose.foundation.border
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.selection.toggleable
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Switch
import androidx.compose.material3.SwitchDefaults
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
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.draw.shadow
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import cc.skysparkle.fogwave.BuildConfig import cc.skysparkle.fogwave.BuildConfig
import cc.skysparkle.fogwave.R import cc.skysparkle.fogwave.R
import cc.skysparkle.fogwave.ui.theme.AppStyle
import cc.skysparkle.fogwave.ui.theme.AppThemeState
import cc.skysparkle.fogwave.ui.theme.GeoColors
import cc.skysparkle.fogwave.ui.theme.LocalGeoColors import cc.skysparkle.fogwave.ui.theme.LocalGeoColors
private const val REPOSITORY_URL = "https://git.skysparkle.cc/kalarina/Fogwave" private const val REPOSITORY_URL = "https://git.skysparkle.cc/kalarina/Fogwave"
@@ -48,179 +60,372 @@ fun AboutPanel(modifier: Modifier = Modifier) {
Column( Column(
modifier = modifier modifier = modifier
.fillMaxWidth() .fillMaxWidth()
.padding(horizontal = 20.dp, vertical = 12.dp), .padding(horizontal = 20.dp, vertical = 8.dp),
verticalArrangement = Arrangement.spacedBy(16.dp)
) {
Column(
modifier = Modifier
.fillMaxWidth()
.shadow(4.dp, RoundedCornerShape(24.dp))
.clip(RoundedCornerShape(24.dp))
.background(LocalGeoColors.current.surfaceContainer)
.border(1.dp, LocalGeoColors.current.outlineVariant, RoundedCornerShape(24.dp))
.padding(20.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(10.dp) verticalArrangement = Arrangement.spacedBy(10.dp)
) { ) {
Box( AppHeader()
modifier = Modifier
.size(64.dp) SectionLabel(stringResource(R.string.about_appearance))
.clip(RoundedCornerShape(20.dp)), GroupCard {
contentAlignment = Alignment.Center StylePicker()
) { CardDivider()
AppIcon( StationFogRow()
resId = R.drawable.ic_fogwave_logo,
contentDescription = stringResource(R.string.fogwave_logo_content_desc),
size = 52.dp
)
} }
Text( SectionLabel(stringResource(R.string.about_more))
text = stringResource(R.string.app_name), GroupCard {
style = MaterialTheme.typography.titleLarge.copy( LinkRow(
fontWeight = FontWeight.ExtraBold, iconRes = R.drawable.ic_mc_code,
fontSize = 22.sp,
letterSpacing = (-0.5).sp,
color = LocalGeoColors.current.deepPurple
)
)
// Comes straight from versionName in app/build.gradle.kts, so it can never drift.
Text(
text = stringResource(R.string.about_version, BuildConfig.VERSION_NAME),
style = MaterialTheme.typography.labelMedium.copy(
fontWeight = FontWeight.SemiBold,
color = LocalGeoColors.current.primary
),
modifier = Modifier.testTag("about_version")
)
Text(
text = stringResource(R.string.about_description),
style = MaterialTheme.typography.bodyMedium.copy(
fontSize = 13.5.sp,
lineHeight = 20.sp,
color = LocalGeoColors.current.onSurfaceVariant,
textAlign = TextAlign.Center
),
modifier = Modifier.padding(top = 4.dp)
)
}
AboutLinkCard(
iconRes = R.drawable.ic_repo,
iconTint = null,
title = stringResource(R.string.about_my_repository), title = stringResource(R.string.about_my_repository),
subtitle = REPOSITORY_URL.removePrefix("https://git.skysparkle.cc/"), subtitle = REPOSITORY_URL.removePrefix("https://"),
trailingIconRes = R.drawable.ic_open_in_new, external = true,
onClick = { context.openUrl(REPOSITORY_URL) }, onClick = { context.openUrl(REPOSITORY_URL) },
modifier = Modifier.testTag("github_repo_card") modifier = Modifier.testTag("github_repo_card")
) )
CardDivider()
AboutLinkCard( LinkRow(
iconRes = R.drawable.ic_privacy, iconRes = R.drawable.ic_mc_shield,
title = stringResource(R.string.privacy_title), title = stringResource(R.string.privacy_title),
subtitle = stringResource(R.string.privacy_subtitle), subtitle = stringResource(R.string.privacy_subtitle),
trailingIconRes = R.drawable.ic_open_in_new, external = true,
onClick = { context.openUrl(PRIVACY_POLICY_URL) }, onClick = { context.openUrl(PRIVACY_POLICY_URL) },
modifier = Modifier.testTag("privacy_card") modifier = Modifier.testTag("privacy_card")
) )
CardDivider()
AboutLinkCard( LinkRow(
iconRes = R.drawable.ic_copyright, iconRes = R.drawable.ic_mc_copyright,
title = stringResource(R.string.licenses_title), title = stringResource(R.string.licenses_title),
subtitle = stringResource(R.string.licenses_subtitle), subtitle = stringResource(R.string.licenses_subtitle),
trailingIconRes = R.drawable.ic_chevron_right, external = false,
onClick = { showLicenses = true }, onClick = { showLicenses = true },
modifier = Modifier.testTag("licenses_card") modifier = Modifier.testTag("licenses_card")
) )
} }
}
if (showLicenses) { if (showLicenses) {
LicensesDialog(onDismiss = { showLicenses = false }) LicensesDialog(onDismiss = { showLicenses = false })
} }
} }
/** Logo, name and version in one row, the description underneath. */
@Composable @Composable
private fun AboutLinkCard( private fun AppHeader() {
@DrawableRes iconRes: Int, val colors = LocalGeoColors.current
title: String, GroupCard(contentPadding = 16.dp) {
subtitle: String,
@DrawableRes trailingIconRes: Int,
onClick: () -> Unit,
modifier: Modifier = Modifier,
iconTint: Color? = LocalGeoColors.current.deepPurple
) {
val opensBrowser = trailingIconRes == R.drawable.ic_open_in_new
Row( Row(
modifier = modifier
.fillMaxWidth()
.shadow(4.dp, RoundedCornerShape(20.dp))
.clip(RoundedCornerShape(20.dp))
.background(LocalGeoColors.current.surfaceContainer)
.border(1.2.dp, LocalGeoColors.current.outlineVariant, RoundedCornerShape(20.dp))
.clickable(
onClickLabel = if (opensBrowser) stringResource(R.string.about_open_in_browser) else null,
role = Role.Button,
onClick = onClick
)
.padding(16.dp),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(14.dp) horizontalArrangement = Arrangement.spacedBy(14.dp)
) { ) {
Box( Box(
modifier = Modifier modifier = Modifier
.size(48.dp) .size(52.dp)
.clip(RoundedCornerShape(14.dp)) .clip(RoundedCornerShape(16.dp))
.background(LocalGeoColors.current.primaryContainer) .background(colors.primaryContainer),
.border(1.dp, LocalGeoColors.current.outlineVariant, RoundedCornerShape(14.dp)),
contentAlignment = Alignment.Center contentAlignment = Alignment.Center
) { ) {
AppIcon( AppIcon(
resId = iconRes, resId = R.drawable.ic_fogwave_logo,
tint = iconTint ?: Color.Unspecified, contentDescription = stringResource(R.string.fogwave_logo_content_desc),
size = if (iconTint == null) 32.dp else 26.dp size = 40.dp
) )
} }
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
Column(modifier = Modifier.weight(1f)) {
Text( Text(
text = title, text = stringResource(R.string.app_name),
style = MaterialTheme.typography.titleSmall.copy( style = MaterialTheme.typography.titleLarge.copy(
fontWeight = FontWeight.ExtraBold,
fontSize = 21.sp,
letterSpacing = (-0.4).sp,
color = colors.deepPurple
)
)
// Comes straight from versionName in app/build.gradle.kts, so it can never drift.
Text(
text = stringResource(R.string.about_version, BuildConfig.VERSION_NAME),
style = MaterialTheme.typography.labelSmall.copy(
fontWeight = FontWeight.Bold, fontWeight = FontWeight.Bold,
fontSize = 15.sp, fontSize = 11.sp,
color = LocalGeoColors.current.deepPurple color = colors.primary
) ),
modifier = Modifier
.clip(CircleShape)
.background(colors.primaryContainer)
.padding(horizontal = 9.dp, vertical = 3.dp)
.testTag("about_version")
) )
}
}
Text( Text(
text = subtitle, text = stringResource(R.string.about_description),
style = MaterialTheme.typography.bodySmall.copy(
fontSize = 13.sp,
lineHeight = 19.sp,
color = colors.onSurfaceVariant
),
modifier = Modifier.padding(top = 12.dp)
)
}
}
@Composable
private fun StylePicker() {
val context = LocalContext.current
val colors = LocalGeoColors.current
val selected = AppThemeState.style
val styles = remember { AppStyle.available }
Column(modifier = Modifier.padding(16.dp)) {
RowHeader(iconRes = R.drawable.ic_mc_palette, title = stringResource(R.string.app_style_title))
Row(
modifier = Modifier
.fillMaxWidth()
.padding(top = 14.dp),
horizontalArrangement = Arrangement.spacedBy(4.dp)
) {
styles.forEach { style ->
StyleSwatch(
style = style,
preview = remember(style) { AppThemeState.colorsFor(context, style) },
selected = style == selected,
onClick = { AppThemeState.select(context, style) },
modifier = Modifier.weight(1f)
)
}
}
AnimatedVisibility(visible = selected == AppStyle.DEVICE) {
Text(
text = stringResource(R.string.app_style_device_hint),
style = MaterialTheme.typography.bodySmall.copy( style = MaterialTheme.typography.bodySmall.copy(
fontSize = 12.sp, fontSize = 12.sp,
color = LocalGeoColors.current.primary lineHeight = 17.sp,
) color = colors.onSurfaceVariant
),
modifier = Modifier.padding(top = 12.dp)
) )
} }
}
}
if (opensBrowser) { @Composable
private fun StyleSwatch(
style: AppStyle,
preview: GeoColors,
selected: Boolean,
onClick: () -> Unit,
modifier: Modifier = Modifier
) {
val colors = LocalGeoColors.current
val ring by animateColorAsState(if (selected) colors.deepPurple else Color.Transparent, label = "swatch_ring")
Column(
modifier = modifier
.clip(RoundedCornerShape(14.dp))
.selectable(selected = selected, role = Role.RadioButton, onClick = onClick)
.padding(vertical = 6.dp)
.testTag("style_${style.name.lowercase()}"),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(6.dp)
) {
// The outer ring shows the selection; inside, the style's accent over its background
Box( Box(
modifier = Modifier modifier = Modifier
.size(36.dp) .size(42.dp)
.border(2.dp, ring, CircleShape)
.padding(4.dp)
.clip(CircleShape) .clip(CircleShape)
.background(LocalGeoColors.current.primaryContainer), .background(preview.surfaceContainerHigh),
contentAlignment = Alignment.Center contentAlignment = Alignment.Center
) { ) {
AppIcon( Box(
resId = trailingIconRes, modifier = Modifier
tint = LocalGeoColors.current.deepPurple, .size(24.dp)
size = 18.dp .clip(CircleShape)
.background(preview.accentLavender),
contentAlignment = Alignment.Center
) {
if (selected) {
AppIcon(resId = R.drawable.ic_mc_check, tint = preview.onAccentLavender, size = 15.dp)
}
}
}
Text(
text = stringResource(style.titleRes),
style = MaterialTheme.typography.labelSmall.copy(
fontSize = 11.sp,
fontWeight = if (selected) FontWeight.Bold else FontWeight.Medium,
color = if (selected) colors.deepPurple else colors.onSurfaceVariant
),
maxLines = 1,
overflow = TextOverflow.Ellipsis
) )
} }
} else { }
@Composable
private fun StationFogRow() {
val context = LocalContext.current
val colors = LocalGeoColors.current
val checked = AppThemeState.stationFog
Row(
modifier = Modifier
.fillMaxWidth()
.toggleable(
value = checked,
role = Role.Switch,
onValueChange = { AppThemeState.setStationFog(context, it) }
)
.padding(16.dp)
.testTag("station_fog_toggle"),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp)
) {
RowIcon(R.drawable.ic_mc_fog)
Column(modifier = Modifier.weight(1f)) {
RowTitle(stringResource(R.string.station_fog_title))
RowSubtitle(stringResource(R.string.station_fog_subtitle), maxLines = 3)
}
// The row handles the tap, so the switch itself only shows the state
Switch(
checked = checked,
onCheckedChange = null,
colors = SwitchDefaults.colors(
checkedThumbColor = colors.onAccentLavender,
checkedTrackColor = colors.accentLavender,
checkedBorderColor = colors.accentLavender,
uncheckedThumbColor = colors.onSurfaceVariant,
uncheckedTrackColor = colors.surfaceContainerHigh,
uncheckedBorderColor = colors.outline
)
)
}
}
@Composable
private fun LinkRow(
@DrawableRes iconRes: Int,
title: String,
subtitle: String,
external: Boolean,
onClick: () -> Unit,
modifier: Modifier = Modifier
) {
Row(
modifier = modifier
.fillMaxWidth()
.clickable(
onClickLabel = if (external) stringResource(R.string.about_open_in_browser) else null,
role = Role.Button,
onClick = onClick
)
.padding(horizontal = 16.dp, vertical = 13.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp)
) {
RowIcon(iconRes)
Column(modifier = Modifier.weight(1f)) {
RowTitle(title)
RowSubtitle(subtitle)
}
AppIcon( AppIcon(
resId = trailingIconRes, resId = if (external) R.drawable.ic_mc_external else R.drawable.ic_mc_right,
tint = LocalGeoColors.current.onSurfaceVariant, tint = LocalGeoColors.current.onSurfaceVariant,
size = 18.dp size = 18.dp
) )
} }
} }
@Composable
private fun RowHeader(@DrawableRes iconRes: Int, title: String) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp)
) {
RowIcon(iconRes)
RowTitle(title)
}
}
@Composable
private fun RowIcon(@DrawableRes iconRes: Int) {
Box(
modifier = Modifier
.size(36.dp)
.clip(RoundedCornerShape(11.dp))
.background(LocalGeoColors.current.primaryContainer),
contentAlignment = Alignment.Center
) {
AppIcon(resId = iconRes, tint = LocalGeoColors.current.primary, size = 20.dp)
}
}
@Composable
private fun RowTitle(text: String) {
Text(
text = text,
style = MaterialTheme.typography.titleSmall.copy(
fontWeight = FontWeight.Bold,
fontSize = 14.5.sp,
color = LocalGeoColors.current.deepPurple
),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
@Composable
private fun RowSubtitle(text: String, maxLines: Int = 1) {
Text(
text = text,
style = MaterialTheme.typography.bodySmall.copy(
fontSize = 12.sp,
lineHeight = 16.sp,
color = LocalGeoColors.current.onSurfaceVariant
),
maxLines = maxLines,
overflow = TextOverflow.Ellipsis
)
}
@Composable
private fun SectionLabel(text: String) {
Text(
text = text.uppercase(),
style = MaterialTheme.typography.labelSmall.copy(
fontWeight = FontWeight.Bold,
fontSize = 11.sp,
letterSpacing = 1.2.sp,
color = LocalGeoColors.current.onSurfaceVariant
),
modifier = Modifier.padding(start = 6.dp, top = 8.dp)
)
}
/** Rows grouped on one rounded card, like a settings list. */
@Composable
private fun GroupCard(
contentPadding: Dp = 0.dp,
content: @Composable ColumnScope.() -> Unit
) {
Column(
modifier = Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(22.dp))
.background(LocalGeoColors.current.surfaceContainer)
.border(1.dp, LocalGeoColors.current.outlineVariant, RoundedCornerShape(22.dp))
.padding(contentPadding),
content = content
)
}
@Composable
private fun CardDivider() {
Box(
modifier = Modifier
.fillMaxWidth()
.padding(start = 64.dp)
.height(1.dp)
.background(LocalGeoColors.current.outlineVariant)
)
} }
@@ -77,6 +77,7 @@ import cc.skysparkle.fogwave.data.model.ExtraPlayerTab
import cc.skysparkle.fogwave.data.model.RadioStation import cc.skysparkle.fogwave.data.model.RadioStation
import cc.skysparkle.fogwave.player.AudioEffectsState import cc.skysparkle.fogwave.player.AudioEffectsState
import cc.skysparkle.fogwave.player.PlayerState import cc.skysparkle.fogwave.player.PlayerState
import cc.skysparkle.fogwave.ui.theme.AppThemeState
import cc.skysparkle.fogwave.ui.theme.LocalGeoColors import cc.skysparkle.fogwave.ui.theme.LocalGeoColors
import kotlin.math.roundToInt import kotlin.math.roundToInt
@@ -120,7 +121,7 @@ fun NowPlayingSheet(
) )
} }
val accent by animateColorAsState( val accent by animateColorAsState(
targetValue = rememberStationArt(station).accentOr(colors.accentLavender), targetValue = rememberStationArt(station).takeIf { AppThemeState.stationFog }.accentOr(colors.accentLavender),
animationSpec = tween(700), animationSpec = tween(700),
label = "page_accent" label = "page_accent"
) )
@@ -32,6 +32,7 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import cc.skysparkle.fogwave.data.model.RadioStation import cc.skysparkle.fogwave.data.model.RadioStation
import cc.skysparkle.fogwave.ui.theme.AppThemeState
import cc.skysparkle.fogwave.ui.theme.LocalGeoColors import cc.skysparkle.fogwave.ui.theme.LocalGeoColors
import kotlin.math.cos import kotlin.math.cos
import kotlin.math.min import kotlin.math.min
@@ -56,7 +57,7 @@ fun StationDisc(
val colors = LocalGeoColors.current val colors = LocalGeoColors.current
val art = rememberStationArt(station) val art = rememberStationArt(station)
val accent by animateColorAsState( val accent by animateColorAsState(
targetValue = art.accentOr(colors.primary), targetValue = art.takeIf { AppThemeState.stationFog }.accentOr(colors.primary),
animationSpec = tween(600), animationSpec = tween(600),
label = "disc_accent" label = "disc_accent"
) )
@@ -73,6 +73,7 @@ import cc.skysparkle.fogwave.ui.components.TopBrandBar
import cc.skysparkle.fogwave.ui.components.accentOr import cc.skysparkle.fogwave.ui.components.accentOr
import cc.skysparkle.fogwave.ui.components.rememberStationArt import cc.skysparkle.fogwave.ui.components.rememberStationArt
import cc.skysparkle.fogwave.ui.components.stationDescription import cc.skysparkle.fogwave.ui.components.stationDescription
import cc.skysparkle.fogwave.ui.theme.AppThemeState
import cc.skysparkle.fogwave.ui.theme.LocalGeoColors import cc.skysparkle.fogwave.ui.theme.LocalGeoColors
import cc.skysparkle.fogwave.ui.viewmodel.RadioViewModel import cc.skysparkle.fogwave.ui.viewmodel.RadioViewModel
@@ -116,7 +117,10 @@ fun HomeScreen(
val radioListState = rememberLazyListState() val radioListState = rememberLazyListState()
val accent by animateColorAsState( val accent by animateColorAsState(
targetValue = uiState.currentStation?.let { rememberStationArt(it) }.accentOr(LocalGeoColors.current.accentLavender), // The style's colour unless the user asked for each station's own
targetValue = uiState.currentStation?.let { rememberStationArt(it) }
.takeIf { AppThemeState.stationFog }
.accentOr(LocalGeoColors.current.accentLavender),
animationSpec = tween(700), animationSpec = tween(700),
label = "home_accent" label = "home_accent"
) )
@@ -0,0 +1,126 @@
package cc.skysparkle.fogwave.ui.theme
import android.content.Context
import android.os.Build
import androidx.annotation.StringRes
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.lerp
import cc.skysparkle.fogwave.R
/** Colour styles, the same set as in Matewave. Every style is dark. */
enum class AppStyle(@param:StringRes val titleRes: Int) {
FOGWAVE(R.string.app_style_fogwave),
LAVENDER(R.string.app_style_lavender),
PEACH(R.string.app_style_peach),
MINT(R.string.app_style_mint),
SKY(R.string.app_style_sky),
DEVICE(R.string.app_style_device);
companion object {
/** Wallpaper colours exist from Android 12. */
val deviceSupported: Boolean get() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
val available: List<AppStyle> get() = entries.filter { it != DEVICE || deviceSupported }
}
}
/** The selected style, kept in compose state so every screen recolours at once. */
object AppThemeState {
private const val PREFS = "app_theme"
private const val KEY_STYLE = "style"
private const val KEY_STATION_FOG = "station_fog"
var style by mutableStateOf(AppStyle.FOGWAVE)
private set
var colors by mutableStateOf(DarkGeoColors)
private set
/** Fog and the disc ring take the playing station's colour instead of the style's. */
var stationFog by mutableStateOf(false)
private set
/** Reads the saved settings; call before the first frame. */
fun load(context: Context) {
val prefs = prefs(context)
val saved = prefs.getString(KEY_STYLE, null)
stationFog = prefs.getBoolean(KEY_STATION_FOG, false)
apply(context, AppStyle.entries.firstOrNull { it.name == saved } ?: AppStyle.FOGWAVE)
}
fun select(context: Context, style: AppStyle) {
prefs(context).edit().putString(KEY_STYLE, style.name).apply()
apply(context, style)
}
fun setStationFog(context: Context, enabled: Boolean) {
prefs(context).edit().putBoolean(KEY_STATION_FOG, enabled).apply()
stationFog = enabled
}
/** Colours of a style, also used for the previews in the picker. */
fun colorsFor(context: Context, style: AppStyle): GeoColors = when (style) {
AppStyle.FOGWAVE -> DarkGeoColors
AppStyle.LAVENDER -> styleColors(Color(0xFFC8B6FF), Color(0xFF1E1630), Color(0xFF0F0E14), Color(0xFF1A1822), Color(0xFF25222F))
AppStyle.PEACH -> styleColors(Color(0xFFFFB59E), Color(0xFF2A1710), Color(0xFF12100E), Color(0xFF1D1A17), Color(0xFF28231F))
AppStyle.MINT -> styleColors(Color(0xFF9EE7C8), Color(0xFF0F231B), Color(0xFF0D110F), Color(0xFF171C1A), Color(0xFF202724))
AppStyle.SKY -> styleColors(Color(0xFFA5CBFF), Color(0xFF0F1A2A), Color(0xFF0D1014), Color(0xFF171B21), Color(0xFF20252D))
AppStyle.DEVICE -> deviceColors(context)
}
private fun apply(context: Context, requested: AppStyle) {
val style = if (requested == AppStyle.DEVICE && !AppStyle.deviceSupported) AppStyle.FOGWAVE else requested
this.style = style
colors = colorsFor(context, style)
}
private fun deviceColors(context: Context): GeoColors {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) return DarkGeoColors
val scheme = dynamicDarkColorScheme(context)
return styleColors(
accent = scheme.primary,
onAccent = scheme.onPrimary,
background = scheme.background,
surface1 = scheme.surfaceContainer,
surface2 = scheme.surfaceContainerHigh
)
}
private fun prefs(context: Context) =
context.applicationContext.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
}
/**
* Builds the full set from a style's few colours. Pastel styles use their accent for buttons too,
* with dark text on top, like in Matewave. The live dot and the favourite heart keep their own red.
*/
private fun styleColors(
accent: Color,
onAccent: Color,
background: Color,
surface1: Color,
surface2: Color
): GeoColors = DarkGeoColors.copy(
background = background,
surface = background,
surfaceContainer = surface1,
surfaceContainerHigh = surface2,
onSurfaceVariant = lerp(Color(0xFF9AA0AA), accent, 0.12f),
outline = lerp(surface2, Color.White, 0.3f),
outlineVariant = lerp(surface2, Color.White, 0.06f),
primary = accent,
onPrimary = onAccent,
primaryContainer = lerp(background, accent, 0.22f),
onPrimaryContainer = lerp(accent, Color.White, 0.75f),
secondary = lerp(accent, Color.White, 0.4f),
onSecondary = onAccent,
secondaryContainer = lerp(surface2, accent, 0.18f),
onSecondaryContainer = lerp(accent, Color.White, 0.75f),
accentLavender = accent,
onAccentLavender = onAccent,
deepPurple = lerp(Color.White, accent, 0.06f)
)
@@ -1,12 +1,13 @@
package cc.skysparkle.fogwave.ui.theme package cc.skysparkle.fogwave.ui.theme
import androidx.compose.material3.ColorScheme
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme import androidx.compose.material3.darkColorScheme
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.remember
private val DarkColorScheme = with(DarkGeoColors) { private fun GeoColors.toColorScheme(): ColorScheme = darkColorScheme(
darkColorScheme(
primary = primary, primary = primary,
onPrimary = onPrimary, onPrimary = onPrimary,
primaryContainer = primaryContainer, primaryContainer = primaryContainer,
@@ -23,11 +24,13 @@ private val DarkColorScheme = with(DarkGeoColors) {
onSurfaceVariant = onSurfaceVariant, onSurfaceVariant = onSurfaceVariant,
outline = outline outline = outline
) )
}
/** Always dark; the colours follow the style picked in About (see [AppThemeState]). */
@Composable @Composable
fun FogwaveTheme(content: @Composable () -> Unit) { fun FogwaveTheme(content: @Composable () -> Unit) {
CompositionLocalProvider(LocalGeoColors provides DarkGeoColors) { val colors = AppThemeState.colors
MaterialTheme(colorScheme = DarkColorScheme, typography = Typography, content = content) val scheme = remember(colors) { colors.toColorScheme() }
CompositionLocalProvider(LocalGeoColors provides colors) {
MaterialTheme(colorScheme = scheme, typography = Typography, content = content)
} }
} }
Binary file not shown.

Before

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1002 B

+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- MingCute icon "check_line" (Apache License 2.0) -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd"
android:pathData="M21.192 5.465a1 1 0 0 1 0 1.414L9.95 18.122a1.1 1.1 0 0 1-1.556 0l-5.586-5.586a1 1 0 1 1 1.415-1.415l4.95 4.95L19.777 5.465a1 1 0 0 1 1.414 0Z" />
</vector>
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- MingCute icon "code_line" (Apache License 2.0) -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M14.486 3.143a1 1 0 0 1 .692 1.233l-4.43 15.788a1 1 0 0 1-1.926-.54l4.43-15.788a1 1 0 0 1 1.234-.693M7.207 7.05a1 1 0 0 1 0 1.414L3.672 12l3.535 3.535a1 1 0 1 1-1.414 1.415L1.55 12.707a1 1 0 0 1 0-1.414L5.793 7.05a1 1 0 0 1 1.414 0m9.586 1.414a1 1 0 1 1 1.414-1.414l4.243 4.243a1 1 0 0 1 0 1.414l-4.243 4.243a1 1 0 0 1-1.414-1.415L20.328 12z" />
</vector>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- MingCute icon "copyright_line" (Apache License 2.0) -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16m0 3a4.99 4.99 0 0 1 3.75 1.692 1 1 0 1 1-1.5 1.324 3 3 0 1 0 0 3.968 1 1 0 1 1 1.5 1.324A5 5 0 1 1 12 7" />
</vector>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- MingCute icon "external_link_line" (Apache License 2.0) -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M11 6a1 1 0 1 1 0 2H5v11h11v-6a1 1 0 1 1 2 0v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2zm9-3a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0V6.414l-8.293 8.293a1 1 0 0 1-1.414-1.414L17.586 5H15a1 1 0 1 1 0-2Z" />
</vector>
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- MingCute icon "fog_line" (Apache License 2.0) -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd"
android:pathData="M11.5 2A6.5 6.5 0 0 0 5 8.416a5.004 5.004 0 0 0-2.961 3.96 1 1 0 1 0 1.984.248A3.004 3.004 0 0 1 6.27 10.09 1.01 1.01 0 0 0 7.027 9a4.5 4.5 0 0 1 8.817-1.679c.104.382.422.668.811.732a4.001 4.001 0 0 1 3.325 4.348 1 1 0 1 0 1.99.198 6.002 6.002 0 0 0-4.385-6.387A6.502 6.502 0 0 0 11.5 2M3 16a1 1 0 0 1 1-1h16a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1m4 4a1 1 0 0 1 1-1h9a1 1 0 1 1 0 2H8a1 1 0 0 1-1-1" />
</vector>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- MingCute icon "palette_line" (Apache License 2.0) -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M12 2c5.523 0 10 4.477 10 10 0 .649-.062 1.284-.18 1.9-.386 2.004-2.397 2.85-4.082 2.57l-1.74-.29a1.29 1.29 0 0 0-1.124.36c-.37.37-.547.879-.298 1.376.423.846.429 1.812.055 2.603C14.131 21.58 13.11 22 12 22 6.477 22 2 17.523 2 12S6.477 2 12 2m0 2a8 8 0 1 0 0 16l.195-.002c.258-.01.5-.06.628-.332a.993.993 0 0 0-.036-.855c-.63-1.262-.302-2.71.673-3.685a3.29 3.29 0 0 1 2.867-.919l1.74.29c.957.16 1.668-.348 1.789-.975A8 8 0 0 0 12 4m-4.5 7a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3m7-4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3m-5 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3" />
</vector>
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- MingCute icon "right_line" (Apache License 2.0) -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd"
android:pathData="M15.707 11.293a1 1 0 0 1 0 1.414l-5.657 5.657a1 1 0 1 1-1.414-1.414l4.95-4.95-4.95-4.95a1 1 0 0 1 1.414-1.414l5.657 5.657Z" />
</vector>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- MingCute icon "safe_shield_line" (Apache License 2.0) -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd"
android:pathData="M11.298 2.195a2 2 0 0 1 1.232-.055l.172.055 7 2.625a2 2 0 0 1 1.291 1.708l.007.165v5.363a9 9 0 0 1-4.709 7.911l-.266.139-3.354 1.677a1.5 1.5 0 0 1-1.198.062l-.144-.062-3.354-1.677a9 9 0 0 1-4.97-7.75l-.005-.3V6.693a2 2 0 0 1 1.145-1.808l.153-.065zM12 4.068 5 6.693v5.363a7 7 0 0 0 3.635 6.138l.235.123L12 19.882l3.13-1.565a7 7 0 0 0 3.865-5.997l.005-.264V6.693zm-.492 3.448a1.4 1.4 0 0 1 .846-.043l.138.043 2.8 1.05a1.4 1.4 0 0 1 .902 1.178l.006.133v2.145a4.2 4.2 0 0 1-2.131 3.655l-.19.102-1.342.67a1.2 1.2 0 0 1-.944.056l-.13-.055-1.341-.671a4.2 4.2 0 0 1-2.316-3.54l-.006-.217V9.877a1.4 1.4 0 0 1 .786-1.258l.122-.053zM12 9.468l-2.2.825v1.73a2.2 2.2 0 0 0 1.07 1.887l.146.08.984.492.984-.492a2.2 2.2 0 0 0 1.21-1.802l.006-.166v-1.729z" />
</vector>
+11
View File
@@ -114,4 +114,15 @@
<string name="share_content_desc">Teilen</string> <string name="share_content_desc">Teilen</string>
<string name="share_text">Ich höre %1$s mit Fogwave</string> <string name="share_text">Ich höre %1$s mit Fogwave</string>
<string name="share_text_track">Ich höre „%1$s“ auf %2$s mit Fogwave</string> <string name="share_text_track">Ich höre „%1$s“ auf %2$s mit Fogwave</string>
<string name="about_appearance">Darstellung</string>
<string name="about_more">Mehr</string>
<string name="app_style_title">App-Farben</string>
<string name="app_style_lavender">Lavendel</string>
<string name="app_style_peach">Pfirsich</string>
<string name="app_style_mint">Minze</string>
<string name="app_style_sky">Himmel</string>
<string name="app_style_device">Gerät</string>
<string name="app_style_device_hint">Die Farben kommen aus deinem Hintergrundbild (Material You) und ändern sich mit ihm.</string>
<string name="station_fog_title">Nebel in Senderfarbe</string>
<string name="station_fog_subtitle">Der Nebel und der Ring um das Cover nehmen die Farbe des laufenden Senders an</string>
</resources> </resources>
+11
View File
@@ -113,4 +113,15 @@
<string name="share_content_desc">共有</string> <string name="share_content_desc">共有</string>
<string name="share_text">Fogwaveで%1$sを聴いています</string> <string name="share_text">Fogwaveで%1$sを聴いています</string>
<string name="share_text_track">Fogwaveで%2$sの「%1$s」を聴いています</string> <string name="share_text_track">Fogwaveで%2$sの「%1$s」を聴いています</string>
<string name="about_appearance">外観</string>
<string name="about_more">その他</string>
<string name="app_style_title">アプリの色</string>
<string name="app_style_lavender">ラベンダー</string>
<string name="app_style_peach">ピーチ</string>
<string name="app_style_mint">ミント</string>
<string name="app_style_sky">スカイ</string>
<string name="app_style_device">端末</string>
<string name="app_style_device_hint">色は壁紙から取得され(Material You)、壁紙に合わせて変わります。</string>
<string name="station_fog_title">局の色の霧</string>
<string name="station_fog_subtitle">霧とディスクの周りのリングが再生中の局の色になります</string>
</resources> </resources>
+11
View File
@@ -116,4 +116,15 @@
<string name="share_content_desc">Bendrinti</string> <string name="share_content_desc">Bendrinti</string>
<string name="share_text">Klausausi %1$s per Fogwave</string> <string name="share_text">Klausausi %1$s per Fogwave</string>
<string name="share_text_track">Klausausi „%1$s“ per %2$s su Fogwave</string> <string name="share_text_track">Klausausi „%1$s“ per %2$s su Fogwave</string>
<string name="about_appearance">Išvaizda</string>
<string name="about_more">Daugiau</string>
<string name="app_style_title">Programėlės spalvos</string>
<string name="app_style_lavender">Levanda</string>
<string name="app_style_peach">Persikas</string>
<string name="app_style_mint">Mėta</string>
<string name="app_style_sky">Dangus</string>
<string name="app_style_device">Fonas</string>
<string name="app_style_device_hint">Spalvos paimamos iš ekrano fono („Material You“) ir keičiasi kartu su juo.</string>
<string name="station_fog_title">Rūkas stoties spalva</string>
<string name="station_fog_subtitle">Rūkas ir žiedas aplink diską nusidažo grojančios stoties spalva</string>
</resources> </resources>
+11
View File
@@ -116,4 +116,15 @@
<string name="share_content_desc">Поделиться</string> <string name="share_content_desc">Поделиться</string>
<string name="share_text">Слушаю %1$s в Fogwave</string> <string name="share_text">Слушаю %1$s в Fogwave</string>
<string name="share_text_track">Слушаю «%1$s» на %2$s в Fogwave</string> <string name="share_text_track">Слушаю «%1$s» на %2$s в Fogwave</string>
<string name="about_appearance">Оформление</string>
<string name="about_more">Ещё</string>
<string name="app_style_title">Цвета приложения</string>
<string name="app_style_lavender">Лаванда</string>
<string name="app_style_peach">Персик</string>
<string name="app_style_mint">Мята</string>
<string name="app_style_sky">Небо</string>
<string name="app_style_device">Обои</string>
<string name="app_style_device_hint">Цвета берутся из обоев (Material You) и меняются вместе с ними.</string>
<string name="station_fog_title">Туман в цвете станции</string>
<string name="station_fog_subtitle">Туман и кольцо вокруг диска окрашиваются в цвет играющей станции</string>
</resources> </resources>
+11
View File
@@ -113,4 +113,15 @@
<string name="share_content_desc">分享</string> <string name="share_content_desc">分享</string>
<string name="share_text">我正在用 Fogwave 收听 %1$s</string> <string name="share_text">我正在用 Fogwave 收听 %1$s</string>
<string name="share_text_track">我正在用 Fogwave 收听 %2$s 的“%1$s”</string> <string name="share_text_track">我正在用 Fogwave 收听 %2$s 的“%1$s”</string>
<string name="about_appearance">外观</string>
<string name="about_more">更多</string>
<string name="app_style_title">应用配色</string>
<string name="app_style_lavender">薰衣草</string>
<string name="app_style_peach">蜜桃</string>
<string name="app_style_mint">薄荷</string>
<string name="app_style_sky">天空</string>
<string name="app_style_device">设备</string>
<string name="app_style_device_hint">颜色取自壁纸(Material You),并随壁纸变化。</string>
<string name="station_fog_title">电台颜色的雾</string>
<string name="station_fog_subtitle">雾和唱片周围的圆环会变成正在播放电台的颜色</string>
</resources> </resources>
+12
View File
@@ -114,4 +114,16 @@
<string name="share_content_desc">Share</string> <string name="share_content_desc">Share</string>
<string name="share_text">I\'m listening to %1$s on Fogwave</string> <string name="share_text">I\'m listening to %1$s on Fogwave</string>
<string name="share_text_track">I\'m listening to “%1$s” on %2$s with Fogwave</string> <string name="share_text_track">I\'m listening to “%1$s” on %2$s with Fogwave</string>
<string name="about_appearance">Appearance</string>
<string name="about_more">More</string>
<string name="app_style_title">App colors</string>
<string name="app_style_fogwave" translatable="false">Fogwave</string>
<string name="app_style_lavender">Lavender</string>
<string name="app_style_peach">Peach</string>
<string name="app_style_mint">Mint</string>
<string name="app_style_sky">Sky</string>
<string name="app_style_device">Device</string>
<string name="app_style_device_hint">Colors are taken from your wallpaper (Material You) and change with it.</string>
<string name="station_fog_title">Fog in station color</string>
<string name="station_fog_subtitle">The fog and the ring around the disc take the color of the playing station</string>
</resources> </resources>