Smaller fixes from the review

- Turn off cloud backup (allowBackup=false); Android 12+ still allows
  device-to-device transfer.
- Strip Log.d/Log.v from release builds.
- Drop Coil (and OkHttp/Okio with it): the backdrop is a local image.
- Pause the home fog while the player covers it and cache its gradients.
- List all 14 broadcasters under Licenses.
- Pin the Gradle 9.7.1 distribution checksum.
- Equalizer units come from string resources (Russian uses дБ/Гц/кГц).
- Play buttons are announced as buttons.
- Remove the unused ic_sleep image and a stale preference cleanup.
This commit is contained in:
2026-11-12 16:43:34 +02:00
parent 847aa8daae
commit 5fd7be69e1
19 changed files with 129 additions and 69 deletions
-2
View File
@@ -27,7 +27,6 @@ android {
buildConfigField("String", "MEDIA3_VERSION", "\"${libs.versions.media3.get()}\"")
buildConfigField("String", "COROUTINES_VERSION", "\"${libs.versions.kotlinxCoroutinesAndroid.get()}\"")
buildConfigField("String", "KOTLIN_VERSION", "\"${libs.versions.kotlin.get()}\"")
buildConfigField("String", "COIL_VERSION", "\"${libs.versions.coilCompose.get()}\"")
}
// Release signing is applied only when a keystore is available, so anyone (including F-Droid,
@@ -83,7 +82,6 @@ dependencies {
implementation(libs.androidx.lifecycle.runtime.compose)
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.coil.compose)
implementation(libs.androidx.media3.exoplayer)
implementation(libs.androidx.media3.exoplayer.hls)
implementation(libs.androidx.media3.common)
+6
View File
@@ -1,2 +1,8 @@
-keepattributes SourceFile,LineNumberTable
-renamesourcefileattribute SourceFile
# Debug and verbose logging is stripped from release builds.
-assumenosideeffects class android.util.Log {
public static int d(...);
public static int v(...);
}
+1 -4
View File
@@ -8,10 +8,7 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
<application
android:name=".FogwaveApp"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:localeConfig="@xml/locales_config"
@@ -167,7 +167,7 @@ class RadioRepository(context: Context) {
fun markFavoritesSeen(ids: Set<String>) {
val copy = ids.toSet()
_seenFavoritesFlow.value = copy
prefs.edit { putStringSet("seen_favorites", copy); remove("last_seen_favorites_count") }
prefs.edit { putStringSet("seen_favorites", copy) }
}
fun getLastStationId(): String? {
@@ -177,7 +177,7 @@ fun EqualizerSheet(
) {
val db = (band.levelMillibel / 100f).roundToInt()
Text(
text = if (db > 0) "+$db dB" else "$db dB",
text = stringResource(R.string.eq_gain_db, if (db > 0) "+$db" else "$db"),
style = MaterialTheme.typography.labelSmall.copy(
fontSize = 11.sp,
fontWeight = FontWeight.SemiBold,
@@ -356,10 +356,11 @@ private fun ToggleRow(
}
}
@Composable
private fun frequencyLabel(hz: Int): String = when {
hz < 1000 -> "$hz Hz"
hz % 1000 == 0 -> "${hz / 1000} kHz"
else -> String.format(Locale.getDefault(), "%.1f kHz", hz / 1000f)
hz < 1000 -> stringResource(R.string.eq_freq_hz, hz.toString())
hz % 1000 == 0 -> stringResource(R.string.eq_freq_khz, (hz / 1000).toString())
else -> stringResource(R.string.eq_freq_khz, String.format(Locale.getDefault(), "%.1f", hz / 1000f))
}
// Preset names come from the device's audio framework in English; translate the standard ones.
@@ -6,11 +6,12 @@ import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.Spacer
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clipToBounds
import androidx.compose.ui.draw.drawWithCache
import androidx.compose.ui.draw.drawWithContent
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.BlendMode
@@ -18,6 +19,7 @@ import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.CompositingStrategy
import androidx.compose.ui.graphics.drawscope.DrawScope
import androidx.compose.ui.graphics.drawscope.translate
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.graphics.lerp
import kotlin.math.PI
@@ -47,56 +49,91 @@ private val Wisps = listOf(
/**
* Slowly drifting colored fog — Fogwave's signature backdrop. [tint] is usually the playing
* station's color. Only the draw phase reads the animation, so the fog never recomposes anything.
* With [animate] off (the layer is covered, e.g. by the open player) the fog holds still and the
* animation stops; it resumes from the same spot.
*/
@Composable
fun FogLayer(
tint: Color,
modifier: Modifier = Modifier,
intensity: Float = 1f
intensity: Float = 1f,
animate: Boolean = true
) {
// Last drawn time and breathing, so a paused fog stays put and resumes without a jump.
val last = remember { floatArrayOf(0f, 1f) }
if (animate) {
val transition = rememberInfiniteTransition(label = "fog")
val t by transition.animateFloat(
val t = transition.animateFloat(
initialValue = 0f,
targetValue = (2 * PI).toFloat(),
targetValue = TWO_PI,
animationSpec = infiniteRepeatable(tween(28_000, easing = LinearEasing), RepeatMode.Restart),
label = "fog_t"
)
val breathe by transition.animateFloat(
val breathe = transition.animateFloat(
initialValue = 0.85f,
targetValue = 1f,
animationSpec = infiniteRepeatable(tween(6_000), RepeatMode.Reverse),
label = "fog_breathe"
)
// Wisps are larger than the layer; clipping keeps them from leaking past its edges.
Canvas(modifier = modifier.clipToBounds()) {
Wisps.forEach { wisp -> drawWisp(wisp, t, breathe * intensity, tint) }
// The transition restarts from 0 each time; continue from where the fog was paused.
val start = remember { last[0] }
FogCanvas(tint, intensity, last, modifier) {
last[0] = (start + t.value) % TWO_PI
last[1] = breathe.value
}
} else {
FogCanvas(tint, intensity, last, modifier) {}
}
}
private fun DrawScope.drawWisp(wisp: Wisp, time: Float, intensity: Float, tint: Color) {
@Composable
private fun FogCanvas(
tint: Color,
intensity: Float,
last: FloatArray,
modifier: Modifier,
advance: () -> Unit
) {
// Wisps are larger than the layer; clipping keeps them from leaking past its edges.
Spacer(
modifier = modifier.clipToBounds().drawWithCache {
// The gradients only depend on the size, tint and intensity; a frame just moves them.
val unit = max(size.width, size.height)
val center = Offset(
x = size.width * (wisp.x + wisp.dx * sin(time + wisp.phase)),
y = size.height * (wisp.y + wisp.dy * cos(time * 2f + wisp.phase))
val brushes = Wisps.map { wisp -> wispBrush(wisp, unit, tint, intensity) }
onDrawBehind {
// Reads the animation here, in the draw phase, so only drawing repeats per frame.
advance()
Wisps.forEachIndexed { i, wisp -> drawWisp(wisp, brushes[i], unit, last[0], last[1]) }
}
}
)
val radius = unit * wisp.radius
}
private const val TWO_PI = (2 * PI).toFloat()
private fun wispBrush(wisp: Wisp, unit: Float, tint: Color, intensity: Float): Brush {
// Part of the mist is paler, so the fog is not a flat single-color glow.
val color = lerp(tint, Color(0xFFDDE6FF), wisp.mix)
val a = (wisp.alpha * intensity).coerceIn(0f, 1f)
drawCircle(
brush = Brush.radialGradient(
// Centered at the origin; drawWisp moves it into place.
return Brush.radialGradient(
0f to color.copy(alpha = a),
0.45f to color.copy(alpha = a * 0.35f),
1f to Color.Transparent,
center = center,
radius = radius
),
radius = radius,
center = center
center = Offset.Zero,
radius = unit * wisp.radius
)
}
private fun DrawScope.drawWisp(wisp: Wisp, brush: Brush, unit: Float, time: Float, breathe: Float) {
val cx = size.width * (wisp.x + wisp.dx * sin(time + wisp.phase))
val cy = size.height * (wisp.y + wisp.dy * cos(time * 2f + wisp.phase))
translate(cx, cy) {
drawCircle(brush = brush, radius = unit * wisp.radius, center = Offset.Zero, alpha = breathe)
}
}
/** Fades the content to transparent towards the bottom, starting at [from] of its height. */
fun Modifier.fadeOutBottom(from: Float = 0.55f): Modifier = this
.clipToBounds()
@@ -1,5 +1,6 @@
package cc.skysparkle.fogwave.ui.components
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
@@ -15,33 +16,24 @@ import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.ColorMatrix
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import cc.skysparkle.fogwave.R
import cc.skysparkle.fogwave.ui.theme.LocalGeoColors
import coil.compose.AsyncImage
import coil.request.ImageRequest
import coil.size.Scale
/**
* Misty peak at the top of the home screen with drifting fog in the playing station's color.
* [animate] is turned off while the home screen is covered, so the hidden fog does not keep drawing.
* [visibility] is read in the draw phase (0 = gone, 1 = fully shown) so scrolling never recomposes it.
*/
@Composable
fun HomeBackdrop(
tint: Color,
modifier: Modifier = Modifier,
animate: Boolean = true,
visibility: () -> Float = { 1f }
) {
val context = LocalContext.current
val background = LocalGeoColors.current.background
val request = remember(context) {
ImageRequest.Builder(context)
.data(R.drawable.bg_misty_mountain)
.scale(Scale.FILL)
.crossfade(300)
.build()
}
// Cool, slightly desaturated photo so the colored fog and the UI stay in front.
val muted = remember {
ColorFilter.colorMatrix(ColorMatrix().apply { setToSaturation(0.35f) })
@@ -55,8 +47,8 @@ fun HomeBackdrop(
// Everything (photo and fog) melts into the page instead of ending at a hard edge.
.fadeOutBottom(from = 0.45f)
) {
AsyncImage(
model = request,
Image(
painter = painterResource(R.drawable.bg_misty_mountain),
contentDescription = null,
contentScale = ContentScale.Crop,
alignment = Alignment.TopCenter,
@@ -64,7 +56,7 @@ fun HomeBackdrop(
alpha = 0.5f,
modifier = Modifier.fillMaxSize()
)
FogLayer(tint = tint, intensity = 0.6f, modifier = Modifier.fillMaxSize())
FogLayer(tint = tint, intensity = 0.6f, animate = animate, modifier = Modifier.fillMaxSize())
// Darker top keeps the header readable over the photo.
Box(
modifier = Modifier
@@ -50,9 +50,7 @@ private val LIBRARIES = listOf(
LicenseRow("AndroidX \u2014 other libraries pulled in by the ones above", AOSP, APACHE, "https://developer.android.com/jetpack/androidx"),
LicenseRow("Guava (used by Media3)", "Google", APACHE, "https://github.com/google/guava"),
LicenseRow("kotlinx.coroutines", "JetBrains", APACHE, "https://github.com/Kotlin/kotlinx.coroutines", BuildConfig.COROUTINES_VERSION),
LicenseRow("Kotlin Standard Library", "JetBrains", APACHE, "https://github.com/JetBrains/kotlin", BuildConfig.KOTLIN_VERSION),
LicenseRow("Coil", "Coil Contributors", APACHE, "https://github.com/coil-kt/coil", BuildConfig.COIL_VERSION),
LicenseRow("OkHttp & Okio (used by Coil)", "Square, Inc.", APACHE, "https://square.github.io/okhttp/")
LicenseRow("Kotlin Standard Library", "JetBrains", APACHE, "https://github.com/JetBrains/kotlin", BuildConfig.KOTLIN_VERSION)
)
private val ASSETS = listOf(
@@ -69,7 +67,11 @@ private val STATIONS = listOf(
LicenseRow("M-1", "M-1 group", BROADCASTER, "https://www.m-1.fm/"),
LicenseRow("M-1 Plius", "M-1 group", BROADCASTER, "https://www.m-1.fm/"),
LicenseRow("Gold FM", "Gold FM", BROADCASTER, "https://www.goldfm.lt/"),
LicenseRow("RC", "Radiocentras group", BROADCASTER, "https://www.rc.lt/")
LicenseRow("RC", "Radiocentras group", BROADCASTER, "https://www.rc.lt/"),
LicenseRow("LRT Radijas", "Lietuvos nacionalinis radijas ir televizija (LRT)", BROADCASTER, "https://www.lrt.lt/"),
LicenseRow("\u017Dini\u0173 radijas", "\u017Dini\u0173 radijas, UAB", BROADCASTER, "https://www.ziniuradijas.lt/"),
LicenseRow("Latvijas Radio 1", "Latvijas Sabiedriskais medijs (LSM)", BROADCASTER, "https://latvijasradio.lsm.lv/"),
LicenseRow("Latvijas Radio 2", "Latvijas Sabiedriskais medijs (LSM)", BROADCASTER, "https://latvijasradio.lsm.lv/")
)
@Composable
@@ -42,6 +42,7 @@ import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.IntOffset
@@ -194,7 +195,7 @@ fun MiniPlayer(
.shadow(6.dp, CircleShape)
.clip(CircleShape)
.background(colors.accentLavender)
.clickable { onTogglePlay() }
.clickable(role = Role.Button) { onTogglePlay() }
.testTag("mini_play_btn"),
contentAlignment = Alignment.Center
) {
@@ -63,6 +63,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
@@ -353,7 +354,7 @@ fun NowPlayingSheet(
.shadow(14.dp, CircleShape, ambientColor = colors.accentLavender, spotColor = colors.accentLavender)
.clip(CircleShape)
.background(colors.accentLavender)
.clickable { onTogglePlay() }
.clickable(role = Role.Button) { onTogglePlay() }
.testTag("np_play_btn"),
contentAlignment = Alignment.Center
) {
@@ -136,6 +136,8 @@ fun HomeScreen(
) {
HomeBackdrop(
tint = accent,
// Covered by the open player; no need to keep animating fog nobody sees.
animate = !uiState.isNowPlayingOpen,
visibility = {
if (uiState.selectedTab != AppTab.RADIO) {
0.55f
+4
View File
@@ -125,4 +125,8 @@
<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>
<!-- Equalizer value labels; %1$s is the formatted number -->
<string name="eq_gain_db">%1$s dB</string>
<string name="eq_freq_hz">%1$s Hz</string>
<string name="eq_freq_khz">%1$s kHz</string>
</resources>
+4
View File
@@ -124,4 +124,8 @@
<string name="app_style_device_hint">色は壁紙から取得され(Material You)、壁紙に合わせて変わります。</string>
<string name="station_fog_title">局の色の霧</string>
<string name="station_fog_subtitle">霧とディスクの周りのリングが再生中の局の色になります</string>
<!-- Equalizer value labels; %1$s is the formatted number -->
<string name="eq_gain_db">%1$s dB</string>
<string name="eq_freq_hz">%1$s Hz</string>
<string name="eq_freq_khz">%1$s kHz</string>
</resources>
+4
View File
@@ -127,4 +127,8 @@
<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>
<!-- Equalizer value labels; %1$s is the formatted number -->
<string name="eq_gain_db">%1$s dB</string>
<string name="eq_freq_hz">%1$s Hz</string>
<string name="eq_freq_khz">%1$s kHz</string>
</resources>
+4
View File
@@ -127,4 +127,8 @@
<string name="app_style_device_hint">Цвета берутся из обоев (Material You) и меняются вместе с ними.</string>
<string name="station_fog_title">Туман в цвете станции</string>
<string name="station_fog_subtitle">Туман и кольцо вокруг диска окрашиваются в цвет играющей станции</string>
<!-- Equalizer value labels; %1$s is the formatted number -->
<string name="eq_gain_db">%1$s дБ</string>
<string name="eq_freq_hz">%1$s Гц</string>
<string name="eq_freq_khz">%1$s кГц</string>
</resources>
+4
View File
@@ -124,4 +124,8 @@
<string name="app_style_device_hint">颜色取自壁纸(Material You),并随壁纸变化。</string>
<string name="station_fog_title">电台颜色的雾</string>
<string name="station_fog_subtitle">雾和唱片周围的圆环会变成正在播放电台的颜色</string>
<!-- Equalizer value labels; %1$s is the formatted number -->
<string name="eq_gain_db">%1$s dB</string>
<string name="eq_freq_hz">%1$s Hz</string>
<string name="eq_freq_khz">%1$s kHz</string>
</resources>
+4
View File
@@ -126,4 +126,8 @@
<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>
<!-- Equalizer value labels; %1$s is the formatted number -->
<string name="eq_gain_db">%1$s dB</string>
<string name="eq_freq_hz">%1$s Hz</string>
<string name="eq_freq_khz">%1$s kHz</string>
</resources>
-2
View File
@@ -11,7 +11,6 @@ kotlin = "2.4.20"
composeBom = "2026.09.00"
core = "1.6.1"
runner = "1.6.2"
coilCompose = "2.7.0"
kotlinxCoroutinesAndroid = "1.11.0"
kotlinxCoroutinesCore = "1.11.0"
robolectric = "4.16.1"
@@ -35,7 +34,6 @@ androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-te
androidx-core = { group = "androidx.test", name = "core", version.ref = "core" }
androidx-runner = { group = "androidx.test", name = "runner", version.ref = "runner" }
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" }
coil-compose = { group = "io.coil-kt", name = "coil-compose", version.ref = "coilCompose" }
androidx-media3-exoplayer = { group = "androidx.media3", name = "media3-exoplayer", version.ref = "media3" }
androidx-media3-exoplayer-hls = { group = "androidx.media3", name = "media3-exoplayer-hls", version.ref = "media3" }
androidx-media3-common = { group = "androidx.media3", name = "media3-common", version.ref = "media3" }
+1
View File
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=acd53f1edaf02f1a8ff99879f8a34b302661a057d9b063ae9e35b552f804d20a
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true