28 Commits
Author SHA1 Message Date
kalarina d4c81a3568 Build unsigned release APK and AAB on GitHub Actions 2026-11-19 09:42:59 +02:00
kalarina afbea360a0 Remove Gitea templates and links
The project lives on GitHub: drop the .gitea issue templates, the Gitea
option in the bug report template and the Gitea links in old changelogs.
2026-11-18 21:29:48 +02:00
kalarina 2e43d4d0d9 Show the logo only once on the About tab 2026-11-18 17:59:14 +02:00
kalarina cd2c7426ce Add a first-launch guide
New users get a short swipeable tour on first launch; people who used the
app before are not shown it. It can be opened again from About.
2026-11-17 20:55:11 +02:00
kalarina 0d64fa7409 Bump version to 1.0.19 2026-11-17 20:33:26 +02:00
kalarina d95499b0e9 Show FM frequencies and station website in the Info tab
Frequencies for Vilnius, Kaunas and Klaipėda come from the RRT broadcasting
licence list, Riga for the Latvian stations. Power Hit Radio Gold is marked
as online only. The website link opens the station's shows and schedule.
2026-11-17 20:24:10 +02:00
kalarina b9e98c8d75 Add donation card and move repository links to GitHub 2026-11-17 09:41:23 +02:00
kalarina f0b3530479 README: point Obtainium link to GitHub 2026-11-14 19:23:22 +02:00
kalarina f6793cf5c0 Release 1.0.18 2026-11-12 16:54:17 +02:00
kalarina 5fd7be69e1 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.
2026-11-12 16:43:34 +02:00
kalarina 847aa8daae Add unit tests for the reconnect policy, the player state and the repository 2026-11-12 16:43:34 +02:00
kalarina 8cd9133803 Harden the playback service and make next/previous work outside the app
- Resolve every item from a controller against the station list: an item
  without a URI (voice requests from Assistant or Android Auto) no longer
  crashes the player, and other apps can no longer start arbitrary streams.
- Offer next/previous to the notification, headset buttons and Android Auto
  through a ForwardingSimpleBasePlayer that switches the station; the player
  still holds only the station on air, so no other stream is prepared.
- Do not spend reconnect attempts while offline; reconnect when the network
  comes back instead of pausing for good after about four minutes.
- Swiping the app away during an error or a pending reconnect stops the
  service; a short rebuffer while playing does not.
- Loudness Enhancer applies a 6 dB boost by default; the old default of 0
  made the switch do nothing. The unused gain setter chain is removed.
- Count station switches made outside the app in recents and play counts.
2026-11-12 16:43:34 +02:00
kalarina ac19416c00 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.
2026-11-12 16:26:57 +02:00
kalarina 73dd720533 Remove song titles line from README 2026-11-11 10:57:42 +02:00
kalarina 4b2396d20a Update screenshots for the new design 2026-11-10 19:57:20 +02:00
kalarina 15b7c7effc Remove genre cards and the player's back arrow; fill the whole screen with the player on tablets 2026-11-10 19:33:58 +02:00
kalarina 23f577ee89 Release 1.0.17 2026-11-10 19:26:44 +02:00
kalarina f4a855e98e Remove track history tab; fix hard edge of home fog and rows showing under the dock 2026-11-10 17:31:22 +02:00
kalarina 27e11db27f Release 1.0.16 2026-11-10 16:31:26 +02:00
kalarina 5a4752d32d Release 1.0.14 2026-11-10 16:27:39 +02:00
kalarina 42e77433bf Add station-colored fog, misty home backdrop and logo fitting; bring back next in mini player 2026-11-10 16:18:25 +02:00
kalarina 33423fbbc0 Redesign UI: genre cards, search, station disc player and track history 2026-11-10 16:06:36 +02:00
kalarina 36c56ecf35 Expand call for volunteer designers 2026-11-10 15:33:19 +02:00
kalarina 511635a5c8 Add call for volunteer designers to README 2026-11-10 15:30:42 +02:00
kalarina fe77813e53 Move Google Play notice to the top of README 2026-11-08 17:26:04 +02:00
kalarina 13acbc6d6a Add Google Play closed testing notice to README 2026-11-08 17:23:00 +02:00
kalarina 46a3f94057 Escape ampersands in new station strings 2026-11-08 14:10:06 +02:00
kalarina cca6d5e19c Release 1.0.13
- Add LRT Radijas, Žinių radijas, Latvijas Radio 1 and Latvijas Radio 2
- Add HLS playback (media3-exoplayer-hls) for the Latvijas Radio streams
- Add "News & talk" and "Latvian music" genres
- Show the view options button on the Radio tab only; Favorites uses the same layout
- Update descriptions and changelogs

Inspired by https://github.com/JacobBico/fogwave-baltic
2026-11-08 13:50:10 +02:00
125 changed files with 3779 additions and 2180 deletions
-27
View File
@@ -1,27 +0,0 @@
---
name: Bug report
about: Something doesn't work as expected
title: "[Bug] "
---
**What happened**
**Steps to reproduce**
1.
2.
3.
**What you expected**
**Environment**
- App version:
- Installed from: Gitea / F-Droid / Google Play
- Device and Android version:
- Station (if related):
**Screenshots or logs** (optional)
-18
View File
@@ -1,18 +0,0 @@
---
name: Feature request
about: Suggest an idea that fits the app
title: "[Feature] "
---
<!-- Please check the "Out of scope" list in CONTRIBUTING.md before opening this. -->
**What problem does this solve**
**Proposed solution**
**Alternatives you considered**
- [ ] I'd like to implement this myself
-15
View File
@@ -1,15 +0,0 @@
---
name: Station request
about: Suggest a Lithuanian radio station
title: "[Station] "
---
<!-- Only Lithuanian stations with an official public stream are accepted. -->
- Station name:
- Official website:
- Stream URL:
- Genre:
- [ ] The station is Lithuanian
- [ ] The stream is official and public
-12
View File
@@ -1,12 +0,0 @@
---
name: Translation fix
about: Report a wrong or awkward translation
title: "[Translation] "
---
<!-- Supported languages: English, Russian, German, Japanese, Lithuanian, Chinese. New languages are not accepted. -->
- Language:
- Screen or place in the app:
- Current text:
- Suggested text:
-16
View File
@@ -1,16 +0,0 @@
## What does this change
## Related issue
Closes #
## Checklist
- [ ] Discussed in an issue first (not needed for small fixes)
- [ ] `./gradlew assembleDebug` builds
- [ ] Tested on a device or emulator (Android version: )
- [ ] No ads, analytics, trackers or Google Play Services / Firebase dependencies
- [ ] New strings added to `values/strings.xml` (missing translations noted below)
- [ ] Screenshots added for UI changes
- [ ] I agree that my contribution is licensed under GPL-3.0-only
+1
View File
@@ -0,0 +1 @@
ko_fi: skysparkle
+1 -1
View File
@@ -19,7 +19,7 @@ title: "[Bug] "
**Environment** **Environment**
- App version: - App version:
- Installed from: Gitea / GitHub / F-Droid / Google Play - Installed from: GitHub / F-Droid / Google Play
- Device and Android version: - Device and Android version:
- Station (if related): - Station (if related):
+3 -3
View File
@@ -1,5 +1,5 @@
blank_issues_enabled: true blank_issues_enabled: true
contact_links: contact_links:
- name: Main repository on git.skysparkle.cc - name: Support the project on Ko-fi
url: https://git.skysparkle.cc/kalarina/Fogwave url: https://ko-fi.com/skysparkle
about: This GitHub repository is a mirror. Issues are welcome here and on Gitea. about: Donations keep the apps and the Skysparkle server running.
+52
View File
@@ -0,0 +1,52 @@
# Builds unsigned release APK and AAB. Download them from the run's "Artifacts" and sign locally.
name: Build unsigned release
on:
workflow_dispatch:
push:
branches: [main]
tags: ["v*"]
paths-ignore: ["**.md", "fastlane/**", ".github/ISSUE_TEMPLATE/**"]
permissions:
contents: read
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
env:
NAME: Fogwave
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- uses: gradle/actions/setup-gradle@v4
- name: Build
run: |
chmod +x gradlew
./gradlew --no-daemon clean assembleRelease bundleRelease
- name: Collect files
run: |
ver=$(grep -oP 'versionName = "\K[^"]+' app/build.gradle.kts)
mkdir out
cp app/build/outputs/apk/release/app-release-unsigned.apk "out/$NAME-v$ver-unsigned.apk"
cp app/build/outputs/bundle/release/app-release.aab "out/$NAME-v$ver-unsigned.aab"
cp app/build/outputs/mapping/release/mapping.txt "out/$NAME-v$ver-mapping.txt"
git log -1 --format="Commit %h, %ci: %s" > out/BUILD-INFO.txt
echo "VER=$ver" >> "$GITHUB_ENV"
- uses: actions/upload-artifact@v4
with:
name: ${{ env.NAME }}-v${{ env.VER }}-unsigned
path: out/
retention-days: 30
+1 -1
View File
@@ -4,7 +4,7 @@ Thanks for wanting to help! This guide explains where to contribute, what fits t
## Where to contribute ## Where to contribute
Issues and pull requests go to the repository on [Gitea](https://git.skysparkle.cc/kalarina/Fogwave). Issues and pull requests go to the repository on [GitHub](https://github.com/kalarina-bit/Fogwave).
## Ways to help ## Ways to help
+22 -7
View File
@@ -9,15 +9,24 @@
Listen to Lithuania's favorite stations in one tap. Listen to Lithuania's favorite stations in one tap.
</p> </p>
<p align="center">
<a href="https://ko-fi.com/skysparkle"><img src="https://ko-fi.com/img/githubbutton_sm.svg" alt="Support me on Ko-fi"></a>
</p>
> [!IMPORTANT]
> **Fogwave is coming to Google Play!** The app is now in closed testing there ahead of the public release. Ideas, wishes and suggestions for improvement are very welcome — send them wherever is easiest for you: an [issue on GitHub](https://github.com/kalarina-bit/Fogwave/issues), or an email to [cuken107@proton.me](mailto:cuken107@proton.me).
> [!NOTE]
> **Looking for designers!** Fogwave is looking for volunteer designers to help with icons, logos, animations, cover art (store graphics) and UI design. This is unpaid help for an open-source project. If you're interested, write to [cuken107@proton.me](mailto:cuken107@proton.me).
<p align="center"> <p align="center">
<a href="https://github.com/kalarina-bit/Fogwave/releases/latest"><img src="https://img.shields.io/github/v/release/kalarina-bit/Fogwave?style=for-the-badge&label=release&labelColor=1b1b1b&color=2e7d32" alt="Latest release"></a> <a href="https://github.com/kalarina-bit/Fogwave/releases/latest"><img src="https://img.shields.io/github/v/release/kalarina-bit/Fogwave?style=for-the-badge&label=release&labelColor=1b1b1b&color=2e7d32" alt="Latest release"></a>
</p> </p>
<p align="center"> <p align="center">
<a href="https://f-droid.org/packages/cc.skysparkle.fogwave/"><img src="assets/get-it-on%20(1).png" height="56" alt="Get it on F-Droid"></a> <a href="https://f-droid.org/packages/cc.skysparkle.fogwave/"><img src="assets/get-it-on%20(1).png" height="56" alt="Get it on F-Droid"></a>
<a href="https://apps.obtainium.imranr.dev/redirect?r=obtainium://add/https://git.skysparkle.cc/kalarina/Fogwave"><img src="assets/badge_obtainium.png" height="56" alt="Get it on Obtainium"></a> <a href="https://apps.obtainium.imranr.dev/redirect?r=obtainium://add/https://github.com/kalarina-bit/Fogwave"><img src="assets/badge_obtainium.png" height="56" alt="Get it on Obtainium"></a>
<a href="https://github.com/kalarina-bit/Fogwave/releases/latest"><img src="assets/get-it-on-github.png" height="56" alt="Get it on GitHub"></a> <a href="https://github.com/kalarina-bit/Fogwave/releases/latest"><img src="assets/get-it-on-github.png" height="56" alt="Get it on GitHub"></a>
<a href="https://git.skysparkle.cc/kalarina/Fogwave/releases"><img src="assets/get-it-on-gitea.png" height="56" alt="Get it on Gitea"></a>
</p> </p>
<p align="center"> <p align="center">
@@ -31,13 +40,13 @@
## ✨ Features ## ✨ Features
- 📻 **10 Lithuanian stations** — ZIP FM, Power Hit Radio, Rock FM, Relax FM, M-1, Gold FM and more - 📻 **14 stations from Lithuania and Latvia** — ZIP FM, Power Hit Radio, Rock FM, LRT Radijas, Žinių radijas, Latvijas Radio 1 & 2 and more
- 🎧 **Background playback** with lock-screen, notification, headphone and Bluetooth controls - 🎧 **Background playback** with lock-screen, notification, headphone and Bluetooth controls
- 🚗 **Android Auto** support - 🚗 **Android Auto** support
- 🔄 **Auto-reconnect** when the stream drops or the network comes back - 🔄 **Auto-reconnect** when the stream drops or the network comes back
- 🎚️ **Equalizer** with presets, loudness boost and dynamics processing - 🎚️ **Equalizer** with presets, loudness boost and dynamics processing
- ❤️ **Favorites, recently played and similar stations** matched by genre - ❤️ **Favorites, recently played and similar stations** matched by genre
- 🗂️ **Four layouts** — list, table, tiles or icons, with adjustable size - 🔍 **Search** to find a station in a tap
- 🌙 **Dark theme** - 🌙 **Dark theme**
- 🌍 **Six languages** — English, Russian, German, Japanese, Lithuanian and Chinese - 🌍 **Six languages** — English, Russian, German, Japanese, Lithuanian and Chinese
- 🔓 **No ads, no tracking, no accounts** - 🔓 **No ads, no tracking, no accounts**
@@ -45,8 +54,8 @@
## <img src="assets/icon-install.png" width="32" alt=""> Installation ## <img src="assets/icon-install.png" width="32" alt=""> Installation
- **[F-Droid](https://f-droid.org/packages/cc.skysparkle.fogwave/)** — install and update through the F-Droid client. - **[F-Droid](https://f-droid.org/packages/cc.skysparkle.fogwave/)** — install and update through the F-Droid client.
- **[Obtainium](https://apps.obtainium.imranr.dev/redirect?r=obtainium://add/https://git.skysparkle.cc/kalarina/Fogwave)** — installs the APK straight from Gitea releases and keeps it up to date. - **[Obtainium](https://apps.obtainium.imranr.dev/redirect?r=obtainium://add/https://github.com/kalarina-bit/Fogwave)** — installs the APK straight from GitHub releases and keeps it up to date.
- **Manually** — download the latest APK from [GitHub](https://github.com/kalarina-bit/Fogwave/releases/latest) or [Gitea](https://git.skysparkle.cc/kalarina/Fogwave/releases), allow installs from unknown sources for the app you open it with (Settings → Apps → Special access → Install unknown apps), then open the `.apk` and confirm. - **Manually** — download the latest APK from [GitHub Releases](https://github.com/kalarina-bit/Fogwave/releases/latest), allow installs from unknown sources for the app you open it with (Settings → Apps → Special access → Install unknown apps), then open the `.apk` and confirm.
## <img src="assets/icon-verify.png" width="32" alt=""> Verifying a download ## <img src="assets/icon-verify.png" width="32" alt=""> Verifying a download
@@ -82,7 +91,13 @@ Release builds are signed only when a keystore is supplied through the `KEYSTORE
## 🤝 Contributing ## 🤝 Contributing
Bug reports, station suggestions, translation fixes and pull requests are welcome in the [issue tracker](https://git.skysparkle.cc/kalarina/Fogwave/issues). Please read [CONTRIBUTING.md](CONTRIBUTING.md) first — it explains what fits the project and how to send changes. To open an issue or a pull request, [create an account](https://git.skysparkle.cc/user/sign_up) on this Gitea. Bug reports, station suggestions, translation fixes and pull requests are welcome in the [issue tracker](https://github.com/kalarina-bit/Fogwave/issues). Please read [CONTRIBUTING.md](CONTRIBUTING.md) first — it explains what fits the project and how to send changes.
## ☕ Support
Fogwave is free, open source and has no ads. If it is useful to you, you can support the project on [Ko-fi](https://ko-fi.com/skysparkle) — donations pay for the Skysparkle server and the time spent on the apps.
<a href="https://ko-fi.com/skysparkle"><img src="https://ko-fi.com/img/githubbutton_sm.svg" alt="Support me on Ko-fi"></a>
## 📄 License ## 📄 License
+3 -4
View File
@@ -13,8 +13,8 @@ android {
applicationId = "cc.skysparkle.fogwave" applicationId = "cc.skysparkle.fogwave"
minSdk = 24 minSdk = 24
targetSdk = 36 targetSdk = 36
versionCode = 13 versionCode = 19
versionName = "1.0.13" versionName = "1.0.19"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
@@ -27,7 +27,6 @@ android {
buildConfigField("String", "MEDIA3_VERSION", "\"${libs.versions.media3.get()}\"") buildConfigField("String", "MEDIA3_VERSION", "\"${libs.versions.media3.get()}\"")
buildConfigField("String", "COROUTINES_VERSION", "\"${libs.versions.kotlinxCoroutinesAndroid.get()}\"") buildConfigField("String", "COROUTINES_VERSION", "\"${libs.versions.kotlinxCoroutinesAndroid.get()}\"")
buildConfigField("String", "KOTLIN_VERSION", "\"${libs.versions.kotlin.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, // Release signing is applied only when a keystore is available, so anyone (including F-Droid,
@@ -83,8 +82,8 @@ dependencies {
implementation(libs.androidx.lifecycle.runtime.compose) implementation(libs.androidx.lifecycle.runtime.compose)
implementation(libs.androidx.lifecycle.viewmodel.compose) implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.coil.compose)
implementation(libs.androidx.media3.exoplayer) implementation(libs.androidx.media3.exoplayer)
implementation(libs.androidx.media3.exoplayer.hls)
implementation(libs.androidx.media3.common) implementation(libs.androidx.media3.common)
implementation(libs.androidx.media3.session) implementation(libs.androidx.media3.session)
implementation(libs.kotlinx.coroutines.android) implementation(libs.kotlinx.coroutines.android)
+6
View File
@@ -1,2 +1,8 @@
-keepattributes SourceFile,LineNumberTable -keepattributes SourceFile,LineNumberTable
-renamesourcefileattribute SourceFile -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" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
<application <application
android:name=".FogwaveApp" android:allowBackup="false"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:localeConfig="@xml/locales_config" android:localeConfig="@xml/locales_config"
@@ -1,20 +0,0 @@
package cc.skysparkle.fogwave
import android.app.Application
import coil.ImageLoader
import coil.ImageLoaderFactory
import coil.memory.MemoryCache
class FogwaveApp : Application(), ImageLoaderFactory {
override fun newImageLoader(): ImageLoader {
return ImageLoader.Builder(this)
.memoryCache {
MemoryCache.Builder(this)
.maxSizePercent(0.20)
.build()
}
.crossfade(true)
.respectCacheHeaders(false)
.build()
}
}
@@ -6,16 +6,22 @@ import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge import androidx.activity.enableEdgeToEdge
import androidx.compose.animation.Crossfade
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme 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.screens.Onboarding
import cc.skysparkle.fogwave.ui.screens.OnboardingScreen
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)
Onboarding.load(this)
enableEdgeToEdge( enableEdgeToEdge(
statusBarStyle = SystemBarStyle.dark(Color.TRANSPARENT), statusBarStyle = SystemBarStyle.dark(Color.TRANSPARENT),
navigationBarStyle = SystemBarStyle.dark(Color.TRANSPARENT) navigationBarStyle = SystemBarStyle.dark(Color.TRANSPARENT)
@@ -26,7 +32,11 @@ class MainActivity : ComponentActivity() {
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background color = MaterialTheme.colorScheme.background
) { ) {
HomeScreen() // First-launch guide in place of the home screen; the player state lives in the
// activity's view model, so nothing is lost while the guide is open.
Crossfade(targetState = Onboarding.visible, label = "onboarding") { guide ->
if (guide) OnboardingScreen(onDone = { Onboarding.finish(this@MainActivity) }) else HomeScreen()
}
} }
} }
} }
@@ -14,9 +14,24 @@ data class RadioStation(
@param:DrawableRes val iconResId: Int, @param:DrawableRes val iconResId: Int,
val genres: List<Genre>, val genres: List<Genre>,
val bitrate: String, val bitrate: String,
val lightBackdrop: Boolean = false val lightBackdrop: Boolean = false,
/** FM frequencies in the biggest cities; empty for stations that are only online. */
val frequencies: List<FmFrequency> = emptyList(),
/** Station website with its shows and schedule. */
val website: String? = null
) )
/** One FM transmitter: the city and the frequency in MHz. */
@Immutable
data class FmFrequency(val city: City, val mhz: Double)
enum class City(@param:StringRes val labelRes: Int) {
VILNIUS(R.string.city_vilnius),
KAUNAS(R.string.city_kaunas),
KLAIPEDA(R.string.city_klaipeda),
RIGA(R.string.city_riga)
}
enum class Genre(@param:StringRes val labelRes: Int) { enum class Genre(@param:StringRes val labelRes: Int) {
HITS(R.string.genre_hits), HITS(R.string.genre_hits),
POP(R.string.genre_pop), POP(R.string.genre_pop),
@@ -24,21 +39,9 @@ enum class Genre(@param:StringRes val labelRes: Int) {
OLDIES(R.string.genre_oldies), OLDIES(R.string.genre_oldies),
ROCK(R.string.genre_rock), ROCK(R.string.genre_rock),
EASY_LISTENING(R.string.genre_easy_listening), EASY_LISTENING(R.string.genre_easy_listening),
LITHUANIAN(R.string.genre_lithuanian) LITHUANIAN(R.string.genre_lithuanian),
} NEWS_TALK(R.string.genre_news_talk),
LATVIAN(R.string.genre_latvian)
enum class ViewMode {
ICONS,
TILES,
LIST,
DETAILS
}
enum class IconSizeStep(val sizeDp: Int) {
S(64),
M(96),
L(132),
XL(176)
} }
enum class AppTab(@param:StringRes val titleRes: Int) { enum class AppTab(@param:StringRes val titleRes: Int) {
@@ -52,3 +55,4 @@ enum class ExtraPlayerTab(@param:StringRes val titleRes: Int) {
SIMILAR(R.string.extra_tab_similar), SIMILAR(R.string.extra_tab_similar),
INFO(R.string.extra_tab_info) INFO(R.string.extra_tab_info)
} }
@@ -3,10 +3,10 @@ package cc.skysparkle.fogwave.data.repository
import android.content.Context import android.content.Context
import androidx.core.content.edit import androidx.core.content.edit
import cc.skysparkle.fogwave.R import cc.skysparkle.fogwave.R
import cc.skysparkle.fogwave.data.model.City
import cc.skysparkle.fogwave.data.model.FmFrequency
import cc.skysparkle.fogwave.data.model.Genre import cc.skysparkle.fogwave.data.model.Genre
import cc.skysparkle.fogwave.data.model.IconSizeStep
import cc.skysparkle.fogwave.data.model.RadioStation import cc.skysparkle.fogwave.data.model.RadioStation
import cc.skysparkle.fogwave.data.model.ViewMode
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.asStateFlow
@@ -15,6 +15,8 @@ import org.json.JSONArray
class RadioRepository(context: Context) { class RadioRepository(context: Context) {
private val prefs = context.getSharedPreferences("fogwave_prefs", Context.MODE_PRIVATE) private val prefs = context.getSharedPreferences("fogwave_prefs", Context.MODE_PRIVATE)
// FM frequencies: Lithuanian stations from the RRT broadcasting licence list (Vilnius, Kaunas,
// Klaipėda), Latvian ones for Riga. Other towns are listed on each station's website.
val stations: List<RadioStation> = listOf( val stations: List<RadioStation> = listOf(
RadioStation( RadioStation(
id = "zip", id = "zip",
@@ -23,7 +25,13 @@ class RadioRepository(context: Context) {
streamUrl = "https://stream4.radijas.lt/zipfm", streamUrl = "https://stream4.radijas.lt/zipfm",
iconResId = R.drawable.ic_station_zipfm, iconResId = R.drawable.ic_station_zipfm,
genres = listOf(Genre.HITS, Genre.POP, Genre.LITHUANIAN), genres = listOf(Genre.HITS, Genre.POP, Genre.LITHUANIAN),
bitrate = "MP3" bitrate = "MP3",
frequencies = listOf(
FmFrequency(City.VILNIUS, 100.1),
FmFrequency(City.KAUNAS, 104.1),
FmFrequency(City.KLAIPEDA, 92.5)
),
website = "https://www.zipfm.lt"
), ),
RadioStation( RadioStation(
id = "powerhit", id = "powerhit",
@@ -33,7 +41,13 @@ class RadioRepository(context: Context) {
streamUrl = "https://stream.rcs.revma.com/f31w7e0fveuvv", streamUrl = "https://stream.rcs.revma.com/f31w7e0fveuvv",
iconResId = R.drawable.ic_station_powerhit, iconResId = R.drawable.ic_station_powerhit,
genres = listOf(Genre.DANCE, Genre.POP, Genre.HITS), genres = listOf(Genre.DANCE, Genre.POP, Genre.HITS),
bitrate = "AAC" bitrate = "AAC",
frequencies = listOf(
FmFrequency(City.VILNIUS, 95.9),
FmFrequency(City.KAUNAS, 91.0),
FmFrequency(City.KLAIPEDA, 96.7)
),
website = "https://powerhitradio.tv3.lt"
), ),
RadioStation( RadioStation(
id = "powerhitgold", id = "powerhitgold",
@@ -42,7 +56,8 @@ class RadioRepository(context: Context) {
streamUrl = "https://stream.rcs.revma.com/asdpz3qfbhuvv", streamUrl = "https://stream.rcs.revma.com/asdpz3qfbhuvv",
iconResId = R.drawable.ic_station_powerhitgold, iconResId = R.drawable.ic_station_powerhitgold,
genres = listOf(Genre.DANCE, Genre.OLDIES, Genre.HITS), genres = listOf(Genre.DANCE, Genre.OLDIES, Genre.HITS),
bitrate = "AAC" bitrate = "AAC",
website = "https://powerhitradio.tv3.lt"
), ),
RadioStation( RadioStation(
id = "rock", id = "rock",
@@ -52,7 +67,13 @@ class RadioRepository(context: Context) {
iconResId = R.drawable.ic_station_rockfm, iconResId = R.drawable.ic_station_rockfm,
genres = listOf(Genre.ROCK, Genre.LITHUANIAN), genres = listOf(Genre.ROCK, Genre.LITHUANIAN),
bitrate = "MP3", bitrate = "MP3",
lightBackdrop = true lightBackdrop = true,
frequencies = listOf(
FmFrequency(City.VILNIUS, 87.8),
FmFrequency(City.KAUNAS, 90.3),
FmFrequency(City.KLAIPEDA, 100.2)
),
website = "https://rockfm.lt"
), ),
RadioStation( RadioStation(
id = "relax", id = "relax",
@@ -61,7 +82,13 @@ class RadioRepository(context: Context) {
streamUrl = "https://stream4.radijas.lt/relaxfm", streamUrl = "https://stream4.radijas.lt/relaxfm",
iconResId = R.drawable.ic_station_relaxfm, iconResId = R.drawable.ic_station_relaxfm,
genres = listOf(Genre.EASY_LISTENING), genres = listOf(Genre.EASY_LISTENING),
bitrate = "MP3" bitrate = "MP3",
frequencies = listOf(
FmFrequency(City.VILNIUS, 96.4),
FmFrequency(City.KAUNAS, 98.5),
FmFrequency(City.KLAIPEDA, 87.5)
),
website = "https://www.relaxfm.lt"
), ),
RadioStation( RadioStation(
id = "lietus", id = "lietus",
@@ -71,7 +98,13 @@ class RadioRepository(context: Context) {
iconResId = R.drawable.ic_station_lietus, iconResId = R.drawable.ic_station_lietus,
genres = listOf(Genre.LITHUANIAN, Genre.POP), genres = listOf(Genre.LITHUANIAN, Genre.POP),
bitrate = "AAC 64 kbps", bitrate = "AAC 64 kbps",
lightBackdrop = true lightBackdrop = true,
frequencies = listOf(
FmFrequency(City.VILNIUS, 103.1),
FmFrequency(City.KAUNAS, 103.5),
FmFrequency(City.KLAIPEDA, 103.7)
),
website = "https://www.lietus.fm"
), ),
RadioStation( RadioStation(
id = "m1", id = "m1",
@@ -80,7 +113,13 @@ class RadioRepository(context: Context) {
streamUrl = "https://stream.m-1.fm/m1/aacp64", streamUrl = "https://stream.m-1.fm/m1/aacp64",
iconResId = R.drawable.ic_station_m1, iconResId = R.drawable.ic_station_m1,
genres = listOf(Genre.POP, Genre.HITS), genres = listOf(Genre.POP, Genre.HITS),
bitrate = "AAC 64 kbps" bitrate = "AAC 64 kbps",
frequencies = listOf(
FmFrequency(City.VILNIUS, 106.8),
FmFrequency(City.KAUNAS, 106.6),
FmFrequency(City.KLAIPEDA, 106.5)
),
website = "https://www.m-1.fm"
), ),
RadioStation( RadioStation(
id = "plus", id = "plus",
@@ -90,7 +129,13 @@ class RadioRepository(context: Context) {
iconResId = R.drawable.ic_station_m1plus, iconResId = R.drawable.ic_station_m1plus,
genres = listOf(Genre.POP, Genre.OLDIES), genres = listOf(Genre.POP, Genre.OLDIES),
bitrate = "AAC 64 kbps", bitrate = "AAC 64 kbps",
lightBackdrop = true lightBackdrop = true,
frequencies = listOf(
FmFrequency(City.VILNIUS, 106.2),
FmFrequency(City.KAUNAS, 97.6),
FmFrequency(City.KLAIPEDA, 98.3)
),
website = "https://www.pliusas.fm"
), ),
RadioStation( RadioStation(
id = "goldfm", id = "goldfm",
@@ -99,7 +144,13 @@ class RadioRepository(context: Context) {
streamUrl = "https://stream.goldfm.lt/goldfm.aac", streamUrl = "https://stream.goldfm.lt/goldfm.aac",
iconResId = R.drawable.ic_station_goldfm, iconResId = R.drawable.ic_station_goldfm,
genres = listOf(Genre.OLDIES, Genre.HITS, Genre.LITHUANIAN), genres = listOf(Genre.OLDIES, Genre.HITS, Genre.LITHUANIAN),
bitrate = "AAC" bitrate = "AAC",
frequencies = listOf(
FmFrequency(City.VILNIUS, 102.6),
FmFrequency(City.KAUNAS, 104.5),
FmFrequency(City.KLAIPEDA, 104.1)
),
website = "https://goldfm.lt"
), ),
RadioStation( RadioStation(
id = "rc", id = "rc",
@@ -109,7 +160,66 @@ class RadioRepository(context: Context) {
iconResId = R.drawable.ic_station_rc, iconResId = R.drawable.ic_station_rc,
genres = listOf(Genre.HITS, Genre.LITHUANIAN), genres = listOf(Genre.HITS, Genre.LITHUANIAN),
bitrate = "MP3 128 kbps", bitrate = "MP3 128 kbps",
lightBackdrop = true lightBackdrop = true,
frequencies = listOf(
FmFrequency(City.VILNIUS, 89.6),
FmFrequency(City.KAUNAS, 107.1),
FmFrequency(City.KLAIPEDA, 101.5)
),
website = "https://rc.lt"
),
RadioStation(
id = "lrt",
name = "LRT Radijas",
descriptionRes = R.string.station_desc_lrt,
streamUrl = "https://lrt-cast.lrt.lt/lrt_radijas",
iconResId = R.drawable.ic_station_lrt,
genres = listOf(Genre.NEWS_TALK, Genre.LITHUANIAN),
bitrate = "MP3",
lightBackdrop = true,
frequencies = listOf(
FmFrequency(City.VILNIUS, 89.0),
FmFrequency(City.KAUNAS, 102.1),
FmFrequency(City.KLAIPEDA, 102.8)
),
website = "https://www.lrt.lt"
),
RadioStation(
id = "ziniu",
name = "Žinių radijas",
descriptionRes = R.string.station_desc_ziniu,
streamUrl = "https://netradio.ziniur.lt/ziniur.mp3?n=975355",
iconResId = R.drawable.ic_station_ziniu,
genres = listOf(Genre.NEWS_TALK),
bitrate = "MP3",
frequencies = listOf(
FmFrequency(City.VILNIUS, 97.3),
FmFrequency(City.KAUNAS, 104.9),
FmFrequency(City.KLAIPEDA, 102.2)
),
website = "https://www.ziniuradijas.lt"
),
RadioStation(
id = "lr1",
name = "Latvijas Radio 1",
descriptionRes = R.string.station_desc_lr1,
streamUrl = "https://muste.latvijasradio.lv/shoutcast/mp4:lr1a.stream/playlist.m3u8",
iconResId = R.drawable.ic_station_lr1,
genres = listOf(Genre.NEWS_TALK),
bitrate = "HLS",
frequencies = listOf(FmFrequency(City.RIGA, 90.7)),
website = "https://lr1.lsm.lv"
),
RadioStation(
id = "lr2",
name = "Latvijas Radio 2",
descriptionRes = R.string.station_desc_lr2,
streamUrl = "https://muste.latvijasradio.lv/shoutcast/mp4:lr2a.stream/playlist.m3u8",
iconResId = R.drawable.ic_station_lr2,
genres = listOf(Genre.LATVIAN, Genre.POP),
bitrate = "HLS",
frequencies = listOf(FmFrequency(City.RIGA, 91.5)),
website = "https://lr2.lsm.lv"
) )
) )
@@ -121,12 +231,6 @@ class RadioRepository(context: Context) {
private val _recentsFlow = MutableStateFlow<List<String>>(loadRecents()) private val _recentsFlow = MutableStateFlow<List<String>>(loadRecents())
val recentsFlow: StateFlow<List<String>> = _recentsFlow.asStateFlow() val recentsFlow: StateFlow<List<String>> = _recentsFlow.asStateFlow()
private val _viewModeFlow = MutableStateFlow(loadViewMode())
val viewModeFlow: StateFlow<ViewMode> = _viewModeFlow.asStateFlow()
private val _sizeStepFlow = MutableStateFlow(loadSizeStep())
val sizeStepFlow: StateFlow<IconSizeStep> = _sizeStepFlow.asStateFlow()
private val _seenFavoritesFlow = MutableStateFlow(loadSeenFavorites()) private val _seenFavoritesFlow = MutableStateFlow(loadSeenFavorites())
val seenFavoritesFlow: StateFlow<Set<String>> = _seenFavoritesFlow.asStateFlow() val seenFavoritesFlow: StateFlow<Set<String>> = _seenFavoritesFlow.asStateFlow()
@@ -138,7 +242,7 @@ class RadioRepository(context: Context) {
fun markFavoritesSeen(ids: Set<String>) { fun markFavoritesSeen(ids: Set<String>) {
val copy = ids.toSet() val copy = ids.toSet()
_seenFavoritesFlow.value = copy _seenFavoritesFlow.value = copy
prefs.edit { putStringSet("seen_favorites", copy); remove("last_seen_favorites_count") } prefs.edit { putStringSet("seen_favorites", copy) }
} }
fun getLastStationId(): String? { fun getLastStationId(): String? {
@@ -225,34 +329,6 @@ class RadioRepository(context: Context) {
prefs.edit { putString("recents", arr.toString()) } prefs.edit { putString("recents", arr.toString()) }
} }
private fun loadViewMode(): ViewMode {
val mode = prefs.getString("view_mode", ViewMode.ICONS.name) ?: ViewMode.ICONS.name
return try {
ViewMode.valueOf(mode)
} catch (_: Exception) {
ViewMode.ICONS
}
}
fun setViewMode(mode: ViewMode) {
_viewModeFlow.value = mode
prefs.edit { putString("view_mode", mode.name) }
}
private fun loadSizeStep(): IconSizeStep {
val step = prefs.getString("size_step", IconSizeStep.M.name) ?: IconSizeStep.M.name
return try {
IconSizeStep.valueOf(step)
} catch (_: Exception) {
IconSizeStep.M
}
}
fun setSizeStep(step: IconSizeStep) {
_sizeStepFlow.value = step
prefs.edit { putString("size_step", step.name) }
}
fun hasSeenBatteryOptimizationPrompt(): Boolean { fun hasSeenBatteryOptimizationPrompt(): Boolean {
return prefs.getBoolean("seen_battery_optimization_prompt", false) return prefs.getBoolean("seen_battery_optimization_prompt", false)
} }
@@ -42,11 +42,6 @@ object AudioEffectsController {
refresh() refresh()
} }
fun setLoudnessGain(gainMillibel: Float) {
engine?.setLoudnessGain(gainMillibel)
refresh()
}
fun setDynamicsProcessingEnabled(enabled: Boolean) { fun setDynamicsProcessingEnabled(enabled: Boolean) {
engine?.setDynamicsProcessingEnabled(enabled) engine?.setDynamicsProcessingEnabled(enabled)
refresh() refresh()
@@ -25,8 +25,6 @@ data class AudioEffectsState(
val currentPreset: Int = -1, val currentPreset: Int = -1,
val loudnessAvailable: Boolean = false, val loudnessAvailable: Boolean = false,
val loudnessEnabled: Boolean = false, val loudnessEnabled: Boolean = false,
val loudnessGainMillibel: Float = 0f,
val loudnessMaxGainMillibel: Float = 2000f,
val dynamicsProcessingAvailable: Boolean = false, val dynamicsProcessingAvailable: Boolean = false,
val dynamicsProcessingEnabled: Boolean = false val dynamicsProcessingEnabled: Boolean = false
) )
@@ -52,7 +50,10 @@ class AudioEffectsEngine(context: Context, audioSessionId: Int) {
private var equalizerEnabled = prefs.getBoolean(KEY_EQ_ENABLED, false) private var equalizerEnabled = prefs.getBoolean(KEY_EQ_ENABLED, false)
private var loudnessEnabled = prefs.getBoolean(KEY_LOUDNESS_ENABLED, false) private var loudnessEnabled = prefs.getBoolean(KEY_LOUDNESS_ENABLED, false)
private var loudnessGain = prefs.getInt(KEY_LOUDNESS_GAIN, 0).coerceIn(0, MAX_LOUDNESS_GAIN) // There is no gain slider, so the switch applies a fixed, moderate boost. A gain of 0 (the old
// default) made the switch do nothing.
private val loudnessGain = prefs.getInt(KEY_LOUDNESS_GAIN, DEFAULT_LOUDNESS_GAIN)
.takeIf { it > 0 }?.coerceAtMost(MAX_LOUDNESS_GAIN) ?: DEFAULT_LOUDNESS_GAIN
private var dynamicsEnabled = prefs.getBoolean(KEY_DYNAMICS_ENABLED, false) private var dynamicsEnabled = prefs.getBoolean(KEY_DYNAMICS_ENABLED, false)
init { init {
@@ -178,7 +179,6 @@ class AudioEffectsEngine(context: Context, audioSessionId: Int) {
currentPreset = if (eqAvailable) currentPresetIndex else -1, currentPreset = if (eqAvailable) currentPresetIndex else -1,
loudnessAvailable = loudnessEnhancer != null, loudnessAvailable = loudnessEnhancer != null,
loudnessEnabled = loudnessEnhancer != null && loudnessEnabled, loudnessEnabled = loudnessEnhancer != null && loudnessEnabled,
loudnessGainMillibel = if (loudnessEnhancer != null) loudnessGain.toFloat() else 0f,
dynamicsProcessingAvailable = dynamicsProcessing != null, dynamicsProcessingAvailable = dynamicsProcessing != null,
dynamicsProcessingEnabled = dynamicsProcessing != null && dynamicsEnabled dynamicsProcessingEnabled = dynamicsProcessing != null && dynamicsEnabled
) )
@@ -233,17 +233,6 @@ class AudioEffectsEngine(context: Context, audioSessionId: Int) {
} catch (_: Exception) {} } catch (_: Exception) {}
} }
fun setLoudnessGain(gainMillibel: Float) {
val le = loudnessEnhancer ?: return
val gain = gainMillibel.coerceIn(0f, MAX_LOUDNESS_GAIN.toFloat()).toInt()
if (gain == loudnessGain) return
try {
le.setTargetGain(gain)
loudnessGain = gain
prefs.edit { putInt(KEY_LOUDNESS_GAIN, gain) }
} catch (_: Exception) {}
}
fun setDynamicsProcessingEnabled(enabled: Boolean) { fun setDynamicsProcessingEnabled(enabled: Boolean) {
val dp = dynamicsProcessing ?: return val dp = dynamicsProcessing ?: return
try { try {
@@ -265,6 +254,7 @@ class AudioEffectsEngine(context: Context, audioSessionId: Int) {
private companion object { private companion object {
const val TAG = "AudioEffectsEngine" const val TAG = "AudioEffectsEngine"
const val MAX_LOUDNESS_GAIN = 2000 const val MAX_LOUDNESS_GAIN = 2000
const val DEFAULT_LOUDNESS_GAIN = 600
const val KEY_EQ_ENABLED = "eq_enabled" const val KEY_EQ_ENABLED = "eq_enabled"
const val KEY_PRESET = "eq_preset" const val KEY_PRESET = "eq_preset"
const val KEY_BAND_PREFIX = "eq_band_" const val KEY_BAND_PREFIX = "eq_band_"
@@ -15,13 +15,13 @@ import android.util.Log
import androidx.annotation.OptIn import androidx.annotation.OptIn
import androidx.media3.common.AudioAttributes import androidx.media3.common.AudioAttributes
import androidx.media3.common.C import androidx.media3.common.C
import androidx.media3.common.ForwardingSimpleBasePlayer
import androidx.media3.common.MediaItem import androidx.media3.common.MediaItem
import androidx.media3.common.MediaMetadata import androidx.media3.common.MediaMetadata
import androidx.media3.common.PlaybackException import androidx.media3.common.PlaybackException
import androidx.media3.common.Player import androidx.media3.common.Player
import androidx.media3.common.util.UnstableApi import androidx.media3.common.util.UnstableApi
import androidx.media3.datasource.DefaultHttpDataSource import androidx.media3.datasource.DefaultHttpDataSource
import androidx.media3.datasource.HttpDataSource
import androidx.media3.exoplayer.DefaultLoadControl import androidx.media3.exoplayer.DefaultLoadControl
import androidx.media3.exoplayer.ExoPlayer import androidx.media3.exoplayer.ExoPlayer
import androidx.media3.exoplayer.source.DefaultMediaSourceFactory import androidx.media3.exoplayer.source.DefaultMediaSourceFactory
@@ -33,6 +33,7 @@ import androidx.media3.session.MediaSession
import cc.skysparkle.fogwave.BuildConfig import cc.skysparkle.fogwave.BuildConfig
import cc.skysparkle.fogwave.MainActivity import cc.skysparkle.fogwave.MainActivity
import cc.skysparkle.fogwave.R import cc.skysparkle.fogwave.R
import cc.skysparkle.fogwave.data.model.RadioStation
import cc.skysparkle.fogwave.data.repository.RadioRepository import cc.skysparkle.fogwave.data.repository.RadioRepository
import com.google.common.collect.ImmutableList import com.google.common.collect.ImmutableList
import com.google.common.util.concurrent.Futures import com.google.common.util.concurrent.Futures
@@ -50,6 +51,10 @@ class FogwavePlaybackService : MediaLibraryService() {
private var mediaLibrarySession: MediaLibrarySession? = null private var mediaLibrarySession: MediaLibrarySession? = null
private lateinit var repository: RadioRepository private lateinit var repository: RadioRepository
private lateinit var player: ExoPlayer private lateinit var player: ExoPlayer
// Station order for next/previous from the notification, a headset or the car; sorted once,
// like the grid in the app.
private var stationOrder: List<RadioStation> = emptyList()
private var audioEffectsEngine: AudioEffectsEngine? = null private var audioEffectsEngine: AudioEffectsEngine? = null
private val serviceScope = CoroutineScope(Dispatchers.Main.immediate + SupervisorJob()) private val serviceScope = CoroutineScope(Dispatchers.Main.immediate + SupervisorJob())
@@ -66,6 +71,11 @@ class FogwavePlaybackService : MediaLibraryService() {
private var connectivityManager: ConnectivityManager? = null private var connectivityManager: ConnectivityManager? = null
private var networkCallback: ConnectivityManager.NetworkCallback? = null private var networkCallback: ConnectivityManager.NetworkCallback? = null
private var defaultNetwork: Network? = null private var defaultNetwork: Network? = null
private var hasNetwork = true
// Set when a reconnect is due but there is no network: no attempts are spent while offline,
// the stream is reopened from onAvailable instead.
private var waitingForNetwork = false
// ExoPlayer drops its own wake and Wi-Fi locks once the player is idle after an error, so the // ExoPlayer drops its own wake and Wi-Fi locks once the player is idle after an error, so the
// backoff delay would stall while the CPU sleeps. These are held only while a reconnect is pending. // backoff delay would stall while the CPU sleeps. These are held only while a reconnect is pending.
@@ -136,32 +146,96 @@ class FogwavePlaybackService : MediaLibraryService() {
return Futures.immediateFuture(LibraryResult.ofItem(station.toMediaItem(this@FogwavePlaybackService), null)) return Futures.immediateFuture(LibraryResult.ofItem(station.toMediaItem(this@FogwavePlaybackService), null))
} }
// Items coming from a controller are never trusted: only the mediaId (or a voice search
// query) is read, and the stream URI always comes from our own station list. Without this
// an item without a URI (a voice request from Assistant or Android Auto) crashed the
// player, and any app on the device could make Fogwave play an arbitrary stream.
override fun onAddMediaItems( override fun onAddMediaItems(
mediaSession: MediaSession, mediaSession: MediaSession,
controller: MediaSession.ControllerInfo, controller: MediaSession.ControllerInfo,
mediaItems: MutableList<MediaItem> mediaItems: MutableList<MediaItem>
): ListenableFuture<MutableList<MediaItem>> { ): ListenableFuture<MutableList<MediaItem>> {
val resolved = mediaItems.map { item -> val resolved = mediaItems.map { resolveStation(it).toMediaItem(this@FogwavePlaybackService) }
if (item.localConfiguration != null) { .toMutableList()
item resolved.firstOrNull()?.let { onNewRequest(it) }
} else {
repository.stations.find { it.id == item.mediaId }
?.toMediaItem(this@FogwavePlaybackService)
?: item
}
}.toMutableList()
resolved.firstOrNull()?.let { item ->
Log.d(TAG, "MediaItem resolved: mediaId=${item.mediaId} uri=${item.localConfiguration?.uri}")
lastRequestedItem = item
retryJob?.cancel()
retryAttempt = 0
}
return Futures.immediateFuture(resolved) return Futures.immediateFuture(resolved)
} }
} }
private fun resolveStation(item: MediaItem): RadioStation {
val stations = repository.stations
val query = item.requestMetadata.searchQuery?.trim().orEmpty()
return stations.find { it.id == item.mediaId }
?: query.takeIf { it.isNotEmpty() }?.let { q ->
stations.find { it.name.contains(q, ignoreCase = true) }
?: stations.find { q.contains(it.name, ignoreCase = true) }
}
?: stations.find { it.id == repository.getLastStationId() }
?: stations.first()
}
private fun onNewRequest(item: MediaItem) {
Log.d(TAG, "MediaItem resolved: mediaId=${item.mediaId}")
lastRequestedItem = item
retryJob?.cancel()
retryAttempt = 0
waitingForNetwork = false
}
private fun switchStation(step: Int) {
val order = stationOrder.ifEmpty { repository.stations }
val currentId = player.currentMediaItem?.mediaId ?: lastRequestedItem?.mediaId
val index = order.indexOfFirst { it.id == currentId }
val target = if (index < 0) order.first() else order[(index + step).mod(order.size)]
Log.d(TAG, "Switching station: ${target.id}")
val item = target.toMediaItem(this)
onNewRequest(item)
repository.setLastStationId(target.id)
// playWhenReady is kept: a paused player switches the station and stays paused.
player.setMediaItem(item)
player.prepare()
}
/**
* The player only ever holds the station that is on air: with the whole list in ExoPlayer every
* stream would be prepared at once, and the HLS ones would keep refreshing their playlists in
* the background. Instead next/previous are always offered to the session (notification,
* headset buttons, Android Auto) and switch the station here, wrapping around like the app.
*/
private inner class StationSwitchingPlayer(player: Player) : ForwardingSimpleBasePlayer(player) {
override fun getState(): State {
val state = super.getState()
if (state.timeline.isEmpty()) return state
val commands = state.availableCommands.buildUpon()
.addAll(
Player.COMMAND_SEEK_TO_NEXT,
Player.COMMAND_SEEK_TO_NEXT_MEDIA_ITEM,
Player.COMMAND_SEEK_TO_PREVIOUS,
Player.COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM
)
.remove(Player.COMMAND_SET_REPEAT_MODE)
.build()
// REPEAT_MODE_ALL makes next/previous resolve to the single item, which lands in
// handleSeek below with the original seek command.
return state.buildUpon()
.setAvailableCommands(commands)
.setRepeatMode(Player.REPEAT_MODE_ALL)
.build()
}
override fun handleSeek(mediaItemIndex: Int, positionMs: Long, seekCommand: Int): ListenableFuture<*> {
when (seekCommand) {
Player.COMMAND_SEEK_TO_NEXT, Player.COMMAND_SEEK_TO_NEXT_MEDIA_ITEM -> switchStation(+1)
Player.COMMAND_SEEK_TO_PREVIOUS, Player.COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM -> switchStation(-1)
else -> return super.handleSeek(mediaItemIndex, positionMs, seekCommand)
}
return Futures.immediateVoidFuture()
}
// The stream's own repeat mode stays off; a dropped stream is handled by scheduleReconnect.
override fun handleSetRepeatMode(repeatMode: Int): ListenableFuture<*> = Futures.immediateVoidFuture()
}
private val resiliencePlayerListener = object : Player.Listener { private val resiliencePlayerListener = object : Player.Listener {
override fun onPlaybackStateChanged(playbackState: Int) { override fun onPlaybackStateChanged(playbackState: Int) {
val stateName = when (playbackState) { val stateName = when (playbackState) {
@@ -196,6 +270,7 @@ class FogwavePlaybackService : MediaLibraryService() {
Log.d(TAG, "Reconnect cancelled - playWhenReady=false (reason=$reason)") Log.d(TAG, "Reconnect cancelled - playWhenReady=false (reason=$reason)")
} }
retryJob?.cancel() retryJob?.cancel()
waitingForNetwork = false
releaseReconnectLocks() releaseReconnectLocks()
pausedAtMs = SystemClock.elapsedRealtime() pausedAtMs = SystemClock.elapsedRealtime()
return return
@@ -225,25 +300,16 @@ class FogwavePlaybackService : MediaLibraryService() {
} }
} }
// A missing stream or an unsupported format will not fix itself, so it gets only a couple of
// attempts (a stale token or a short server outage can still recover); network errors get the full backoff.
private fun maxRetryAttemptsFor(error: PlaybackException): Int {
val httpCode = (error.cause as? HttpDataSource.InvalidResponseCodeException)?.responseCode
val permanent = when (error.errorCode) {
PlaybackException.ERROR_CODE_IO_BAD_HTTP_STATUS ->
httpCode != null && httpCode in 400..499 && httpCode != 408 && httpCode != 429
PlaybackException.ERROR_CODE_IO_FILE_NOT_FOUND,
PlaybackException.ERROR_CODE_IO_CLEARTEXT_NOT_PERMITTED,
PlaybackException.ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED,
PlaybackException.ERROR_CODE_PARSING_MANIFEST_UNSUPPORTED,
PlaybackException.ERROR_CODE_DECODING_FORMAT_UNSUPPORTED -> true
else -> false
}
return if (permanent) MAX_PERMANENT_ERROR_RETRY_ATTEMPTS else MAX_RETRY_ATTEMPTS
}
private fun scheduleReconnect(immediate: Boolean = false, maxAttempts: Int = MAX_RETRY_ATTEMPTS) { private fun scheduleReconnect(immediate: Boolean = false, maxAttempts: Int = MAX_RETRY_ATTEMPTS) {
retryJob?.cancel() retryJob?.cancel()
if (!immediate && !hasNetwork) {
// Attempts would only fail and run out while offline; wait for onAvailable instead.
Log.d(TAG, "No network - waiting for it before reconnecting")
waitingForNetwork = true
releaseReconnectLocks()
return
}
waitingForNetwork = false
if (!immediate && retryAttempt >= maxAttempts) { if (!immediate && retryAttempt >= maxAttempts) {
// Give up instead of keeping the device busy forever; the error stays visible and a tap // Give up instead of keeping the device busy forever; the error stays visible and a tap
// on play starts over. // on play starts over.
@@ -316,13 +382,23 @@ class FogwavePlaybackService : MediaLibraryService() {
private fun registerNetworkCallback() { private fun registerNetworkCallback() {
val cm = getSystemService(Context.CONNECTIVITY_SERVICE) as? ConnectivityManager ?: return val cm = getSystemService(Context.CONNECTIVITY_SERVICE) as? ConnectivityManager ?: return
connectivityManager = cm connectivityManager = cm
hasNetwork = cm.activeNetwork != null
val callback = object : ConnectivityManager.NetworkCallback() { val callback = object : ConnectivityManager.NetworkCallback() {
// Called on a ConnectivityManager thread; ExoPlayer must only be accessed on the main thread. // Called on a ConnectivityManager thread; ExoPlayer must only be accessed on the main thread.
override fun onAvailable(network: Network) { override fun onAvailable(network: Network) {
serviceScope.launch { serviceScope.launch {
val previous = defaultNetwork val previous = defaultNetwork
defaultNetwork = network defaultNetwork = network
hasNetwork = true
val wasWaiting = waitingForNetwork
waitingForNetwork = false
if (!player.playWhenReady || player.playbackState == Player.STATE_READY) return@launch if (!player.playWhenReady || player.playbackState == Player.STATE_READY) return@launch
if (wasWaiting) {
Log.d(TAG, "Network is back - reconnecting")
retryAttempt = 0
scheduleReconnect(immediate = true)
return@launch
}
// After a switch (e.g. Wi-Fi to mobile) a stalled load can sit on a dead socket until // After a switch (e.g. Wi-Fi to mobile) a stalled load can sit on a dead socket until
// the read timeout, so reopen right away instead of waiting for the error. // the read timeout, so reopen right away instead of waiting for the error.
val switchedWhileStalled = previous != null && previous != network && val switchedWhileStalled = previous != null && previous != network &&
@@ -333,6 +409,13 @@ class FogwavePlaybackService : MediaLibraryService() {
} }
} }
} }
override fun onLost(network: Network) {
serviceScope.launch {
// A switch reports the new network first; only the loss of the current one counts.
if (network == defaultNetwork) hasNetwork = false
}
}
} }
networkCallback = callback networkCallback = callback
try { try {
@@ -344,6 +427,7 @@ class FogwavePlaybackService : MediaLibraryService() {
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
repository = RadioRepository(applicationContext) repository = RadioRepository(applicationContext)
stationOrder = repository.stationsSortedByPopularity()
val audioManager = getSystemService(Context.AUDIO_SERVICE) as? AudioManager val audioManager = getSystemService(Context.AUDIO_SERVICE) as? AudioManager
val audioSessionId = audioManager?.generateAudioSessionId()?.takeIf { it != 0 } val audioSessionId = audioManager?.generateAudioSessionId()?.takeIf { it != 0 }
@@ -385,7 +469,7 @@ class FogwavePlaybackService : MediaLibraryService() {
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
) )
mediaLibrarySession = MediaLibrarySession.Builder(this, player, librarySessionCallback) mediaLibrarySession = MediaLibrarySession.Builder(this, StationSwitchingPlayer(player), librarySessionCallback)
.setSessionActivity(sessionActivity) .setSessionActivity(sessionActivity)
.build() .build()
} }
@@ -412,10 +496,13 @@ class FogwavePlaybackService : MediaLibraryService() {
override fun onGetSession(controllerInfo: MediaSession.ControllerInfo): MediaLibrarySession? = mediaLibrarySession override fun onGetSession(controllerInfo: MediaSession.ControllerInfo): MediaLibrarySession? = mediaLibrarySession
// Swiping the app away keeps only real playback alive (a short rebuffer counts): a failed
// stream, a pending reconnect or a pause stop the service. The Media3 default would also stop
// during a rebuffer, because isPlaying is false while buffering.
override fun onTaskRemoved(rootIntent: Intent?) { override fun onTaskRemoved(rootIntent: Intent?) {
if (!player.playWhenReady || player.mediaItemCount == 0) { val reconnecting = retryJob?.isActive == true || waitingForNetwork || player.playerError != null
player.pause() if (!isPlaybackOngoing() || !player.playWhenReady || player.mediaItemCount == 0 || reconnecting) {
stopSelf() pauseAllPlayersAndStopSelf()
} }
} }
@@ -441,8 +528,6 @@ class FogwavePlaybackService : MediaLibraryService() {
companion object { companion object {
private const val ROOT_ID = "fogwave_root" private const val ROOT_ID = "fogwave_root"
private const val TAG = "FogwavePlaybackService" private const val TAG = "FogwavePlaybackService"
private const val MAX_RETRY_ATTEMPTS = 12
private const val MAX_PERMANENT_ERROR_RETRY_ATTEMPTS = 2
private const val RECONNECT_LOCK_TIMEOUT_MS = 2 * 60_000L private const val RECONNECT_LOCK_TIMEOUT_MS = 2 * 60_000L
private const val LIVE_RESYNC_AFTER_MS = 30_000L private const val LIVE_RESYNC_AFTER_MS = 30_000L
} }
@@ -0,0 +1,45 @@
package cc.skysparkle.fogwave.player
import androidx.annotation.OptIn
import androidx.media3.common.PlaybackException
import androidx.media3.common.Player
import androidx.media3.common.util.UnstableApi
import androidx.media3.datasource.HttpDataSource
// Kept apart from the service and the UI controller so the decisions can be unit tested.
internal const val MAX_RETRY_ATTEMPTS = 12
internal const val MAX_PERMANENT_ERROR_RETRY_ATTEMPTS = 2
// A missing stream or an unsupported format will not fix itself, so it gets only a couple of
// attempts (a stale token or a short server outage can still recover); network errors get the full backoff.
@OptIn(UnstableApi::class)
internal fun maxRetryAttemptsFor(error: PlaybackException): Int {
val httpCode = (error.cause as? HttpDataSource.InvalidResponseCodeException)?.responseCode
val permanent = when (error.errorCode) {
PlaybackException.ERROR_CODE_IO_BAD_HTTP_STATUS ->
httpCode != null && httpCode in 400..499 && httpCode != 408 && httpCode != 429
PlaybackException.ERROR_CODE_IO_FILE_NOT_FOUND,
PlaybackException.ERROR_CODE_IO_CLEARTEXT_NOT_PERMITTED,
PlaybackException.ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED,
PlaybackException.ERROR_CODE_PARSING_MANIFEST_UNSUPPORTED,
PlaybackException.ERROR_CODE_DECODING_FORMAT_UNSUPPORTED -> true
else -> false
}
return if (permanent) MAX_PERMANENT_ERROR_RETRY_ATTEMPTS else MAX_RETRY_ATTEMPTS
}
/** What the UI shows for the session's player; [errorMessage] turns a playback error into text. */
internal fun deriveState(p: Player, errorMessage: (PlaybackException) -> String): PlayerState {
p.playerError?.let { return PlayerState.Error(errorMessage(it)) }
return when (p.playbackState) {
Player.STATE_READY -> if (p.playWhenReady) PlayerState.Playing else PlayerState.Paused
Player.STATE_BUFFERING, Player.STATE_ENDED ->
if (p.playWhenReady) PlayerState.Connecting else PlayerState.Paused
else -> when {
p.mediaItemCount == 0 -> PlayerState.Idle
p.playWhenReady -> PlayerState.Connecting
else -> PlayerState.Paused
}
}
}
@@ -30,6 +30,10 @@ class RadioPlayerManager(private val context: Context) {
private val _currentMediaId = MutableStateFlow<String?>(null) private val _currentMediaId = MutableStateFlow<String?>(null)
val currentMediaId: StateFlow<String?> = _currentMediaId.asStateFlow() val currentMediaId: StateFlow<String?> = _currentMediaId.asStateFlow()
/** Song announced by the stream (ICY / ID3 metadata), or null when the station sends none. */
private val _nowPlayingTitle = MutableStateFlow<String?>(null)
val nowPlayingTitle: StateFlow<String?> = _nowPlayingTitle.asStateFlow()
private var currentStation: RadioStation? = null private var currentStation: RadioStation? = null
private var pendingStation: RadioStation? = null private var pendingStation: RadioStation? = null
@@ -39,8 +43,9 @@ class RadioPlayerManager(private val context: Context) {
private val playerListener = object : Player.Listener { private val playerListener = object : Player.Listener {
override fun onEvents(player: Player, events: Player.Events) { override fun onEvents(player: Player, events: Player.Events) {
_playerState.value = deriveState(player) _playerState.value = deriveState(player, ::errorMessage)
_currentMediaId.value = player.currentMediaItem?.mediaId _currentMediaId.value = player.currentMediaItem?.mediaId
_nowPlayingTitle.value = streamTitle(player)
} }
override fun onPlayerError(error: PlaybackException) { override fun onPlayerError(error: PlaybackException) {
@@ -83,8 +88,9 @@ class RadioPlayerManager(private val context: Context) {
if (station != null) { if (station != null) {
playStation(station) playStation(station)
} else { } else {
_playerState.value = deriveState(c) _playerState.value = deriveState(c, ::errorMessage)
_currentMediaId.value = c.currentMediaItem?.mediaId _currentMediaId.value = c.currentMediaItem?.mediaId
_nowPlayingTitle.value = streamTitle(c)
} }
} catch (e: Exception) { } catch (e: Exception) {
Log.e(TAG, "Failed to connect to FogwavePlaybackService", e) Log.e(TAG, "Failed to connect to FogwavePlaybackService", e)
@@ -111,18 +117,12 @@ class RadioPlayerManager(private val context: Context) {
controllerFuture = null controllerFuture = null
} }
private fun deriveState(p: Player): PlayerState { // Stream metadata replaces the item's own title; the station name itself is not a song.
p.playerError?.let { return PlayerState.Error(errorMessage(it)) } private fun streamTitle(p: Player): String? {
return when (p.playbackState) { val title = p.mediaMetadata.title?.toString()?.trim()
Player.STATE_READY -> if (p.playWhenReady) PlayerState.Playing else PlayerState.Paused if (title.isNullOrEmpty()) return null
Player.STATE_BUFFERING, Player.STATE_ENDED -> if (title == p.currentMediaItem?.mediaMetadata?.title?.toString()?.trim()) return null
if (p.playWhenReady) PlayerState.Connecting else PlayerState.Paused return title
else -> when {
p.mediaItemCount == 0 -> PlayerState.Idle
p.playWhenReady -> PlayerState.Connecting
else -> PlayerState.Paused
}
}
} }
private fun errorMessage(error: PlaybackException): String = context.getString( private fun errorMessage(error: PlaybackException): String = context.getString(
@@ -144,6 +144,7 @@ class RadioPlayerManager(private val context: Context) {
return return
} }
_playerState.value = PlayerState.Connecting _playerState.value = PlayerState.Connecting
_nowPlayingTitle.value = null
try { try {
c.setMediaItem(station.toMediaItem(context)) c.setMediaItem(station.toMediaItem(context))
c.prepare() c.prepare()
@@ -5,12 +5,15 @@ import android.content.Context
import androidx.core.net.toUri import androidx.core.net.toUri
import androidx.media3.common.MediaItem import androidx.media3.common.MediaItem
import androidx.media3.common.MediaMetadata import androidx.media3.common.MediaMetadata
import androidx.media3.common.MimeTypes
import cc.skysparkle.fogwave.data.model.RadioStation import cc.skysparkle.fogwave.data.model.RadioStation
fun RadioStation.toMediaItem(context: Context): MediaItem { fun RadioStation.toMediaItem(context: Context): MediaItem {
val artworkUri = "${ContentResolver.SCHEME_ANDROID_RESOURCE}://${context.packageName}/$iconResId".toUri() val artworkUri = "${ContentResolver.SCHEME_ANDROID_RESOURCE}://${context.packageName}/$iconResId".toUri()
return MediaItem.Builder() return MediaItem.Builder()
.setUri(streamUrl) .setUri(streamUrl)
// HLS playlists are picked up by the HLS module; everything else stays a progressive stream.
.apply { if (streamUrl.substringBefore('?').endsWith(".m3u8")) setMimeType(MimeTypes.APPLICATION_M3U8) }
.setMediaId(id) .setMediaId(id)
.setMediaMetadata( .setMediaMetadata(
MediaMetadata.Builder() MediaMetadata.Builder()
@@ -1,43 +1,57 @@
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.screens.Onboarding
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://github.com/kalarina-bit/Fogwave"
private const val DONATE_URL = "https://ko-fi.com/skysparkle"
private const val PRIVACY_POLICY_URL = "https://skysparkle.cc/privacy?lang=en" private const val PRIVACY_POLICY_URL = "https://skysparkle.cc/privacy?lang=en"
@Composable @Composable
@@ -48,92 +62,57 @@ 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) verticalArrangement = Arrangement.spacedBy(10.dp)
) { ) {
Column( AppHeader()
modifier = Modifier SupportCard(onDonate = { context.openUrl(DONATE_URL) })
.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)
) {
Box(
modifier = Modifier
.size(64.dp)
.clip(RoundedCornerShape(20.dp)),
contentAlignment = Alignment.Center
) {
AppIcon(
resId = R.drawable.ic_fogwave_logo,
contentDescription = stringResource(R.string.fogwave_logo_content_desc),
size = 52.dp
)
}
Text( SectionLabel(stringResource(R.string.about_appearance))
text = stringResource(R.string.app_name), GroupCard {
style = MaterialTheme.typography.titleLarge.copy( StylePicker()
fontWeight = FontWeight.ExtraBold, CardDivider()
fontSize = 22.sp, StationFogRow()
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( SectionLabel(stringResource(R.string.about_more))
iconRes = R.drawable.ic_repo, GroupCard {
iconTint = null, LinkRow(
title = stringResource(R.string.about_my_repository), iconRes = R.drawable.ic_mc_check,
subtitle = REPOSITORY_URL.removePrefix("https://git.skysparkle.cc/"), title = stringResource(R.string.guide_show),
trailingIconRes = R.drawable.ic_open_in_new, subtitle = stringResource(R.string.guide_show_subtitle),
onClick = { context.openUrl(REPOSITORY_URL) }, external = false,
modifier = Modifier.testTag("github_repo_card") onClick = { Onboarding.show() },
) modifier = Modifier.testTag("guide_card")
)
AboutLinkCard( CardDivider()
iconRes = R.drawable.ic_privacy, LinkRow(
title = stringResource(R.string.privacy_title), iconRes = R.drawable.ic_mc_code,
subtitle = stringResource(R.string.privacy_subtitle), title = stringResource(R.string.about_my_repository),
trailingIconRes = R.drawable.ic_open_in_new, subtitle = REPOSITORY_URL.removePrefix("https://"),
onClick = { context.openUrl(PRIVACY_POLICY_URL) }, external = true,
modifier = Modifier.testTag("privacy_card") onClick = { context.openUrl(REPOSITORY_URL) },
) modifier = Modifier.testTag("github_repo_card")
)
AboutLinkCard( CardDivider()
iconRes = R.drawable.ic_copyright, LinkRow(
title = stringResource(R.string.licenses_title), iconRes = R.drawable.ic_mc_shield,
subtitle = stringResource(R.string.licenses_subtitle), title = stringResource(R.string.privacy_title),
trailingIconRes = R.drawable.ic_chevron_right, subtitle = stringResource(R.string.privacy_subtitle),
onClick = { showLicenses = true }, external = true,
modifier = Modifier.testTag("licenses_card") onClick = { context.openUrl(PRIVACY_POLICY_URL) },
) modifier = Modifier.testTag("privacy_card")
)
CardDivider()
LinkRow(
iconRes = R.drawable.ic_mc_copyright,
title = stringResource(R.string.licenses_title),
subtitle = stringResource(R.string.licenses_subtitle),
external = false,
onClick = { showLicenses = true },
modifier = Modifier.testTag("licenses_card")
)
}
} }
if (showLicenses) { if (showLicenses) {
@@ -141,86 +120,375 @@ fun AboutPanel(modifier: Modifier = Modifier) {
} }
} }
/** 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, Row(
@DrawableRes trailingIconRes: Int, verticalAlignment = Alignment.CenterVertically,
onClick: () -> Unit, horizontalArrangement = Arrangement.spacedBy(14.dp)
modifier: Modifier = Modifier,
iconTint: Color? = LocalGeoColors.current.deepPurple
) {
val opensBrowser = trailingIconRes == R.drawable.ic_open_in_new
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,
horizontalArrangement = Arrangement.spacedBy(14.dp)
) {
Box(
modifier = Modifier
.size(48.dp)
.clip(RoundedCornerShape(14.dp))
.background(LocalGeoColors.current.primaryContainer)
.border(1.dp, LocalGeoColors.current.outlineVariant, RoundedCornerShape(14.dp)),
contentAlignment = Alignment.Center
) { ) {
AppIcon(
resId = iconRes,
tint = iconTint ?: Color.Unspecified,
size = if (iconTint == null) 32.dp else 26.dp
)
}
Column(modifier = Modifier.weight(1f)) {
Text(
text = title,
style = MaterialTheme.typography.titleSmall.copy(
fontWeight = FontWeight.Bold,
fontSize = 15.sp,
color = LocalGeoColors.current.deepPurple
)
)
Text(
text = subtitle,
style = MaterialTheme.typography.bodySmall.copy(
fontSize = 12.sp,
color = LocalGeoColors.current.primary
)
)
}
if (opensBrowser) {
Box( Box(
modifier = Modifier modifier = Modifier
.size(36.dp) .size(52.dp)
.clip(CircleShape) .clip(RoundedCornerShape(16.dp))
.background(LocalGeoColors.current.primaryContainer), .background(colors.primaryContainer),
contentAlignment = Alignment.Center contentAlignment = Alignment.Center
) { ) {
AppIcon( AppIcon(
resId = trailingIconRes, resId = R.drawable.ic_fogwave_logo,
tint = LocalGeoColors.current.deepPurple, contentDescription = stringResource(R.string.fogwave_logo_content_desc),
size = 18.dp size = 40.dp
) )
} }
} else { Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
AppIcon( Text(
resId = trailingIconRes, text = stringResource(R.string.app_name),
tint = LocalGeoColors.current.onSurfaceVariant, style = MaterialTheme.typography.titleLarge.copy(
size = 18.dp 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,
fontSize = 11.sp,
color = colors.primary
),
modifier = Modifier
.clip(CircleShape)
.background(colors.primaryContainer)
.padding(horizontal = 9.dp, vertical = 3.dp)
.testTag("about_version")
)
}
}
Text(
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)
)
}
}
/** Asks for a donation: a heart, a short note and one button. */
@Composable
private fun SupportCard(onDonate: () -> Unit) {
val colors = LocalGeoColors.current
GroupCard(contentPadding = 16.dp) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(14.dp)
) {
Box(
modifier = Modifier
.size(44.dp)
.clip(RoundedCornerShape(14.dp))
.background(colors.primaryContainer),
contentAlignment = Alignment.Center
) {
AppIcon(resId = R.drawable.ic_heart_fill, tint = colors.primary, size = 22.dp)
}
Column(modifier = Modifier.weight(1f)) {
RowTitle(stringResource(R.string.support_title))
RowSubtitle(stringResource(R.string.support_text), maxLines = 4)
}
}
Row(
modifier = Modifier
.padding(top = 14.dp)
.fillMaxWidth()
.height(46.dp)
.clip(CircleShape)
.background(colors.accentLavender)
.clickable(
onClickLabel = stringResource(R.string.about_open_in_browser),
role = Role.Button,
onClick = onDonate
)
.testTag("donate_button"),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.CenterHorizontally)
) {
AppIcon(resId = R.drawable.ic_heart_fill, tint = colors.onAccentLavender, size = 18.dp)
Text(
text = stringResource(R.string.support_button),
style = MaterialTheme.typography.labelLarge.copy(
fontWeight = FontWeight.Bold,
color = colors.onAccentLavender
)
) )
} }
} }
} }
@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(
fontSize = 12.sp,
lineHeight = 17.sp,
color = colors.onSurfaceVariant
),
modifier = Modifier.padding(top = 12.dp)
)
}
}
}
@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(
modifier = Modifier
.size(42.dp)
.border(2.dp, ring, CircleShape)
.padding(4.dp)
.clip(CircleShape)
.background(preview.surfaceContainerHigh),
contentAlignment = Alignment.Center
) {
Box(
modifier = Modifier
.size(24.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
)
}
}
@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(
resId = if (external) R.drawable.ic_mc_external else R.drawable.ic_mc_right,
tint = LocalGeoColors.current.onSurfaceVariant,
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)
)
}
@@ -101,7 +101,7 @@ fun EqualizerSheet(
text = if (audioEffects.equalizerEnabled) stringResource(R.string.equalizer_on) else stringResource(R.string.equalizer_off), text = if (audioEffects.equalizerEnabled) stringResource(R.string.equalizer_on) else stringResource(R.string.equalizer_off),
style = MaterialTheme.typography.labelMedium.copy( style = MaterialTheme.typography.labelMedium.copy(
fontWeight = FontWeight.Bold, fontWeight = FontWeight.Bold,
color = if (audioEffects.equalizerEnabled) LocalGeoColors.current.liveGreen else LocalGeoColors.current.onSurfaceVariant color = if (audioEffects.equalizerEnabled) LocalGeoColors.current.primary else LocalGeoColors.current.onSurfaceVariant
), ),
modifier = Modifier.padding(end = 6.dp) modifier = Modifier.padding(end = 6.dp)
) )
@@ -177,7 +177,7 @@ fun EqualizerSheet(
) { ) {
val db = (band.levelMillibel / 100f).roundToInt() val db = (band.levelMillibel / 100f).roundToInt()
Text( 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( style = MaterialTheme.typography.labelSmall.copy(
fontSize = 11.sp, fontSize = 11.sp,
fontWeight = FontWeight.SemiBold, fontWeight = FontWeight.SemiBold,
@@ -356,10 +356,11 @@ private fun ToggleRow(
} }
} }
@Composable
private fun frequencyLabel(hz: Int): String = when { private fun frequencyLabel(hz: Int): String = when {
hz < 1000 -> "$hz Hz" hz < 1000 -> stringResource(R.string.eq_freq_hz, hz.toString())
hz % 1000 == 0 -> "${hz / 1000} kHz" hz % 1000 == 0 -> stringResource(R.string.eq_freq_khz, (hz / 1000).toString())
else -> String.format(Locale.getDefault(), "%.1f kHz", hz / 1000f) 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. // Preset names come from the device's audio framework in English; translate the standard ones.
@@ -15,9 +15,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
@@ -33,6 +30,7 @@ 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.draw.shadow
import androidx.compose.ui.platform.testTag import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
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.TextAlign
@@ -40,9 +38,7 @@ 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.R import cc.skysparkle.fogwave.R
import cc.skysparkle.fogwave.data.model.IconSizeStep
import cc.skysparkle.fogwave.data.model.RadioStation import cc.skysparkle.fogwave.data.model.RadioStation
import cc.skysparkle.fogwave.data.model.ViewMode
import cc.skysparkle.fogwave.ui.theme.LocalGeoColors import cc.skysparkle.fogwave.ui.theme.LocalGeoColors
@Composable @Composable
@@ -50,8 +46,6 @@ fun FavoritesPanel(
favorites: List<RadioStation>, favorites: List<RadioStation>,
currentStation: RadioStation?, currentStation: RadioStation?,
isPlaying: Boolean, isPlaying: Boolean,
viewMode: ViewMode,
sizeStep: IconSizeStep,
onSelectStation: (RadioStation) -> Unit, onSelectStation: (RadioStation) -> Unit,
onBrowseStations: () -> Unit, onBrowseStations: () -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
@@ -66,68 +60,27 @@ fun FavoritesPanel(
return return
} }
StationCollection( LazyColumn(
stations = favorites, contentPadding = PaddingValues(start = 10.dp, end = 10.dp, top = 8.dp, bottom = bottomContentPadding),
currentStation = currentStation, verticalArrangement = Arrangement.spacedBy(2.dp),
isPlaying = isPlaying,
viewMode = viewMode,
sizeStep = sizeStep,
onSelectStation = onSelectStation,
bottomContentPadding = bottomContentPadding,
modifier = modifier modifier = modifier
) ) {
} item(key = "header") {
SectionHeader(
/** The station grid (Icons mode) or list (other modes), shared by the Radio and Favorites tabs. */ title = stringResource(R.string.tab_favorites),
@Composable trailing = pluralStringResource(R.plurals.station_count, favorites.size, favorites.size),
fun StationCollection( modifier = Modifier.padding(start = 10.dp, end = 10.dp, bottom = 8.dp)
stations: List<RadioStation>, )
currentStation: RadioStation?,
isPlaying: Boolean,
viewMode: ViewMode,
sizeStep: IconSizeStep,
onSelectStation: (RadioStation) -> Unit,
bottomContentPadding: Dp,
modifier: Modifier = Modifier
) {
val contentPadding = PaddingValues(start = 20.dp, end = 20.dp, top = 8.dp, bottom = bottomContentPadding)
when (viewMode) {
ViewMode.ICONS -> LazyVerticalGrid(
columns = GridCells.Adaptive((sizeStep.sizeDp + 16).dp),
horizontalArrangement = Arrangement.spacedBy(12.dp),
verticalArrangement = Arrangement.spacedBy(14.dp),
contentPadding = contentPadding,
modifier = modifier
) {
items(stations, key = { it.id }) { station ->
val isCur = station.id == currentStation?.id
StationItem(
station = station,
isCurrent = isCur,
isPlaying = isCur && isPlaying,
viewMode = viewMode,
sizeStep = sizeStep,
onClick = { onSelectStation(station) }
)
}
} }
items(favorites, key = { it.id }) { station ->
ViewMode.TILES, ViewMode.LIST, ViewMode.DETAILS -> LazyColumn( val isCur = station.id == currentStation?.id
contentPadding = contentPadding, StationRow(
verticalArrangement = Arrangement.spacedBy(8.dp), station = station,
modifier = modifier isCurrent = isCur,
) { isPlaying = isCur && isPlaying,
items(stations, key = { it.id }) { station -> onClick = { onSelectStation(station) },
val isCur = station.id == currentStation?.id modifier = Modifier.animateItem()
StationItem( )
station = station,
isCurrent = isCur,
isPlaying = isCur && isPlaying,
viewMode = viewMode,
sizeStep = sizeStep,
onClick = { onSelectStation(station) }
)
}
} }
} }
} }
@@ -0,0 +1,147 @@
package cc.skysparkle.fogwave.ui.components
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
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.layout.Spacer
import androidx.compose.runtime.Composable
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
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
import kotlin.math.cos
import kotlin.math.max
import kotlin.math.sin
/** One drifting patch of mist: where it rests, how far and how it wanders, and how big it is. */
private class Wisp(
val x: Float,
val y: Float,
val dx: Float,
val dy: Float,
val phase: Float,
val radius: Float,
val alpha: Float,
val mix: Float
)
private val Wisps = listOf(
Wisp(x = 0.18f, y = 0.30f, dx = 0.10f, dy = 0.05f, phase = 0.0f, radius = 0.62f, alpha = 0.55f, mix = 0.0f),
Wisp(x = 0.82f, y = 0.42f, dx = 0.08f, dy = 0.07f, phase = 1.9f, radius = 0.55f, alpha = 0.45f, mix = 0.35f),
Wisp(x = 0.50f, y = 0.70f, dx = 0.14f, dy = 0.04f, phase = 3.7f, radius = 0.70f, alpha = 0.35f, mix = 0.15f),
Wisp(x = 0.35f, y = 0.55f, dx = 0.06f, dy = 0.08f, phase = 5.1f, radius = 0.38f, alpha = 0.22f, mix = 0.8f)
)
/**
* 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,
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 = transition.animateFloat(
initialValue = 0f,
targetValue = TWO_PI,
animationSpec = infiniteRepeatable(tween(28_000, easing = LinearEasing), RepeatMode.Restart),
label = "fog_t"
)
val breathe = transition.animateFloat(
initialValue = 0.85f,
targetValue = 1f,
animationSpec = infiniteRepeatable(tween(6_000), RepeatMode.Reverse),
label = "fog_breathe"
)
// 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) {}
}
}
@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 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]) }
}
}
)
}
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)
// 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 = 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()
.graphicsLayer { compositingStrategy = CompositingStrategy.Offscreen }
.drawWithContent {
drawContent()
drawRect(
brush = Brush.verticalGradient(from to Color.Black, 1f to Color.Transparent),
blendMode = BlendMode.DstIn
)
}
@@ -0,0 +1,72 @@
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
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
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.res.painterResource
import androidx.compose.ui.unit.dp
import cc.skysparkle.fogwave.R
import cc.skysparkle.fogwave.ui.theme.LocalGeoColors
/**
* 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 background = LocalGeoColors.current.background
// Cool, slightly desaturated photo so the colored fog and the UI stay in front.
val muted = remember {
ColorFilter.colorMatrix(ColorMatrix().apply { setToSaturation(0.35f) })
}
Box(
modifier = modifier
.fillMaxWidth()
.height(420.dp)
.graphicsLayer { alpha = visibility().coerceIn(0f, 1f) }
// Everything (photo and fog) melts into the page instead of ending at a hard edge.
.fadeOutBottom(from = 0.45f)
) {
Image(
painter = painterResource(R.drawable.bg_misty_mountain),
contentDescription = null,
contentScale = ContentScale.Crop,
alignment = Alignment.TopCenter,
colorFilter = muted,
alpha = 0.5f,
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
.fillMaxSize()
.background(
Brush.verticalGradient(
0f to background.copy(alpha = 0.45f),
0.35f to Color.Transparent
)
)
)
}
}
@@ -46,13 +46,11 @@ private val LIBRARIES = listOf(
LicenseRow("AndroidX Activity Compose", AOSP, APACHE, "https://developer.android.com/jetpack/androidx/releases/activity", BuildConfig.ACTIVITY_VERSION), LicenseRow("AndroidX Activity Compose", AOSP, APACHE, "https://developer.android.com/jetpack/androidx/releases/activity", BuildConfig.ACTIVITY_VERSION),
LicenseRow("AndroidX Core KTX", AOSP, APACHE, "https://developer.android.com/jetpack/androidx/releases/core", BuildConfig.CORE_KTX_VERSION), LicenseRow("AndroidX Core KTX", AOSP, APACHE, "https://developer.android.com/jetpack/androidx/releases/core", BuildConfig.CORE_KTX_VERSION),
LicenseRow("AndroidX Lifecycle (ViewModel + Runtime Compose)", AOSP, APACHE, "https://developer.android.com/jetpack/androidx/releases/lifecycle", BuildConfig.LIFECYCLE_VERSION), LicenseRow("AndroidX Lifecycle (ViewModel + Runtime Compose)", AOSP, APACHE, "https://developer.android.com/jetpack/androidx/releases/lifecycle", BuildConfig.LIFECYCLE_VERSION),
LicenseRow("AndroidX Media3 (ExoPlayer, MediaSession)", AOSP, APACHE, "https://developer.android.com/jetpack/androidx/releases/media3", BuildConfig.MEDIA3_VERSION), LicenseRow("AndroidX Media3 (ExoPlayer, HLS, MediaSession)", AOSP, APACHE, "https://developer.android.com/jetpack/androidx/releases/media3", BuildConfig.MEDIA3_VERSION),
LicenseRow("AndroidX \u2014 other libraries pulled in by the ones above", AOSP, APACHE, "https://developer.android.com/jetpack/androidx"), 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("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("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("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/")
) )
private val ASSETS = listOf( 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", "M-1 group", BROADCASTER, "https://www.m-1.fm/"),
LicenseRow("M-1 Plius", "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("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 @Composable
@@ -5,7 +5,6 @@ import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.animate import androidx.compose.animation.core.animate
import androidx.compose.animation.core.spring import androidx.compose.animation.core.spring
import androidx.compose.animation.core.tween import androidx.compose.animation.core.tween
import androidx.compose.foundation.Image
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
@@ -40,11 +39,10 @@ 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.draw.shadow
import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.testTag import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
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.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.IntOffset
@@ -63,8 +61,8 @@ private val TABLET_MINI_PLAYER_MAX_WIDTH_DP = 640.dp
fun MiniPlayer( fun MiniPlayer(
station: RadioStation?, station: RadioStation?,
playerState: PlayerState, playerState: PlayerState,
trackTitle: String?,
onTogglePlay: () -> Unit, onTogglePlay: () -> Unit,
onPrevious: () -> Unit,
onNext: () -> Unit, onNext: () -> Unit,
onOpenNowPlaying: () -> Unit, onOpenNowPlaying: () -> Unit,
onHide: () -> Unit, onHide: () -> Unit,
@@ -72,6 +70,7 @@ fun MiniPlayer(
) { ) {
if (station == null) return if (station == null) return
val colors = LocalGeoColors.current
val isPlaying = playerState is PlayerState.Playing val isPlaying = playerState is PlayerState.Playing
val isConnecting = playerState is PlayerState.Connecting val isConnecting = playerState is PlayerState.Connecting
val isError = playerState is PlayerState.Error val isError = playerState is PlayerState.Error
@@ -79,7 +78,7 @@ fun MiniPlayer(
val subText = when { val subText = when {
isError -> playerState.message isError -> playerState.message
isConnecting -> stringResource(R.string.player_connecting) isConnecting -> stringResource(R.string.player_connecting)
isPlaying -> stringResource(R.string.player_on_air) isPlaying && trackTitle != null -> trackTitle
else -> stationDescription(station) else -> stationDescription(station)
} }
@@ -107,10 +106,10 @@ fun MiniPlayer(
Row( Row(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.shadow(6.dp, RoundedCornerShape(32.dp)) .shadow(12.dp, RoundedCornerShape(28.dp))
.clip(RoundedCornerShape(32.dp)) .clip(RoundedCornerShape(28.dp))
.background(LocalGeoColors.current.surfaceContainer) .background(colors.surfaceContainerHigh)
.border(1.dp, LocalGeoColors.current.outlineVariant, RoundedCornerShape(32.dp)) .border(1.dp, colors.outlineVariant, RoundedCornerShape(28.dp))
.clickable( .clickable(
interactionSource = remember { MutableInteractionSource() }, interactionSource = remember { MutableInteractionSource() },
indication = ripple(bounded = true) indication = ripple(bounded = true)
@@ -150,109 +149,84 @@ fun MiniPlayer(
} }
} }
) )
.padding(start = 10.dp, end = 12.dp, top = 8.dp, bottom = 8.dp) .padding(start = 8.dp, end = 4.dp, top = 8.dp, bottom = 8.dp)
.testTag("mini_player"), .testTag("mini_player"),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp) horizontalArrangement = Arrangement.spacedBy(12.dp)
) { ) {
Box( StationDisc(
modifier = Modifier station = station,
.size(46.dp) isPlaying = isPlaying,
.clip(RoundedCornerShape(14.dp)) ringWidth = 2.dp,
.background(stationTileColor(station)) ringGap = 3.dp,
.border(1.dp, LocalGeoColors.current.outlineVariant, RoundedCornerShape(14.dp)) glow = false,
) { modifier = Modifier.size(56.dp)
Image( )
painter = painterResource(id = station.iconResId),
contentDescription = null,
contentScale = ContentScale.Crop,
modifier = Modifier.matchParentSize()
)
}
Column( Column(
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
verticalArrangement = Arrangement.Center verticalArrangement = Arrangement.spacedBy(1.dp)
) { ) {
LiveLabel(active = isPlaying)
Text( Text(
text = station.name, text = station.name,
style = MaterialTheme.typography.bodyMedium.copy( style = MaterialTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold, fontWeight = FontWeight.Bold,
fontSize = 14.5.sp, fontSize = 15.sp,
color = LocalGeoColors.current.deepPurple color = colors.deepPurple
), ),
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis overflow = TextOverflow.Ellipsis
) )
Text( Text(
text = subText, text = subText,
style = MaterialTheme.typography.bodySmall.copy( style = MaterialTheme.typography.bodySmall.copy(
fontSize = 11.5.sp, fontSize = 12.sp,
color = if (isError) LocalGeoColors.current.redFavorite else (if (isPlaying) LocalGeoColors.current.liveGreen else LocalGeoColors.current.onSurfaceVariant) color = if (isError) colors.redFavorite else colors.onSurfaceVariant
), ),
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis overflow = TextOverflow.Ellipsis
) )
} }
Row( Box(
verticalAlignment = Alignment.CenterVertically, modifier = Modifier
horizontalArrangement = Arrangement.spacedBy(2.dp) .size(48.dp)
.shadow(6.dp, CircleShape)
.clip(CircleShape)
.background(colors.accentLavender)
.clickable(role = Role.Button) { onTogglePlay() }
.testTag("mini_play_btn"),
contentAlignment = Alignment.Center
) { ) {
IconButton( if (isConnecting) {
onClick = onPrevious, CircularProgressIndicator(
modifier = Modifier modifier = Modifier.size(22.dp),
.size(36.dp) color = colors.onAccentLavender,
.testTag("mini_prev_btn") strokeWidth = 2.dp
) { )
} else {
AppIcon( AppIcon(
resId = R.drawable.ic_chevron_left, resId = if (isPlaying) R.drawable.ic_pause else R.drawable.ic_play,
contentDescription = stringResource(R.string.previous_station_content_desc), contentDescription = if (isPlaying) stringResource(R.string.pause_content_desc) else stringResource(R.string.play_content_desc),
tint = LocalGeoColors.current.onSurfaceVariant, tint = colors.onAccentLavender,
size = 24.dp size = 22.dp
) )
} }
}
Box( IconButton(
modifier = Modifier onClick = onNext,
.size(42.dp) modifier = Modifier
.shadow(2.dp, CircleShape) .size(40.dp)
.clip(CircleShape) .testTag("mini_next_btn")
.background(LocalGeoColors.current.accentLavender) ) {
.clickable { onTogglePlay() } AppIcon(
.testTag("mini_play_btn"), resId = R.drawable.ic_skip_next,
contentAlignment = Alignment.Center contentDescription = stringResource(R.string.next_station_content_desc),
) { tint = colors.onSurfaceVariant,
if (isConnecting) { size = 22.dp
CircularProgressIndicator( )
modifier = Modifier.size(20.dp),
color = LocalGeoColors.current.onAccentLavender,
strokeWidth = 2.dp
)
} else {
AppIcon(
resId = if (isPlaying) R.drawable.ic_pause else R.drawable.ic_play,
contentDescription = if (isPlaying) stringResource(R.string.pause_content_desc) else stringResource(R.string.play_content_desc),
tint = LocalGeoColors.current.onAccentLavender,
size = 22.dp
)
}
}
IconButton(
onClick = onNext,
modifier = Modifier
.size(36.dp)
.testTag("mini_next_btn")
) {
AppIcon(
resId = R.drawable.ic_chevron_right,
contentDescription = stringResource(R.string.next_station_content_desc),
tint = LocalGeoColors.current.onSurfaceVariant,
size = 24.dp
)
}
} }
} }
} }
@@ -1,53 +0,0 @@
package cc.skysparkle.fogwave.ui.components
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import coil.compose.AsyncImage
import coil.request.ImageRequest
import coil.size.Scale
import cc.skysparkle.fogwave.R
import cc.skysparkle.fogwave.ui.theme.LocalGeoColors
@Composable
fun MistyMountainBackground(modifier: Modifier = Modifier) {
val context = LocalContext.current
val request = remember(context) {
ImageRequest.Builder(context)
.data(R.drawable.bg_misty_mountain)
.scale(Scale.FILL)
.crossfade(200)
.build()
}
Box(modifier = modifier.fillMaxSize().background(LocalGeoColors.current.background)) {
AsyncImage(
model = request,
contentDescription = null,
contentScale = ContentScale.Crop,
modifier = Modifier.fillMaxSize()
)
val scrimBase = LocalGeoColors.current.background
Box(
modifier = Modifier
.fillMaxSize()
.background(
Brush.verticalGradient(
colors = listOf(
scrimBase.copy(alpha = 0.62f),
scrimBase.copy(alpha = 0.48f),
scrimBase.copy(alpha = 0.52f),
scrimBase.copy(alpha = 0.78f)
)
)
)
)
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,132 @@
package cc.skysparkle.fogwave.ui.components
import android.content.res.Resources
import android.graphics.BitmapFactory
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.produceState
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.core.graphics.ColorUtils
import cc.skysparkle.fogwave.data.model.RadioStation
import java.util.concurrent.ConcurrentHashMap
import kotlin.math.abs
import kotlin.math.atan2
import kotlin.math.cos
import kotlin.math.sin
import kotlin.math.sqrt
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
/**
* What the UI needs to know about a station logo: its brand color (for the fog and the ring)
* and where the visible part of the logo sits, so wide wordmarks can be enlarged inside a circle.
*/
@Immutable
data class StationArt(
val accent: Color?,
val left: Float = 0f,
val top: Float = 0f,
val right: Float = 1f,
val bottom: Float = 1f
) {
/** Logos with their own square background are shown edge to edge instead of being shrunk. */
val isFullBleed: Boolean get() = right - left > 0.97f && bottom - top > 0.97f
/** Scale that fits the visible part of the logo into a circle of [fill] of its diameter. */
fun circleScale(fill: Float = 0.86f): Float {
if (isFullBleed) return 1f
val w = right - left
val h = bottom - top
return (fill / sqrt(w * w + h * h)).coerceIn(0.5f, 1.7f)
}
/** Scale that fits the visible part of the logo into [fill] of a square tile. */
fun squareScale(fill: Float = 0.84f): Float {
if (isFullBleed) return 1f
return minOf(fill / (right - left), fill / (bottom - top)).coerceIn(1f, 1.5f)
}
val centerX: Float get() = (left + right) / 2f
val centerY: Float get() = (top + bottom) / 2f
}
private val cache = ConcurrentHashMap<Int, StationArt>()
@Composable
fun rememberStationArt(station: RadioStation): StationArt? {
val resources = LocalContext.current.resources
val art by produceState(initialValue = cache[station.iconResId], station.iconResId) {
value = cache[station.iconResId] ?: withContext(Dispatchers.Default) {
analyzeLogo(resources, station.iconResId).also { cache[station.iconResId] = it }
}
}
return art
}
private fun analyzeLogo(resources: Resources, resId: Int): StationArt {
val options = BitmapFactory.Options().apply { inSampleSize = 4 }
val bitmap = BitmapFactory.decodeResource(resources, resId, options) ?: return StationArt(accent = null)
val w = bitmap.width
val h = bitmap.height
val pixels = IntArray(w * h)
bitmap.getPixels(pixels, 0, w, 0, 0, w, h)
bitmap.recycle()
var minX = w
var minY = h
var maxX = -1
var maxY = -1
// Hue is averaged on the circle, weighted by how vivid each pixel is.
var hueX = 0.0
var hueY = 0.0
var weight = 0.0
var opaque = 0
val hsl = FloatArray(3)
for (y in 0 until h) {
for (x in 0 until w) {
val c = pixels[y * w + x]
val alpha = c ushr 24
if (alpha <= 24) continue
if (x < minX) minX = x
if (x > maxX) maxX = x
if (y < minY) minY = y
if (y > maxY) maxY = y
opaque++
ColorUtils.colorToHSL(c, hsl)
val vivid = hsl[1] * (1f - abs(hsl[2] - 0.5f) * 2f)
if (vivid < 0.25f) continue
val wgt = vivid.toDouble() * (alpha / 255.0)
val rad = Math.toRadians(hsl[0].toDouble())
hueX += cos(rad) * wgt
hueY += sin(rad) * wgt
weight += wgt
}
}
if (maxX < 0) return StationArt(accent = null)
// Mostly black, white or grey logos keep the app's own blue.
val accent = if (opaque > 0 && weight / opaque > 0.08) {
var hue = Math.toDegrees(atan2(hueY, hueX)).toFloat()
if (hue < 0f) hue += 360f
// Same saturation and lightness for every station, so only the hue changes.
Color(ColorUtils.HSLToColor(floatArrayOf(hue, 0.78f, 0.6f)))
} else {
null
}
return StationArt(
accent = accent,
left = minX / w.toFloat(),
top = minY / h.toFloat(),
right = (maxX + 1) / w.toFloat(),
bottom = (maxY + 1) / h.toFloat()
)
}
/** Station color, or the app accent when the logo has none. */
fun StationArt?.accentOr(fallback: Color): Color = this?.accent ?: fallback
@@ -0,0 +1,151 @@
package cc.skysparkle.fogwave.ui.components
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import cc.skysparkle.fogwave.data.model.RadioStation
import cc.skysparkle.fogwave.ui.theme.AppThemeState
import cc.skysparkle.fogwave.ui.theme.LocalGeoColors
import kotlin.math.cos
import kotlin.math.min
import kotlin.math.sin
private const val ARC_SWEEP = 280f
private const val TURN_MILLIS = 14_000
/**
* Round station artwork wrapped in a ring in the station's own color. Live radio has no track
* progress, so the arc slowly circles while the station plays and rests where it was when it stops.
*/
@Composable
fun StationDisc(
station: RadioStation,
isPlaying: Boolean,
modifier: Modifier = Modifier,
ringWidth: Dp = 4.dp,
ringGap: Dp = 10.dp,
glow: Boolean = true
) {
val colors = LocalGeoColors.current
val art = rememberStationArt(station)
val accent by animateColorAsState(
targetValue = art.takeIf { AppThemeState.stationFog }.accentOr(colors.primary),
animationSpec = tween(600),
label = "disc_accent"
)
val rotation = remember { Animatable(0f) }
LaunchedEffect(isPlaying) {
while (isPlaying) {
rotation.snapTo(rotation.value % 360f)
rotation.animateTo(
targetValue = rotation.value + 360f,
animationSpec = tween(TURN_MILLIS, easing = LinearEasing)
)
}
}
Box(modifier = modifier.aspectRatio(1f), contentAlignment = Alignment.Center) {
Canvas(modifier = Modifier.fillMaxSize()) {
val stroke = ringWidth.toPx()
val radius = min(size.width, size.height) / 2f - stroke
val topLeft = Offset(center.x - radius, center.y - radius)
val arcSize = Size(radius * 2, radius * 2)
if (glow) {
drawCircle(
brush = Brush.radialGradient(
colors = listOf(accent.copy(alpha = 0.28f), Color.Transparent),
center = center,
radius = radius * 1.25f
),
radius = radius * 1.25f,
center = center
)
}
drawCircle(
color = colors.outlineVariant,
radius = radius,
center = center,
style = Stroke(width = stroke)
)
val start = -90f + rotation.value
drawArc(
color = accent,
startAngle = start,
sweepAngle = ARC_SWEEP,
useCenter = false,
topLeft = topLeft,
size = arcSize,
style = Stroke(width = stroke, cap = StrokeCap.Round)
)
val end = Math.toRadians((start + ARC_SWEEP).toDouble())
val knob = Offset(
center.x + radius * cos(end).toFloat(),
center.y + radius * sin(end).toFloat()
)
drawCircle(color = accent, radius = stroke * 1.9f, center = knob)
drawCircle(color = Color.White, radius = stroke * 0.8f, center = knob)
}
Box(
modifier = Modifier
.fillMaxSize()
.padding(ringWidth * 2 + ringGap)
.clip(CircleShape)
.background(stationTileColor(station))
.border(1.dp, colors.outlineVariant, CircleShape),
contentAlignment = Alignment.Center
) {
// Wide wordmarks are enlarged and centered so they span the circle instead of
// floating small in the middle; square logos fill it edge to edge.
Image(
painter = painterResource(id = station.iconResId),
contentDescription = null,
contentScale = ContentScale.Fit,
modifier = Modifier
.fillMaxSize()
.graphicsLayer {
val scale = art?.circleScale() ?: 0.78f
scaleX = scale
scaleY = scale
if (art != null) {
translationX = (0.5f - art.centerX) * size.width * scale
translationY = (0.5f - art.centerY) * size.height * scale
}
}
)
}
}
}
@@ -1,462 +0,0 @@
package cc.skysparkle.fogwave.ui.components
import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.spring
import androidx.compose.animation.core.tween
import androidx.compose.foundation.LocalIndication
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsPressedAsState
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shadow
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.testTag
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.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import cc.skysparkle.fogwave.data.model.IconSizeStep
import cc.skysparkle.fogwave.data.model.RadioStation
import cc.skysparkle.fogwave.data.model.ViewMode
import cc.skysparkle.fogwave.ui.theme.LocalGeoColors
import coil.compose.AsyncImage
@Composable
fun LiveOnAirDot(modifier: Modifier = Modifier) {
val infiniteTransition = rememberInfiniteTransition(label = "pulse")
val scale by infiniteTransition.animateFloat(
initialValue = 0.8f,
targetValue = 1.25f,
animationSpec = infiniteRepeatable(
animation = tween(900, easing = FastOutSlowInEasing),
repeatMode = RepeatMode.Reverse
),
label = "live_pulse"
)
Box(
modifier = modifier
.size(7.dp)
.graphicsLayer {
scaleX = scale
scaleY = scale
}
.clip(CircleShape)
.background(LocalGeoColors.current.liveGreen)
)
}
private val GridTextShadow = Shadow(color = Color.Black.copy(alpha = 0.55f), blurRadius = 8f)
@Composable
fun StationItem(
station: RadioStation,
isCurrent: Boolean,
isPlaying: Boolean,
viewMode: ViewMode,
sizeStep: IconSizeStep,
onClick: () -> Unit,
modifier: Modifier = Modifier
) {
val interactionSource = remember { MutableInteractionSource() }
val pressed by interactionSource.collectIsPressedAsState()
val pressScale by animateFloatAsState(
targetValue = if (pressed) 0.96f else 1f,
animationSpec = spring(dampingRatio = 0.6f, stiffness = Spring.StiffnessMediumLow),
label = "station_press"
)
val cardModifier = modifier.graphicsLayer {
scaleX = pressScale
scaleY = pressScale
}
when (viewMode) {
ViewMode.ICONS -> {
StationIconsCard(
station = station,
isCurrent = isCurrent,
isPlaying = isPlaying,
sizeDp = sizeStep.sizeDp.dp,
onClick = onClick,
interactionSource = interactionSource,
modifier = cardModifier
)
}
ViewMode.TILES -> {
StationTilesCard(
station = station,
isCurrent = isCurrent,
isPlaying = isPlaying,
sizeDp = (sizeStep.sizeDp * 0.7f).dp,
onClick = onClick,
interactionSource = interactionSource,
modifier = cardModifier
)
}
ViewMode.LIST -> {
StationListRow(
station = station,
isCurrent = isCurrent,
isPlaying = isPlaying,
sizeDp = (sizeStep.sizeDp * 0.45f).coerceAtLeast(36f).dp,
onClick = onClick,
interactionSource = interactionSource,
modifier = cardModifier
)
}
ViewMode.DETAILS -> {
StationDetailsRow(
station = station,
isCurrent = isCurrent,
isPlaying = isPlaying,
sizeDp = (sizeStep.sizeDp * 0.45f).coerceAtLeast(36f).dp,
onClick = onClick,
interactionSource = interactionSource,
modifier = cardModifier
)
}
}
}
@Composable
private fun StationIconsCard(
station: RadioStation,
isCurrent: Boolean,
isPlaying: Boolean,
sizeDp: Dp,
onClick: () -> Unit,
interactionSource: MutableInteractionSource,
modifier: Modifier = Modifier
) {
Column(
modifier = modifier
.width(sizeDp)
.clip(RoundedCornerShape(20.dp))
.clickable(
interactionSource = interactionSource,
indication = LocalIndication.current,
role = Role.Button,
onClick = onClick
)
.padding(4.dp)
.testTag("station_${station.id}"),
horizontalAlignment = Alignment.Start
) {
Box(
modifier = Modifier
.fillMaxWidth()
.aspectRatio(1f)
.shadow(if (isCurrent) 4.dp else 1.dp, RoundedCornerShape(22.dp))
.clip(RoundedCornerShape(22.dp))
.background(stationTileColor(station))
.border(
width = if (isCurrent) 2.dp else 1.dp,
color = if (isCurrent) LocalGeoColors.current.primary else LocalGeoColors.current.outlineVariant,
shape = RoundedCornerShape(22.dp)
)
) {
AsyncImage(
model = station.iconResId,
contentDescription = null,
contentScale = ContentScale.Crop,
modifier = Modifier.matchParentSize()
)
}
Spacer(modifier = Modifier.height(8.dp))
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(6.dp)
) {
if (isCurrent && isPlaying) {
LiveOnAirDot()
}
Text(
text = station.name,
style = MaterialTheme.typography.titleSmall.copy(
fontWeight = FontWeight.Bold,
fontSize = 14.5.sp,
lineHeight = 17.sp,
color = if (isCurrent) LocalGeoColors.current.deepPurple else LocalGeoColors.current.onSurface,
shadow = GridTextShadow
),
maxLines = 2,
overflow = TextOverflow.Ellipsis
)
}
Text(
text = stationDescription(station),
style = MaterialTheme.typography.bodySmall.copy(
fontSize = 11.5.sp,
color = LocalGeoColors.current.onSurface.copy(alpha = 0.82f),
shadow = GridTextShadow
),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
}
@Composable
private fun StationTilesCard(
station: RadioStation,
isCurrent: Boolean,
isPlaying: Boolean,
sizeDp: Dp,
onClick: () -> Unit,
interactionSource: MutableInteractionSource,
modifier: Modifier = Modifier
) {
Row(
modifier = modifier
.fillMaxWidth()
.clip(RoundedCornerShape(18.dp))
.background(if (isCurrent) LocalGeoColors.current.primaryContainer.copy(alpha = 0.7f) else LocalGeoColors.current.surfaceContainer.copy(alpha = 0.9f))
.border(
width = if (isCurrent) 1.5.dp else 1.dp,
color = if (isCurrent) LocalGeoColors.current.primary else LocalGeoColors.current.outlineVariant,
shape = RoundedCornerShape(18.dp)
)
.clickable(
interactionSource = interactionSource,
indication = LocalIndication.current,
role = Role.Button,
onClick = onClick
)
.padding(10.dp)
.testTag("station_${station.id}"),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp)
) {
Box(
modifier = Modifier
.size(sizeDp)
.clip(RoundedCornerShape(14.dp))
.background(stationTileColor(station))
.border(0.8.dp, LocalGeoColors.current.outlineVariant, RoundedCornerShape(14.dp))
) {
AsyncImage(
model = station.iconResId,
contentDescription = null,
contentScale = ContentScale.Crop,
modifier = Modifier.matchParentSize()
)
}
Column(modifier = Modifier.weight(1f)) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(6.dp)
) {
if (isCurrent && isPlaying) {
LiveOnAirDot()
}
Text(
text = station.name,
style = MaterialTheme.typography.titleSmall.copy(
fontWeight = FontWeight.Bold,
fontSize = 15.sp,
color = if (isCurrent) LocalGeoColors.current.deepPurple else LocalGeoColors.current.onSurface
),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
Text(
text = stationDescription(station),
style = MaterialTheme.typography.bodySmall.copy(
fontSize = 12.sp,
color = LocalGeoColors.current.onSurfaceVariant
),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
}
}
@Composable
private fun StationListRow(
station: RadioStation,
isCurrent: Boolean,
isPlaying: Boolean,
sizeDp: Dp,
onClick: () -> Unit,
interactionSource: MutableInteractionSource,
modifier: Modifier = Modifier
) {
Row(
modifier = modifier
.fillMaxWidth()
.clip(RoundedCornerShape(14.dp))
.background(if (isCurrent) LocalGeoColors.current.primaryContainer.copy(alpha = 0.6f) else Color.Transparent)
.clickable(
interactionSource = interactionSource,
indication = LocalIndication.current,
role = Role.Button,
onClick = onClick
)
.padding(horizontal = 10.dp, vertical = 7.dp)
.testTag("station_${station.id}"),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp)
) {
Box(
modifier = Modifier
.size(sizeDp)
.clip(RoundedCornerShape(10.dp))
.background(stationTileColor(station))
.border(0.8.dp, LocalGeoColors.current.outlineVariant, RoundedCornerShape(10.dp))
) {
AsyncImage(
model = station.iconResId,
contentDescription = null,
contentScale = ContentScale.Crop,
modifier = Modifier.matchParentSize()
)
}
Column(modifier = Modifier.weight(1f)) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(6.dp)
) {
if (isCurrent && isPlaying) {
LiveOnAirDot()
}
Text(
text = station.name,
style = MaterialTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold,
color = if (isCurrent) LocalGeoColors.current.deepPurple else LocalGeoColors.current.onSurface
),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
}
}
}
@Composable
private fun StationDetailsRow(
station: RadioStation,
isCurrent: Boolean,
isPlaying: Boolean,
sizeDp: Dp,
onClick: () -> Unit,
interactionSource: MutableInteractionSource,
modifier: Modifier = Modifier
) {
Row(
modifier = modifier
.fillMaxWidth()
.clip(RoundedCornerShape(14.dp))
.background(if (isCurrent) LocalGeoColors.current.primaryContainer.copy(alpha = 0.6f) else Color.Transparent)
.border(
width = 0.8.dp,
color = if (isCurrent) LocalGeoColors.current.primary else LocalGeoColors.current.outlineVariant.copy(alpha = 0.6f),
shape = RoundedCornerShape(14.dp)
)
.clickable(
interactionSource = interactionSource,
indication = LocalIndication.current,
role = Role.Button,
onClick = onClick
)
.padding(horizontal = 10.dp, vertical = 8.dp)
.testTag("station_${station.id}"),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp)
) {
Box(
modifier = Modifier
.size(sizeDp)
.clip(RoundedCornerShape(10.dp))
.background(stationTileColor(station))
.border(0.8.dp, LocalGeoColors.current.outlineVariant, RoundedCornerShape(10.dp))
) {
AsyncImage(
model = station.iconResId,
contentDescription = null,
contentScale = ContentScale.Crop,
modifier = Modifier.matchParentSize()
)
}
Column(modifier = Modifier.weight(1.3f)) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(6.dp)
) {
if (isCurrent && isPlaying) {
LiveOnAirDot()
}
Text(
text = station.name,
style = MaterialTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold,
color = if (isCurrent) LocalGeoColors.current.deepPurple else LocalGeoColors.current.onSurface
),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
Text(
text = stationDescription(station),
style = MaterialTheme.typography.bodySmall.copy(
fontSize = 11.5.sp,
color = LocalGeoColors.current.onSurfaceVariant
),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
Text(
text = stationGenres(station),
style = MaterialTheme.typography.bodySmall.copy(
fontSize = 11.5.sp,
color = LocalGeoColors.current.primary
),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(0.9f)
)
}
}
@@ -7,7 +7,9 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.core.net.toUri import androidx.core.net.toUri
import cc.skysparkle.fogwave.R
import cc.skysparkle.fogwave.data.model.RadioStation import cc.skysparkle.fogwave.data.model.RadioStation
import java.util.Locale
@Composable @Composable
@ReadOnlyComposable @ReadOnlyComposable
@@ -18,6 +20,20 @@ fun stationDescription(station: RadioStation): String = stringResource(station.d
fun stationGenres(station: RadioStation): String = fun stationGenres(station: RadioStation): String =
station.genres.map { stringResource(it.labelRes) }.joinToString(", ") station.genres.map { stringResource(it.labelRes) }.joinToString(", ")
/** FM frequencies one per line («Vilnius · 100.1 MHz»), or «Online only» for internet stations. */
@Composable
@ReadOnlyComposable
fun stationFrequencies(station: RadioStation): String {
if (station.frequencies.isEmpty()) return stringResource(R.string.info_fm_online_only)
return station.frequencies.map { f ->
// Decimal separator of the current language: 100.1 in English, 100,1 in Lithuanian
stringResource(R.string.info_fm_line, stringResource(f.city.labelRes), String.format(Locale.getDefault(), "%.1f", f.mhz))
}.joinToString("\n")
}
/** Website address without the scheme and «www.», for display: «zipfm.lt». */
fun displayHost(url: String): String = url.substringAfter("://").removePrefix("www.").trimEnd('/')
/** Opens [url] in the user's browser; silently does nothing when no browser is installed. */ /** Opens [url] in the user's browser; silently does nothing when no browser is installed. */
fun Context.openUrl(url: String) { fun Context.openUrl(url: String) {
try { try {
@@ -0,0 +1,237 @@
package cc.skysparkle.fogwave.ui.components
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.RepeatMode
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.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
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.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import cc.skysparkle.fogwave.R
import cc.skysparkle.fogwave.data.model.RadioStation
import cc.skysparkle.fogwave.ui.theme.LocalGeoColors
@Composable
fun LiveOnAirDot(modifier: Modifier = Modifier, size: Dp = 7.dp) {
val infiniteTransition = rememberInfiniteTransition(label = "pulse")
val scale by infiniteTransition.animateFloat(
initialValue = 0.8f,
targetValue = 1.25f,
animationSpec = infiniteRepeatable(
animation = tween(900, easing = FastOutSlowInEasing),
repeatMode = RepeatMode.Reverse
),
label = "live_pulse"
)
Box(
modifier = modifier
.size(size)
.graphicsLayer {
scaleX = scale
scaleY = scale
}
.clip(CircleShape)
.background(LocalGeoColors.current.liveRed)
)
}
/** Small red "● LIVE" label used above station names. */
@Composable
fun LiveLabel(active: Boolean, modifier: Modifier = Modifier) {
Row(
modifier = modifier,
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(5.dp)
) {
if (active) {
LiveOnAirDot(size = 6.dp)
} else {
Box(
modifier = Modifier
.size(6.dp)
.clip(CircleShape)
.background(LocalGeoColors.current.outline)
)
}
Text(
text = stringResource(R.string.live_label),
style = MaterialTheme.typography.labelSmall.copy(
fontWeight = FontWeight.Bold,
fontSize = 10.sp,
letterSpacing = 1.sp,
color = if (active) LocalGeoColors.current.liveRed else LocalGeoColors.current.outline
)
)
}
}
/** Station logo on its tile color with rounded corners. */
@Composable
fun StationThumb(
station: RadioStation,
size: Dp,
modifier: Modifier = Modifier,
cornerRadius: Dp = 12.dp
) {
val art = rememberStationArt(station)
Box(
modifier = modifier
.size(size)
.clip(RoundedCornerShape(cornerRadius))
.background(stationTileColor(station))
) {
Image(
painter = painterResource(id = station.iconResId),
contentDescription = null,
contentScale = ContentScale.Crop,
modifier = Modifier
.matchParentSize()
.graphicsLayer {
if (art != null) {
val scale = art.squareScale()
scaleX = scale
scaleY = scale
translationX = (0.5f - art.centerX) * this.size.width * scale
translationY = (0.5f - art.centerY) * this.size.height * scale
}
}
)
}
}
/** A row of the station list: logo, name, description and a play / live indicator. */
@Composable
fun StationRow(
station: RadioStation,
isCurrent: Boolean,
isPlaying: Boolean,
onClick: () -> Unit,
modifier: Modifier = Modifier,
subtitle: String? = null
) {
val colors = LocalGeoColors.current
val bg by animateColorAsState(
targetValue = if (isCurrent) colors.surfaceContainerHigh else Color.Transparent,
label = "station_row_bg"
)
Row(
modifier = modifier
.fillMaxWidth()
.clip(RoundedCornerShape(16.dp))
.background(bg)
.clickable(role = Role.Button, onClick = onClick)
.padding(horizontal = 10.dp, vertical = 8.dp)
.testTag("station_${station.id}"),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(14.dp)
) {
StationThumb(station = station, size = 48.dp)
Column(modifier = Modifier.weight(1f)) {
Text(
text = station.name,
style = MaterialTheme.typography.bodyLarge.copy(
fontWeight = FontWeight.Bold,
fontSize = 15.sp,
letterSpacing = 0.sp,
color = if (isCurrent) colors.deepPurple else colors.onSurface
),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
Text(
text = subtitle ?: stationDescription(station),
style = MaterialTheme.typography.bodySmall.copy(
fontSize = 12.sp,
color = colors.onSurfaceVariant
),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
Box(
modifier = Modifier.size(36.dp),
contentAlignment = Alignment.Center
) {
if (isCurrent && isPlaying) {
LiveBars(
active = true,
color = colors.primary,
modifier = Modifier.size(width = 22.dp, height = 16.dp)
)
} else {
AppIcon(
resId = R.drawable.ic_play,
contentDescription = stringResource(R.string.play_content_desc),
tint = if (isCurrent) colors.primary else colors.onSurfaceVariant,
size = 18.dp
)
}
}
}
}
/** Section title such as "Stations", with an optional trailing count. */
@Composable
fun SectionHeader(title: String, modifier: Modifier = Modifier, trailing: String? = null) {
Row(
modifier = modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = title,
style = MaterialTheme.typography.titleMedium.copy(
fontWeight = FontWeight.Bold,
fontSize = 17.sp,
letterSpacing = (-0.2).sp,
color = LocalGeoColors.current.onSurface
),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f)
)
if (trailing != null) {
Text(
text = trailing,
style = MaterialTheme.typography.labelMedium.copy(
fontWeight = FontWeight.Medium,
color = LocalGeoColors.current.onSurfaceVariant
)
)
}
}
}
@@ -1,82 +1,179 @@
package cc.skysparkle.fogwave.ui.components package cc.skysparkle.fogwave.ui.components
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.background import androidx.compose.foundation.background
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.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.layout.statusBarsPadding import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
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.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
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.heading import androidx.compose.ui.semantics.heading
import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.style.TextAlign
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.R import cc.skysparkle.fogwave.R
import cc.skysparkle.fogwave.ui.theme.LocalGeoColors import cc.skysparkle.fogwave.ui.theme.LocalGeoColors
/**
* Header with the logo on the left, the app name centered and a search action on the right.
* While searching, the title turns into a search field.
*/
@Composable @Composable
fun TopBrandBar(modifier: Modifier = Modifier) { fun TopBrandBar(
Box( modifier: Modifier = Modifier,
showLogo: Boolean = true,
showSearch: Boolean = false,
isSearchOpen: Boolean = false,
query: String = "",
onQueryChange: (String) -> Unit = {},
onOpenSearch: () -> Unit = {},
onCloseSearch: () -> Unit = {}
) {
val colors = LocalGeoColors.current
Row(
modifier = modifier modifier = modifier
.fillMaxWidth() .fillMaxWidth()
.background(LocalGeoColors.current.surfaceContainer.copy(alpha = 0.92f))
.statusBarsPadding() .statusBarsPadding()
.padding(horizontal = 20.dp, vertical = 12.dp) .padding(start = 20.dp, end = 10.dp, top = 8.dp, bottom = 8.dp)
.height(48.dp)
.testTag("top_brand_bar"),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(10.dp)
) { ) {
Row( if (showLogo) {
verticalAlignment = Alignment.CenterVertically, AppIcon(
horizontalArrangement = Arrangement.spacedBy(14.dp), resId = R.drawable.ic_fogwave_logo,
modifier = Modifier contentDescription = stringResource(R.string.fogwave_logo_content_desc),
.fillMaxWidth() size = 30.dp
.testTag("top_brand_bar") )
) { } else {
Box( // Keeps the title centered where it is on the other tabs
Box(modifier = Modifier.size(30.dp))
}
Box(modifier = Modifier.weight(1f), contentAlignment = Alignment.Center) {
AnimatedContent(
targetState = showSearch && isSearchOpen,
transitionSpec = { fadeIn(tween(180)) togetherWith fadeOut(tween(120)) },
label = "header_search"
) { searching ->
if (searching) {
SearchField(query = query, onQueryChange = onQueryChange)
} else {
Text(
text = stringResource(R.string.app_name),
style = MaterialTheme.typography.titleMedium.copy(
fontWeight = FontWeight.Bold,
fontSize = 17.sp,
letterSpacing = 0.sp,
color = colors.deepPurple
),
modifier = Modifier
.fillMaxWidth()
.semantics { heading() },
textAlign = TextAlign.Center
)
}
}
}
if (showSearch) {
IconButton(
onClick = if (isSearchOpen) onCloseSearch else onOpenSearch,
modifier = Modifier modifier = Modifier
.size(40.dp) .size(40.dp)
.clip(RoundedCornerShape(12.dp)), .testTag("search_toggle")
contentAlignment = Alignment.Center
) { ) {
AppIcon( AppIcon(
resId = R.drawable.ic_fogwave_logo, resId = if (isSearchOpen) R.drawable.ic_close else R.drawable.ic_search,
size = 34.dp contentDescription = stringResource(
) if (isSearchOpen) R.string.close_content_desc else R.string.search_content_desc
}
Column(
verticalArrangement = Arrangement.Center
) {
Text(
text = stringResource(R.string.app_name),
style = MaterialTheme.typography.titleMedium.copy(
fontWeight = FontWeight.SemiBold,
fontSize = 20.sp,
letterSpacing = (-0.4).sp,
color = LocalGeoColors.current.deepPurple
), ),
modifier = Modifier.semantics { heading() } tint = colors.onSurface,
) size = 22.dp
Text(
text = stringResource(R.string.app_subtitle),
style = MaterialTheme.typography.labelSmall.copy(
fontWeight = FontWeight.Medium,
fontSize = 11.5.sp,
color = LocalGeoColors.current.onSurfaceVariant,
letterSpacing = 0.2.sp
)
) )
} }
} else {
Box(modifier = Modifier.size(40.dp))
} }
} }
} }
@Composable
private fun SearchField(query: String, onQueryChange: (String) -> Unit) {
val colors = LocalGeoColors.current
val focusRequester = remember { FocusRequester() }
val keyboard = LocalSoftwareKeyboardController.current
LaunchedEffect(Unit) { focusRequester.requestFocus() }
BasicTextField(
value = query,
onValueChange = onQueryChange,
singleLine = true,
textStyle = MaterialTheme.typography.bodyLarge.copy(color = colors.onSurface, fontSize = 15.sp),
cursorBrush = SolidColor(colors.primary),
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),
keyboardActions = KeyboardActions(onSearch = { keyboard?.hide() }),
modifier = Modifier
.fillMaxWidth()
.focusRequester(focusRequester)
.testTag("search_field"),
decorationBox = { inner ->
Row(
modifier = Modifier
.fillMaxWidth()
.clip(CircleShape)
.background(colors.surfaceContainerHigh)
.padding(horizontal = 14.dp, vertical = 10.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(10.dp)
) {
AppIcon(resId = R.drawable.ic_search, tint = colors.onSurfaceVariant, size = 18.dp)
Box(modifier = Modifier.weight(1f)) {
if (query.isEmpty()) {
Text(
text = stringResource(R.string.search_hint),
style = MaterialTheme.typography.bodyLarge.copy(
color = colors.onSurfaceVariant,
fontSize = 15.sp
),
maxLines = 1
)
}
inner()
}
}
}
)
}
@@ -1,287 +0,0 @@
package cc.skysparkle.fogwave.ui.components
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.FastOutLinearInEasing
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.spring
import androidx.compose.animation.core.tween
import androidx.compose.animation.expandVertically
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.scaleIn
import androidx.compose.animation.scaleOut
import androidx.compose.animation.shrinkVertically
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.selection.selectableGroup
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Slider
import androidx.compose.material3.SliderDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.TransformOrigin
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
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import cc.skysparkle.fogwave.R
import cc.skysparkle.fogwave.data.model.IconSizeStep
import cc.skysparkle.fogwave.data.model.ViewMode
import cc.skysparkle.fogwave.ui.theme.LocalGeoColors
import kotlin.math.roundToInt
@Composable
fun StationsToolbar(
title: String,
isOpen: Boolean,
onToggleOpen: () -> Unit,
viewMode: ViewMode,
onSelectViewMode: (ViewMode) -> Unit,
sizeStep: IconSizeStep,
onSelectSizeStep: (IconSizeStep) -> Unit,
modifier: Modifier = Modifier
) {
Column(
modifier = modifier
.fillMaxWidth()
.padding(horizontal = 20.dp, vertical = 6.dp)
) {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = title,
style = MaterialTheme.typography.titleLarge.copy(
fontWeight = FontWeight.Bold,
fontSize = 22.sp,
letterSpacing = (-0.4).sp,
color = LocalGeoColors.current.deepPurple
),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier
.weight(1f)
.padding(end = 12.dp)
)
Box(
modifier = Modifier
.size(38.dp)
.clip(RoundedCornerShape(12.dp))
.background(if (isOpen) LocalGeoColors.current.primaryContainer else LocalGeoColors.current.surfaceContainer)
.border(1.dp, LocalGeoColors.current.outlineVariant, RoundedCornerShape(12.dp))
.clickable(role = Role.Button) { onToggleOpen() }
.testTag("view_options_trigger"),
contentAlignment = Alignment.Center
) {
AppIcon(
resId = R.drawable.ic_table,
contentDescription = stringResource(R.string.view_mode_content_desc),
tint = if (isOpen) LocalGeoColors.current.deepPurple else LocalGeoColors.current.onSurfaceVariant,
size = 19.dp
)
}
}
AnimatedVisibility(
visible = isOpen,
enter = expandVertically(
animationSpec = spring(dampingRatio = 0.85f, stiffness = Spring.StiffnessMediumLow),
expandFrom = Alignment.Top
) + fadeIn(tween(200)) + scaleIn(
initialScale = 0.96f,
transformOrigin = TransformOrigin(1f, 0f),
animationSpec = spring(dampingRatio = 0.85f, stiffness = Spring.StiffnessMediumLow)
),
exit = shrinkVertically(
animationSpec = tween(180, easing = FastOutLinearInEasing),
shrinkTowards = Alignment.Top
) + fadeOut(tween(140)) + scaleOut(
targetScale = 0.96f,
transformOrigin = TransformOrigin(1f, 0f),
animationSpec = tween(180)
)
) {
Column(
modifier = Modifier
.padding(top = 10.dp)
.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(16.dp),
verticalArrangement = Arrangement.spacedBy(14.dp)
) {
Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {
Text(
text = stringResource(R.string.display_mode_label),
style = MaterialTheme.typography.labelSmall.copy(
fontWeight = FontWeight.Bold,
fontSize = 10.5.sp,
letterSpacing = 0.8.sp,
color = LocalGeoColors.current.primary
)
)
Row(
modifier = Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(12.dp))
.background(LocalGeoColors.current.surface)
.border(0.8.dp, LocalGeoColors.current.outlineVariant, RoundedCornerShape(12.dp))
.padding(3.dp)
.selectableGroup(),
horizontalArrangement = Arrangement.spacedBy(2.dp)
) {
ViewModeSegment(
title = stringResource(R.string.view_mode_list),
icon = R.drawable.ic_list,
isSelected = viewMode == ViewMode.LIST,
onClick = { onSelectViewMode(ViewMode.LIST) },
modifier = Modifier.weight(1f)
)
ViewModeSegment(
title = stringResource(R.string.view_mode_table),
icon = R.drawable.ic_layout_columns,
isSelected = viewMode == ViewMode.DETAILS,
onClick = { onSelectViewMode(ViewMode.DETAILS) },
modifier = Modifier.weight(1f)
)
ViewModeSegment(
title = stringResource(R.string.view_mode_tiles),
icon = R.drawable.ic_layout_rows,
isSelected = viewMode == ViewMode.TILES,
onClick = { onSelectViewMode(ViewMode.TILES) },
modifier = Modifier.weight(1f)
)
ViewModeSegment(
title = stringResource(R.string.view_mode_icons),
icon = R.drawable.ic_grid,
isSelected = viewMode == ViewMode.ICONS,
onClick = { onSelectViewMode(ViewMode.ICONS) },
modifier = Modifier.weight(1f)
)
}
}
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text(
text = stringResource(R.string.size_label),
style = MaterialTheme.typography.labelSmall.copy(
fontWeight = FontWeight.Bold,
fontSize = 10.5.sp,
letterSpacing = 0.8.sp,
color = LocalGeoColors.current.primary
)
)
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(10.dp)
) {
Text(
text = "S",
style = MaterialTheme.typography.labelMedium.copy(
fontWeight = FontWeight.Bold,
color = LocalGeoColors.current.onSurfaceVariant
)
)
val steps = IconSizeStep.entries
val currentIndex = steps.indexOf(sizeStep).toFloat()
val sizeLabel = stringResource(R.string.size_label)
Slider(
value = currentIndex,
onValueChange = { indexFloat ->
val step = steps[indexFloat.roundToInt().coerceIn(0, steps.size - 1)]
// The slider reports every drag frame; only persist real changes.
if (step != sizeStep) onSelectSizeStep(step)
},
valueRange = 0f..(steps.size - 1).toFloat(),
steps = steps.size - 2,
colors = SliderDefaults.colors(
thumbColor = LocalGeoColors.current.primary,
activeTrackColor = LocalGeoColors.current.primary,
inactiveTrackColor = LocalGeoColors.current.outlineVariant
),
modifier = Modifier
.weight(1f)
.semantics { contentDescription = sizeLabel }
)
Text(
text = "XL",
style = MaterialTheme.typography.labelMedium.copy(
fontWeight = FontWeight.Bold,
color = LocalGeoColors.current.onSurfaceVariant
)
)
}
}
}
}
}
}
@Composable
private fun ViewModeSegment(
title: String,
icon: Int,
isSelected: Boolean,
onClick: () -> Unit,
modifier: Modifier = Modifier
) {
val bg by animateColorAsState(
targetValue = if (isSelected) LocalGeoColors.current.primaryContainer else Color.Transparent,
animationSpec = tween(220),
label = "segment_bg"
)
val tint by animateColorAsState(
targetValue = if (isSelected) LocalGeoColors.current.deepPurple else LocalGeoColors.current.onSurfaceVariant,
animationSpec = tween(220),
label = "segment_tint"
)
Box(
modifier = modifier
.height(34.dp)
.clip(RoundedCornerShape(9.dp))
.background(bg)
.selectable(selected = isSelected, role = Role.RadioButton, onClick = onClick),
contentAlignment = Alignment.Center
) {
AppIcon(
resId = icon,
contentDescription = title,
tint = tint,
size = 18.dp
)
}
}
@@ -2,6 +2,7 @@ package cc.skysparkle.fogwave.ui.screens
import androidx.activity.compose.BackHandler import androidx.activity.compose.BackHandler
import androidx.compose.animation.AnimatedContent import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.ExitTransition import androidx.compose.animation.ExitTransition
import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.animation.ExperimentalAnimationApi
@@ -12,51 +13,68 @@ import androidx.compose.animation.core.spring
import androidx.compose.animation.core.tween import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut import androidx.compose.animation.fadeOut
import androidx.compose.animation.scaleIn
import androidx.compose.animation.slideInHorizontally import androidx.compose.animation.slideInHorizontally
import androidx.compose.animation.slideInVertically import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutHorizontally import androidx.compose.animation.slideOutHorizontally
import androidx.compose.animation.slideOutVertically import androidx.compose.animation.slideOutVertically
import androidx.compose.animation.togetherWith import androidx.compose.animation.togetherWith
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
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.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.MaterialTheme
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.remember
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.graphics.Brush
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.onGloballyPositioned import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel import androidx.lifecycle.viewmodel.compose.viewModel
import cc.skysparkle.fogwave.R import cc.skysparkle.fogwave.R
import cc.skysparkle.fogwave.data.model.AppTab import cc.skysparkle.fogwave.data.model.AppTab
import cc.skysparkle.fogwave.data.model.RadioStation
import cc.skysparkle.fogwave.player.PlayerState import cc.skysparkle.fogwave.player.PlayerState
import cc.skysparkle.fogwave.ui.components.AboutPanel import cc.skysparkle.fogwave.ui.components.AboutPanel
import cc.skysparkle.fogwave.ui.components.BatteryOptimizationDialog import cc.skysparkle.fogwave.ui.components.BatteryOptimizationDialog
import cc.skysparkle.fogwave.ui.components.EqualizerSheet import cc.skysparkle.fogwave.ui.components.EqualizerSheet
import cc.skysparkle.fogwave.ui.components.FavoritesPanel import cc.skysparkle.fogwave.ui.components.FavoritesPanel
import cc.skysparkle.fogwave.ui.components.HomeBackdrop
import cc.skysparkle.fogwave.ui.components.MiniPlayer import cc.skysparkle.fogwave.ui.components.MiniPlayer
import cc.skysparkle.fogwave.ui.components.MistyMountainBackground
import cc.skysparkle.fogwave.ui.components.NavigationTabs import cc.skysparkle.fogwave.ui.components.NavigationTabs
import cc.skysparkle.fogwave.ui.components.NowPlayingSheet import cc.skysparkle.fogwave.ui.components.NowPlayingSheet
import cc.skysparkle.fogwave.ui.components.StationCollection import cc.skysparkle.fogwave.ui.components.SectionHeader
import cc.skysparkle.fogwave.ui.components.StationsToolbar import cc.skysparkle.fogwave.ui.components.StationRow
import cc.skysparkle.fogwave.ui.components.TopBrandBar import cc.skysparkle.fogwave.ui.components.TopBrandBar
import cc.skysparkle.fogwave.ui.components.accentOr
import cc.skysparkle.fogwave.ui.components.rememberStationArt
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.viewmodel.RadioViewModel import cc.skysparkle.fogwave.ui.viewmodel.RadioViewModel
@OptIn(ExperimentalAnimationApi::class) @OptIn(ExperimentalAnimationApi::class)
@@ -67,6 +85,9 @@ fun HomeScreen(
val uiState by viewModel.uiState.collectAsStateWithLifecycle() val uiState by viewModel.uiState.collectAsStateWithLifecycle()
val isPlaying = uiState.playerState is PlayerState.Playing val isPlaying = uiState.playerState is PlayerState.Playing
var isSearchOpen by rememberSaveable { mutableStateOf(false) }
var query by rememberSaveable { mutableStateOf("") }
val favoriteStations = remember(uiState.stations, uiState.favorites) { val favoriteStations = remember(uiState.stations, uiState.favorites) {
uiState.stations.filter { it.id in uiState.favorites } uiState.stations.filter { it.id in uiState.favorites }
} }
@@ -77,11 +98,16 @@ fun HomeScreen(
uiState.recents.filter { it.id != uiState.currentStation?.id } uiState.recents.filter { it.id != uiState.currentStation?.id }
} }
val closeSearch = {
isSearchOpen = false
query = ""
}
BackHandler(enabled = uiState.isEqualizerPopOpen) { viewModel.closeEqualizerPop() } BackHandler(enabled = uiState.isEqualizerPopOpen) { viewModel.closeEqualizerPop() }
BackHandler(enabled = uiState.isNowPlayingOpen && !uiState.isEqualizerPopOpen) { viewModel.closeNowPlaying() } BackHandler(enabled = uiState.isNowPlayingOpen && !uiState.isEqualizerPopOpen) { viewModel.closeNowPlaying() }
BackHandler(enabled = uiState.isViewPopOpen && !uiState.isNowPlayingOpen) { viewModel.closeViewPop() } BackHandler(enabled = isSearchOpen && !uiState.isNowPlayingOpen) { closeSearch() }
BackHandler( BackHandler(
enabled = uiState.selectedTab != AppTab.RADIO && !uiState.isNowPlayingOpen && !uiState.isViewPopOpen enabled = uiState.selectedTab != AppTab.RADIO && !uiState.isNowPlayingOpen && !isSearchOpen
) { viewModel.setSelectedTab(AppTab.RADIO) } ) { viewModel.setSelectedTab(AppTab.RADIO) }
val showBatteryOptimizationPrompt by viewModel.showBatteryOptimizationPrompt.collectAsStateWithLifecycle() val showBatteryOptimizationPrompt by viewModel.showBatteryOptimizationPrompt.collectAsStateWithLifecycle()
@@ -89,17 +115,51 @@ fun HomeScreen(
BatteryOptimizationDialog(onDismiss = { viewModel.dismissBatteryOptimizationPrompt() }) BatteryOptimizationDialog(onDismiss = { viewModel.dismissBatteryOptimizationPrompt() })
} }
val radioListState = rememberLazyListState()
val accent by animateColorAsState(
// 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),
label = "home_accent"
)
val density = LocalDensity.current val density = LocalDensity.current
var dockHeight by remember { mutableStateOf(140.dp) } var dockHeight by remember { mutableStateOf(160.dp) }
val scrollBottomPadding = dockHeight + 16.dp val scrollBottomPadding = dockHeight + 16.dp
Box(modifier = Modifier.fillMaxSize()) { Box(
MistyMountainBackground() modifier = Modifier
.fillMaxSize()
.background(LocalGeoColors.current.background)
) {
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
} else if (radioListState.firstVisibleItemIndex > 0) {
0.3f
} else {
1f - radioListState.firstVisibleItemScrollOffset / with(density) { 420.dp.toPx() } * 0.7f
}
}
)
Column( Column(modifier = Modifier.fillMaxSize()) {
modifier = Modifier.fillMaxSize() TopBrandBar(
) { // The About tab already shows the logo in its header card
TopBrandBar() showLogo = uiState.selectedTab != AppTab.ABOUT,
showSearch = uiState.selectedTab == AppTab.RADIO,
isSearchOpen = isSearchOpen,
query = query,
onQueryChange = { query = it },
onOpenSearch = { isSearchOpen = true },
onCloseSearch = closeSearch
)
Box(modifier = Modifier.weight(1f)) { Box(modifier = Modifier.weight(1f)) {
AnimatedContent( AnimatedContent(
@@ -116,73 +176,33 @@ fun HomeScreen(
label = "tabs" label = "tabs"
) { tab -> ) { tab ->
when (tab) { when (tab) {
AppTab.RADIO, AppTab.FAVORITES -> { AppTab.RADIO -> RadioTab(
val isFavorites = tab == AppTab.FAVORITES listState = radioListState,
Column(modifier = Modifier.fillMaxSize()) { stations = uiState.stations,
StationsToolbar( currentStation = uiState.currentStation,
title = stringResource( isPlaying = isPlaying,
if (isFavorites) R.string.favorite_stations_title else R.string.stations_title query = query.trim(),
), onSelectStation = { viewModel.onStationClick(it) },
isOpen = uiState.isViewPopOpen, bottomContentPadding = scrollBottomPadding
onToggleOpen = { viewModel.toggleViewPop() }, )
viewMode = uiState.viewMode,
onSelectViewMode = { viewModel.setViewMode(it) },
sizeStep = uiState.sizeStep,
onSelectSizeStep = { viewModel.setSizeStep(it) }
)
Box(modifier = Modifier.weight(1f)) { AppTab.FAVORITES -> FavoritesPanel(
AnimatedContent( favorites = favoriteStations,
targetState = uiState.viewMode, currentStation = uiState.currentStation,
transitionSpec = { isPlaying = isPlaying,
(fadeIn(tween(220, delayMillis = 60)) + onSelectStation = { viewModel.onStationClick(it) },
scaleIn(initialScale = 0.985f, animationSpec = tween(260))) onBrowseStations = { viewModel.setSelectedTab(AppTab.RADIO) },
.togetherWith(fadeOut(tween(120))) bottomContentPadding = scrollBottomPadding,
}, modifier = Modifier.fillMaxSize()
label = "view_mode" )
) { mode ->
if (isFavorites) {
FavoritesPanel(
favorites = favoriteStations,
currentStation = uiState.currentStation,
isPlaying = isPlaying,
viewMode = mode,
sizeStep = uiState.sizeStep,
onSelectStation = { viewModel.onStationClick(it) },
onBrowseStations = { viewModel.setSelectedTab(AppTab.RADIO) },
bottomContentPadding = scrollBottomPadding,
modifier = Modifier.fillMaxSize()
)
} else {
StationCollection(
stations = uiState.stations,
currentStation = uiState.currentStation,
isPlaying = isPlaying,
viewMode = mode,
sizeStep = uiState.sizeStep,
onSelectStation = { viewModel.onStationClick(it) },
bottomContentPadding = scrollBottomPadding,
modifier = Modifier.fillMaxSize()
)
}
}
PopoverScrim(
visible = uiState.isViewPopOpen,
onDismiss = { viewModel.closeViewPop() }
)
}
}
}
AppTab.ABOUT -> { AppTab.ABOUT -> Column(
Column( modifier = Modifier
modifier = Modifier .fillMaxSize()
.fillMaxSize() .verticalScroll(rememberScrollState())
.verticalScroll(rememberScrollState()) .padding(bottom = scrollBottomPadding)
.padding(bottom = scrollBottomPadding) ) {
) { AboutPanel()
AboutPanel()
}
} }
} }
} }
@@ -200,17 +220,19 @@ fun HomeScreen(
dockHeight = measured dockHeight = measured
} }
} }
// Rows (and the current station's highlight) fade out under the dock
// instead of peeking through the gaps around the mini player and tabs.
.background(
Brush.verticalGradient(
0f to Color.Transparent,
0.22f to LocalGeoColors.current.background.copy(alpha = 0.94f),
1f to LocalGeoColors.current.background
)
)
// Insets live on the dock itself so the tabs stay clear of the gesture bar // Insets live on the dock itself so the tabs stay clear of the gesture bar
// even when the mini player is swiped away. // even when the mini player is swiped away.
.navigationBarsPadding() .navigationBarsPadding()
) { ) {
NavigationTabs(
selectedTab = uiState.selectedTab,
favoritesCount = uiState.unseenFavoritesCount,
onTabSelected = { viewModel.setSelectedTab(it) },
modifier = Modifier.padding(horizontal = 20.dp, vertical = 6.dp)
)
AnimatedVisibility( AnimatedVisibility(
visible = !uiState.isMiniPlayerHidden, visible = !uiState.isMiniPlayerHidden,
enter = fadeIn() + slideInVertically(initialOffsetY = { it }), enter = fadeIn() + slideInVertically(initialOffsetY = { it }),
@@ -219,13 +241,23 @@ fun HomeScreen(
MiniPlayer( MiniPlayer(
station = uiState.currentStation, station = uiState.currentStation,
playerState = uiState.playerState, playerState = uiState.playerState,
trackTitle = uiState.nowPlayingTitle,
onTogglePlay = { viewModel.togglePlay() }, onTogglePlay = { viewModel.togglePlay() },
onPrevious = { viewModel.previousStation() },
onNext = { viewModel.nextStation() }, onNext = { viewModel.nextStation() },
onOpenNowPlaying = { viewModel.openNowPlaying() }, onOpenNowPlaying = { viewModel.openNowPlaying() },
onHide = { viewModel.hideMiniPlayer() } onHide = { viewModel.hideMiniPlayer() }
) )
} }
NavigationTabs(
selectedTab = uiState.selectedTab,
favoritesCount = uiState.unseenFavoritesCount,
onTabSelected = {
closeSearch()
viewModel.setSelectedTab(it)
},
modifier = Modifier.padding(horizontal = 20.dp, vertical = 6.dp)
)
} }
AnimatedVisibility( AnimatedVisibility(
@@ -237,6 +269,7 @@ fun HomeScreen(
NowPlayingSheet( NowPlayingSheet(
station = uiState.currentStation, station = uiState.currentStation,
playerState = uiState.playerState, playerState = uiState.playerState,
trackTitle = uiState.nowPlayingTitle,
isFavorite = isCurFav, isFavorite = isCurFav,
onToggleFavorite = { viewModel.toggleFavorite() }, onToggleFavorite = { viewModel.toggleFavorite() },
onTogglePlay = { viewModel.togglePlay() }, onTogglePlay = { viewModel.togglePlay() },
@@ -284,22 +317,69 @@ fun HomeScreen(
} }
} }
/** Station list, filtered by the search query. */
@Composable @Composable
private fun PopoverScrim(visible: Boolean, onDismiss: () -> Unit) { private fun RadioTab(
AnimatedVisibility( listState: LazyListState,
visible = visible, stations: List<RadioStation>,
enter = fadeIn(tween(200)), currentStation: RadioStation?,
exit = fadeOut(tween(160)) isPlaying: Boolean,
query: String,
onSelectStation: (RadioStation) -> Unit,
bottomContentPadding: Dp
) {
val descriptions = stations.associate { it.id to stationDescription(it) }
val visible = remember(stations, query, descriptions) {
stations.filter { station ->
query.isEmpty() ||
station.name.contains(query, ignoreCase = true) ||
descriptions[station.id].orEmpty().contains(query, ignoreCase = true)
}
}
LazyColumn(
state = listState,
contentPadding = PaddingValues(top = 12.dp, bottom = bottomContentPadding),
modifier = Modifier.fillMaxSize()
) { ) {
Box( item(key = "header") {
modifier = Modifier SectionHeader(
.fillMaxSize() title = stringResource(
.background(Color.Black.copy(alpha = 0.38f)) if (query.isNotEmpty()) R.string.search_results_title else R.string.stations_title
.clickable( ),
interactionSource = remember { MutableInteractionSource() }, trailing = pluralStringResource(R.plurals.station_count, visible.size, visible.size),
indication = null, modifier = Modifier.padding(start = 20.dp, end = 20.dp, bottom = 8.dp)
onClick = onDismiss )
}
if (visible.isEmpty()) {
item(key = "empty") {
Text(
text = stringResource(R.string.search_no_results, query),
style = MaterialTheme.typography.bodyMedium.copy(
color = LocalGeoColors.current.onSurfaceVariant,
textAlign = TextAlign.Center
),
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 32.dp, vertical = 32.dp)
) )
) }
}
items(visible, key = { it.id }) { station ->
val isCur = station.id == currentStation?.id
StationRow(
station = station,
isCurrent = isCur,
isPlaying = isCur && isPlaying,
onClick = { onSelectStation(station) },
modifier = Modifier
.padding(horizontal = 10.dp, vertical = 1.dp)
.animateItem()
)
}
item(key = "spacer") { Spacer(modifier = Modifier.height(8.dp)) }
} }
} }
@@ -0,0 +1,309 @@
package cc.skysparkle.fogwave.ui.screens
import android.content.Context
import android.content.Intent
import android.provider.Settings
import androidx.activity.compose.BackHandler
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
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
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import cc.skysparkle.fogwave.R
import cc.skysparkle.fogwave.data.repository.RadioRepository
import cc.skysparkle.fogwave.ui.components.AppIcon
import cc.skysparkle.fogwave.ui.components.HomeBackdrop
import cc.skysparkle.fogwave.ui.theme.LocalGeoColors
import kotlinx.coroutines.launch
/**
* First-launch guide: shown once to new users, and again from About → «Show the guide».
* People who already used the app before this version (they have favourites, recents or a
* last station) are treated as having seen it.
*/
object Onboarding {
private const val PREFS = "fogwave_prefs"
private const val KEY_DONE = "onboarding_done"
/** Whether the guide is on screen. */
var visible by mutableStateOf(false)
private set
/** Opened by the user from About: the back button closes it from the first page too. */
var replay by mutableStateOf(false)
private set
/** Call before the first frame. */
fun load(context: Context) {
val prefs = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
if (prefs.getBoolean(KEY_DONE, false)) return
val usedBefore = prefs.contains("last_station_id") || prefs.contains("play_counts") ||
prefs.contains("favorites") || prefs.contains("recents")
if (usedBefore) {
prefs.edit().putBoolean(KEY_DONE, true).apply()
} else {
replay = false
visible = true
}
}
fun show() {
replay = true
visible = true
}
fun finish(context: Context) {
context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit().putBoolean(KEY_DONE, true).apply()
visible = false
}
}
private data class GuidePage(
@param:DrawableRes val iconRes: Int,
@param:StringRes val titleRes: Int,
@param:StringRes val textRes: Int,
/** Icon is a full-colour picture (the logo), not a glyph to tint. */
val keepColors: Boolean = false
)
private val PAGES = listOf(
GuidePage(R.drawable.ic_fogwave_logo, R.string.guide_welcome_title, R.string.guide_welcome_text, keepColors = true),
GuidePage(R.drawable.ic_radio, R.string.guide_listen_title, R.string.guide_listen_text),
GuidePage(R.drawable.ic_info, R.string.guide_info_title, R.string.guide_info_text),
GuidePage(R.drawable.ic_play, R.string.guide_background_title, R.string.guide_background_text)
)
@Composable
fun OnboardingScreen(onDone: () -> Unit) {
val colors = LocalGeoColors.current
val scope = rememberCoroutineScope()
val pager = rememberPagerState(pageCount = { PAGES.size })
val last = pager.currentPage == PAGES.lastIndex
// Back goes to the previous page; on the first page it closes a guide opened from About.
BackHandler(enabled = pager.currentPage > 0 || Onboarding.replay) {
if (pager.currentPage > 0) scope.launch { pager.animateScrollToPage(pager.currentPage - 1) } else onDone()
}
Box(
modifier = Modifier
.fillMaxSize()
.background(colors.background)
.testTag("onboarding")
) {
HomeBackdrop(tint = colors.accentLavender)
Column(
modifier = Modifier
.fillMaxSize()
.statusBarsPadding()
.navigationBarsPadding()
) {
// «Skip» on every page but the last
Box(
modifier = Modifier
.fillMaxWidth()
.height(56.dp)
.padding(horizontal = 12.dp),
contentAlignment = Alignment.CenterEnd
) {
if (!last) {
Text(
text = stringResource(R.string.guide_skip),
style = MaterialTheme.typography.labelLarge.copy(
color = colors.onSurfaceVariant,
fontWeight = FontWeight.SemiBold
),
modifier = Modifier
.clip(CircleShape)
.clickable(role = Role.Button, onClick = onDone)
.padding(horizontal = 14.dp, vertical = 10.dp)
.testTag("onboarding_skip")
)
}
}
HorizontalPager(
state = pager,
modifier = Modifier
.weight(1f)
.fillMaxWidth()
) { index ->
GuidePageContent(page = PAGES[index], showBattery = index == PAGES.lastIndex)
}
Dots(count = PAGES.size, current = pager.currentPage)
val accent by animateColorAsState(colors.accentLavender, label = "guide_button")
Box(
modifier = Modifier
.fillMaxWidth()
.padding(start = 24.dp, end = 24.dp, top = 20.dp, bottom = 20.dp),
contentAlignment = Alignment.Center
) {
Text(
text = stringResource(if (last) R.string.guide_start else R.string.guide_next),
style = MaterialTheme.typography.titleMedium.copy(
color = colors.onAccentLavender,
fontWeight = FontWeight.Bold,
textAlign = TextAlign.Center
),
modifier = Modifier
.widthIn(max = 420.dp)
.fillMaxWidth()
.clip(CircleShape)
.background(accent)
.clickable(role = Role.Button) {
if (last) onDone() else scope.launch { pager.animateScrollToPage(pager.currentPage + 1) }
}
.padding(vertical = 16.dp)
.testTag("onboarding_next")
)
}
}
}
}
@Composable
private fun GuidePageContent(page: GuidePage, showBattery: Boolean) {
val colors = LocalGeoColors.current
val context = LocalContext.current
Column(
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())
.padding(horizontal = 32.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Box(
modifier = Modifier
.size(132.dp)
.clip(CircleShape)
.background(colors.surfaceContainer.copy(alpha = 0.85f))
.border(1.dp, colors.outlineVariant, CircleShape),
contentAlignment = Alignment.Center
) {
AppIcon(
resId = page.iconRes,
tint = if (page.keepColors) Color.Unspecified else colors.accentLavender,
size = if (page.keepColors) 88.dp else 56.dp
)
}
Spacer(Modifier.height(36.dp))
Text(
text = stringResource(page.titleRes),
style = MaterialTheme.typography.headlineSmall.copy(
color = colors.onBackground,
fontWeight = FontWeight.Bold,
textAlign = TextAlign.Center
),
modifier = Modifier.widthIn(max = 420.dp)
)
Spacer(Modifier.height(14.dp))
Text(
text = stringResource(page.textRes),
style = MaterialTheme.typography.bodyLarge.copy(
color = colors.onSurfaceVariant,
textAlign = TextAlign.Center,
lineHeight = 24.sp
),
modifier = Modifier.widthIn(max = 420.dp)
)
if (showBattery) {
Spacer(Modifier.height(24.dp))
BatteryButton(context)
}
}
}
/** Opens the battery optimisation list; afterwards the reminder dialog isn't needed any more. */
@Composable
private fun BatteryButton(context: Context) {
val colors = LocalGeoColors.current
Text(
text = stringResource(R.string.guide_battery_button),
style = MaterialTheme.typography.labelLarge.copy(
color = colors.onBackground,
fontWeight = FontWeight.SemiBold
),
modifier = Modifier
.clip(CircleShape)
.border(1.dp, colors.outlineVariant, CircleShape)
.clickable(role = Role.Button) {
RadioRepository(context).markBatteryOptimizationPromptSeen()
try {
context.startActivity(Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS))
} catch (_: Exception) {
}
}
.padding(horizontal = 20.dp, vertical = 12.dp)
.testTag("onboarding_battery")
)
}
@Composable
private fun Dots(count: Int, current: Int) {
val colors = LocalGeoColors.current
val label = stringResource(R.string.guide_page_of, current + 1, count)
Row(
modifier = Modifier
.fillMaxWidth()
.semantics { contentDescription = label },
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically
) {
repeat(count) { i ->
val selected = i == current
val width by animateDpAsState(if (selected) 22.dp else 8.dp, label = "guide_dot")
Box(
modifier = Modifier
.padding(horizontal = 4.dp)
.size(width = width, height = 8.dp)
.clip(CircleShape)
.background(if (selected) colors.accentLavender else colors.outlineVariant)
)
}
}
}
@@ -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)
)
@@ -26,33 +26,34 @@ data class GeoColors(
val accentLavender: Color, val accentLavender: Color,
val onAccentLavender: Color, val onAccentLavender: Color,
val deepPurple: Color, val deepPurple: Color,
val liveGreen: Color, val liveRed: Color,
val redFavorite: Color val redFavorite: Color
) )
// Dark take on the "Rad.io" layout: deep navy surfaces with an electric-blue accent.
val DarkGeoColors = GeoColors( val DarkGeoColors = GeoColors(
background = Color(0xFF141218), background = Color(0xFF0D1016),
onBackground = Color(0xFFE6E0E9), onBackground = Color(0xFFEEF1F7),
surface = Color(0xFF141218), surface = Color(0xFF0D1016),
onSurface = Color(0xFFE6E0E9), onSurface = Color(0xFFEEF1F7),
surfaceContainer = Color(0xFF211F26), surfaceContainer = Color(0xFF161A23),
surfaceContainerHigh = Color(0xFF2B2930), surfaceContainerHigh = Color(0xFF1F2430),
onSurfaceVariant = Color(0xFFCAC4D0), onSurfaceVariant = Color(0xFF98A1B3),
outline = Color(0xFF938F99), outline = Color(0xFF5C6577),
outlineVariant = Color(0xFF49454F), outlineVariant = Color(0xFF272D3A),
primary = Color(0xFFD0BCFF), primary = Color(0xFF7C9DFF),
onPrimary = Color(0xFF381E72), onPrimary = Color(0xFF0B1A47),
primaryContainer = Color(0xFF4F378B), primaryContainer = Color(0xFF1F2D5C),
onPrimaryContainer = Color(0xFFEADDFF), onPrimaryContainer = Color(0xFFDCE4FF),
secondary = Color(0xFFCCC2DC), secondary = Color(0xFFB2C1E6),
onSecondary = Color(0xFF332D41), onSecondary = Color(0xFF18233F),
secondaryContainer = Color(0xFF4A4458), secondaryContainer = Color(0xFF283350),
onSecondaryContainer = Color(0xFFE8DEF8), onSecondaryContainer = Color(0xFFDCE4FF),
accentLavender = Color(0xFF4F378B), accentLavender = Color(0xFF3466F6),
onAccentLavender = Color(0xFFEADDFF), onAccentLavender = Color(0xFFFFFFFF),
deepPurple = Color(0xFFD0BCFF), deepPurple = Color(0xFFF3F6FF),
liveGreen = Color(0xFF81C995), liveRed = Color(0xFFFF4D5E),
redFavorite = Color(0xFFF2B8B5) redFavorite = Color(0xFFFF6B81)
) )
val LocalGeoColors = staticCompositionLocalOf { DarkGeoColors } val LocalGeoColors = staticCompositionLocalOf { DarkGeoColors }
@@ -1,33 +1,36 @@
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, onPrimaryContainer = onPrimaryContainer,
onPrimaryContainer = onPrimaryContainer, secondary = secondary,
secondary = secondary, onSecondary = onSecondary,
onSecondary = onSecondary, secondaryContainer = secondaryContainer,
secondaryContainer = secondaryContainer, onSecondaryContainer = onSecondaryContainer,
onSecondaryContainer = onSecondaryContainer, background = background,
background = background, onBackground = onBackground,
onBackground = onBackground, surface = surface,
surface = surface, onSurface = onSurface,
onSurface = onSurface, surfaceVariant = outlineVariant,
surfaceVariant = outlineVariant, 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)
} }
} }
@@ -8,9 +8,7 @@ import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import cc.skysparkle.fogwave.data.model.AppTab import cc.skysparkle.fogwave.data.model.AppTab
import cc.skysparkle.fogwave.data.model.ExtraPlayerTab import cc.skysparkle.fogwave.data.model.ExtraPlayerTab
import cc.skysparkle.fogwave.data.model.IconSizeStep
import cc.skysparkle.fogwave.data.model.RadioStation import cc.skysparkle.fogwave.data.model.RadioStation
import cc.skysparkle.fogwave.data.model.ViewMode
import cc.skysparkle.fogwave.data.repository.RadioRepository import cc.skysparkle.fogwave.data.repository.RadioRepository
import cc.skysparkle.fogwave.player.AudioEffectsController import cc.skysparkle.fogwave.player.AudioEffectsController
import cc.skysparkle.fogwave.player.AudioEffectsState import cc.skysparkle.fogwave.player.AudioEffectsState
@@ -32,15 +30,13 @@ data class RadioUiState(
val favorites: Set<String> = emptySet(), val favorites: Set<String> = emptySet(),
val recents: List<RadioStation> = emptyList(), val recents: List<RadioStation> = emptyList(),
val selectedTab: AppTab = AppTab.RADIO, val selectedTab: AppTab = AppTab.RADIO,
val viewMode: ViewMode = ViewMode.ICONS,
val sizeStep: IconSizeStep = IconSizeStep.M,
val isNowPlayingOpen: Boolean = false, val isNowPlayingOpen: Boolean = false,
val isEqualizerPopOpen: Boolean = false, val isEqualizerPopOpen: Boolean = false,
val isViewPopOpen: Boolean = false,
val activeExtraTab: ExtraPlayerTab = ExtraPlayerTab.RECENT, val activeExtraTab: ExtraPlayerTab = ExtraPlayerTab.RECENT,
val audioEffects: AudioEffectsState = AudioEffectsState(), val audioEffects: AudioEffectsState = AudioEffectsState(),
val isMiniPlayerHidden: Boolean = false, val isMiniPlayerHidden: Boolean = false,
val unseenFavoritesCount: Int = 0 val unseenFavoritesCount: Int = 0,
val nowPlayingTitle: String? = null
) )
class RadioViewModel(application: Application) : AndroidViewModel(application) { class RadioViewModel(application: Application) : AndroidViewModel(application) {
@@ -60,7 +56,6 @@ class RadioViewModel(application: Application) : AndroidViewModel(application) {
private val _selectedTab = MutableStateFlow(AppTab.RADIO) private val _selectedTab = MutableStateFlow(AppTab.RADIO)
private val _isNowPlayingOpen = MutableStateFlow(false) private val _isNowPlayingOpen = MutableStateFlow(false)
private val _isEqualizerPopOpen = MutableStateFlow(false) private val _isEqualizerPopOpen = MutableStateFlow(false)
private val _isViewPopOpen = MutableStateFlow(false)
private val _activeExtraTab = MutableStateFlow(ExtraPlayerTab.RECENT) private val _activeExtraTab = MutableStateFlow(ExtraPlayerTab.RECENT)
private val _isMiniPlayerHidden = MutableStateFlow(false) private val _isMiniPlayerHidden = MutableStateFlow(false)
@@ -83,16 +78,14 @@ class RadioViewModel(application: Application) : AndroidViewModel(application) {
repository.favoritesFlow, repository.favoritesFlow,
repository.recentsFlow, repository.recentsFlow,
_selectedTab, _selectedTab,
repository.viewModeFlow,
repository.sizeStepFlow,
_isNowPlayingOpen, _isNowPlayingOpen,
_isEqualizerPopOpen, _isEqualizerPopOpen,
_isViewPopOpen,
_activeExtraTab, _activeExtraTab,
AudioEffectsController.state, AudioEffectsController.state,
_isMiniPlayerHidden, _isMiniPlayerHidden,
repository.seenFavoritesFlow, repository.seenFavoritesFlow,
_stations _stations,
playerManager.nowPlayingTitle
) { params -> ) { params ->
val current = params[0] as? RadioStation val current = params[0] as? RadioStation
val pState = params[1] as PlayerState val pState = params[1] as PlayerState
@@ -101,18 +94,16 @@ class RadioViewModel(application: Application) : AndroidViewModel(application) {
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
val recentsIds = params[3] as List<String> val recentsIds = params[3] as List<String>
val tab = params[4] as AppTab val tab = params[4] as AppTab
val mode = params[5] as ViewMode val nowPlaying = params[5] as Boolean
val size = params[6] as IconSizeStep val eqPop = params[6] as Boolean
val nowPlaying = params[7] as Boolean val extraTab = params[7] as ExtraPlayerTab
val eqPop = params[8] as Boolean val effects = params[8] as AudioEffectsState
val viewPop = params[9] as Boolean val miniHidden = params[9] as Boolean
val extraTab = params[10] as ExtraPlayerTab
val effects = params[11] as AudioEffectsState
val miniHidden = params[12] as Boolean
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
val seenFavs = params[13] as Set<String> val seenFavs = params[10] as Set<String>
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
val orderedStations = params[14] as List<RadioStation> val orderedStations = params[11] as List<RadioStation>
val songTitle = params[12] as String?
val byId = orderedStations.associateBy { it.id } val byId = orderedStations.associateBy { it.id }
val recentsList = recentsIds.mapNotNull { byId[it] } val recentsList = recentsIds.mapNotNull { byId[it] }
@@ -124,15 +115,13 @@ class RadioViewModel(application: Application) : AndroidViewModel(application) {
favorites = favs, favorites = favs,
recents = recentsList, recents = recentsList,
selectedTab = tab, selectedTab = tab,
viewMode = mode,
sizeStep = size,
isNowPlayingOpen = nowPlaying, isNowPlayingOpen = nowPlaying,
isEqualizerPopOpen = eqPop, isEqualizerPopOpen = eqPop,
isViewPopOpen = viewPop,
activeExtraTab = extraTab, activeExtraTab = extraTab,
audioEffects = effects, audioEffects = effects,
isMiniPlayerHidden = miniHidden, isMiniPlayerHidden = miniHidden,
unseenFavoritesCount = favs.count { it !in seenFavs } unseenFavoritesCount = favs.count { it !in seenFavs },
nowPlayingTitle = songTitle
) )
}.stateIn( }.stateIn(
scope = viewModelScope, scope = viewModelScope,
@@ -141,8 +130,6 @@ class RadioViewModel(application: Application) : AndroidViewModel(application) {
stations = stations, stations = stations,
currentStation = initialStation, currentStation = initialStation,
favorites = repository.favoritesFlow.value, favorites = repository.favoritesFlow.value,
viewMode = repository.viewModeFlow.value,
sizeStep = repository.sizeStepFlow.value,
audioEffects = AudioEffectsController.state.value, audioEffects = AudioEffectsController.state.value,
unseenFavoritesCount = repository.favoritesFlow.value.count { it !in repository.seenFavoritesFlow.value } unseenFavoritesCount = repository.favoritesFlow.value.count { it !in repository.seenFavoritesFlow.value }
) )
@@ -152,9 +139,12 @@ class RadioViewModel(application: Application) : AndroidViewModel(application) {
viewModelScope.launch { viewModelScope.launch {
playerManager.currentMediaId.collect { id -> playerManager.currentMediaId.collect { id ->
if (id != null && id != _currentStation.value?.id) { if (id != null && id != _currentStation.value?.id) {
// Switched outside the app (notification, headset, Android Auto): count it like a tap.
stations.find { it.id == id }?.let { onAir -> stations.find { it.id == id }?.let { onAir ->
_currentStation.value = onAir _currentStation.value = onAir
repository.setLastStationId(onAir.id) repository.setLastStationId(onAir.id)
repository.pushRecent(onAir.id)
repository.recordStationPlayed(onAir.id)
} }
} }
} }
@@ -263,30 +253,17 @@ class RadioViewModel(application: Application) : AndroidViewModel(application) {
AudioEffectsController.setLoudnessEnabled(enabled) AudioEffectsController.setLoudnessEnabled(enabled)
} }
fun setLoudnessGain(gainMillibel: Float) {
AudioEffectsController.setLoudnessGain(gainMillibel)
}
fun setDynamicsProcessingEnabled(enabled: Boolean) { fun setDynamicsProcessingEnabled(enabled: Boolean) {
AudioEffectsController.setDynamicsProcessingEnabled(enabled) AudioEffectsController.setDynamicsProcessingEnabled(enabled)
} }
fun setSelectedTab(tab: AppTab) { fun setSelectedTab(tab: AppTab) {
_selectedTab.value = tab _selectedTab.value = tab
_isViewPopOpen.value = false
if (tab == AppTab.FAVORITES) { if (tab == AppTab.FAVORITES) {
repository.markFavoritesSeen(repository.favoritesFlow.value) repository.markFavoritesSeen(repository.favoritesFlow.value)
} }
} }
fun setViewMode(mode: ViewMode) {
repository.setViewMode(mode)
}
fun setSizeStep(step: IconSizeStep) {
repository.setSizeStep(step)
}
fun openNowPlaying() { fun openNowPlaying() {
_isNowPlayingOpen.value = true _isNowPlayingOpen.value = true
} }
@@ -304,14 +281,6 @@ class RadioViewModel(application: Application) : AndroidViewModel(application) {
_isEqualizerPopOpen.value = false _isEqualizerPopOpen.value = false
} }
fun toggleViewPop() {
_isViewPopOpen.value = !_isViewPopOpen.value
}
fun closeViewPop() {
_isViewPopOpen.value = false
}
fun setActiveExtraTab(tab: ExtraPlayerTab) { fun setActiveExtraTab(tab: ExtraPlayerTab) {
_activeExtraTab.value = tab _activeExtraTab.value = tab
} }
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: 952 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 678 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 922 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1002 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 998 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 644 B

+12
View File
@@ -0,0 +1,12 @@
<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="#00000000"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:pathData="M6,6L18,18 M18,6L6,18" />
</vector>
+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>
@@ -0,0 +1,13 @@
<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="#00000000"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round"
android:pathData="M6,17a3,3 0,1 0,6 0a3,3 0,1 0,-6 0z M12,17V4L19,6V9L12,7" />
</vector>
+12
View File
@@ -0,0 +1,12 @@
<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="#00000000"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:pathData="M11,4a7,7 0,1 0,0 14a7,7 0,1 0,0 -14z M16.2,16.2L20,20" />
</vector>
+12
View File
@@ -0,0 +1,12 @@
<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="#00000000"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:pathData="M15.5,5a2.5,2.5 0,1 0,5 0a2.5,2.5 0,1 0,-5 0z M3.5,12a2.5,2.5 0,1 0,5 0a2.5,2.5 0,1 0,-5 0z M15.5,19a2.5,2.5 0,1 0,5 0a2.5,2.5 0,1 0,-5 0z M8.2,10.8L15.8,6.2 M8.2,13.2L15.8,17.8" />
</vector>
+63 -11
View File
@@ -1,6 +1,5 @@
<resources> <resources>
<string name="app_name">Fogwave</string> <string name="app_name">Fogwave</string>
<string name="app_subtitle">Internetradio</string>
<string name="about_version">Version %1$s</string> <string name="about_version">Version %1$s</string>
<string name="about_description">Ein schneller, eleganter Internetradio-Player mit klarem Klang und ausgewogenem geometrischem Design.</string> <string name="about_description">Ein schneller, eleganter Internetradio-Player mit klarem Klang und ausgewogenem geometrischem Design.</string>
@@ -9,9 +8,7 @@
<string name="fogwave_logo_content_desc">Fogwave-Logo</string> <string name="fogwave_logo_content_desc">Fogwave-Logo</string>
<string name="player_connecting">Verbindung wird hergestellt…</string> <string name="player_connecting">Verbindung wird hergestellt…</string>
<string name="player_on_air">Auf Sendung</string>
<string name="player_stopped">Gestoppt</string> <string name="player_stopped">Gestoppt</string>
<string name="now_playing_live">Läuft gerade • LIVE</string>
<string name="now_playing_label">LÄUFT GERADE</string> <string name="now_playing_label">LÄUFT GERADE</string>
<string name="close_content_desc">Schließen</string> <string name="close_content_desc">Schließen</string>
<string name="equalizer_content_desc">Equalizer</string> <string name="equalizer_content_desc">Equalizer</string>
@@ -37,22 +34,23 @@
<string name="info_description">Beschreibung</string> <string name="info_description">Beschreibung</string>
<string name="info_genre">Genre</string> <string name="info_genre">Genre</string>
<string name="info_quality">Qualität</string> <string name="info_quality">Qualität</string>
<string name="info_fm">UKW</string>
<string name="info_fm_line">%1$s · %2$s MHz</string>
<string name="info_fm_online_only">Nur online</string>
<string name="info_schedule">Sendungen &amp; Programm</string>
<string name="info_open_website">Website des Senders öffnen</string>
<string name="city_vilnius">Vilnius</string>
<string name="city_kaunas">Kaunas</string>
<string name="city_klaipeda">Klaipėda</string>
<string name="city_riga">Riga</string>
<string name="info_status">Status</string> <string name="info_status">Status</string>
<string name="status_live">Auf Sendung • Livestream</string> <string name="status_live">Auf Sendung • Livestream</string>
<string name="view_mode_content_desc">Anzeigemodus</string>
<string name="display_mode_label">ANZEIGEMODUS</string>
<string name="view_mode_list">Liste</string>
<string name="view_mode_table">Tabelle</string>
<string name="view_mode_tiles">Kacheln</string>
<string name="view_mode_icons">Symbole</string>
<string name="size_label">GRÖSSE</string>
<string name="favorites_empty_title">Noch keine Favoriten</string> <string name="favorites_empty_title">Noch keine Favoriten</string>
<string name="favorites_empty_subtitle">Öffne den Player eines beliebigen Senders und tippe auf das Herz, um ihn zu den Favoriten hinzuzufügen.</string> <string name="favorites_empty_subtitle">Öffne den Player eines beliebigen Senders und tippe auf das Herz, um ihn zu den Favoriten hinzuzufügen.</string>
<string name="stations_title">Sender</string> <string name="stations_title">Sender</string>
<string name="favorite_stations_title">Lieblingssender</string>
<string name="tab_radio">Radio</string> <string name="tab_radio">Radio</string>
<string name="tab_favorites">Favoriten</string> <string name="tab_favorites">Favoriten</string>
@@ -88,6 +86,10 @@
<string name="station_desc_plus">Musik &amp; Hit-Klassiker</string> <string name="station_desc_plus">Musik &amp; Hit-Klassiker</string>
<string name="station_desc_goldfm">Goldene Hits</string> <string name="station_desc_goldfm">Goldene Hits</string>
<string name="station_desc_rc">Radiocentras • Litauen</string> <string name="station_desc_rc">Radiocentras • Litauen</string>
<string name="station_desc_lrt">Litauischer öffentlicher Rundfunk • Nachrichten</string>
<string name="station_desc_ziniu">Wirtschaftsnachrichten &amp; Talk • Litauen</string>
<string name="station_desc_lr1">Öffentliche Nachrichten &amp; Talk • Lettland</string>
<string name="station_desc_lr2">Lettische Musik • Lettland</string>
<string name="genre_hits">Hits</string> <string name="genre_hits">Hits</string>
<string name="genre_pop">Pop</string> <string name="genre_pop">Pop</string>
<string name="genre_dance">Dance</string> <string name="genre_dance">Dance</string>
@@ -95,6 +97,8 @@
<string name="genre_rock">Rock</string> <string name="genre_rock">Rock</string>
<string name="genre_easy_listening">Easy Listening</string> <string name="genre_easy_listening">Easy Listening</string>
<string name="genre_lithuanian">Litauische Musik</string> <string name="genre_lithuanian">Litauische Musik</string>
<string name="genre_news_talk">Nachrichten &amp; Talk</string>
<string name="genre_latvian">Lettische Musik</string>
<string name="eq_preset_normal">Normal</string> <string name="eq_preset_normal">Normal</string>
<string name="eq_preset_classical">Klassik</string> <string name="eq_preset_classical">Klassik</string>
@@ -106,4 +110,52 @@
<string name="eq_preset_jazz">Jazz</string> <string name="eq_preset_jazz">Jazz</string>
<string name="eq_preset_pop">Pop</string> <string name="eq_preset_pop">Pop</string>
<string name="eq_preset_rock">Rock</string> <string name="eq_preset_rock">Rock</string>
<string name="live_label">LIVE</string>
<string name="search_content_desc">Suchen</string>
<string name="search_hint">Sender suchen</string>
<string name="search_results_title">Suchergebnisse</string>
<string name="search_no_results">Keine Sender passend zu „%1$s“</string>
<plurals name="station_count">
<item quantity="one">%d Sender</item>
<item quantity="other">%d Sender</item>
</plurals>
<string name="share_content_desc">Teilen</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="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>
<!-- 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>
<string name="support_title">Fogwave unterstützen</string>
<string name="support_text">Fogwave ist kostenlos, quelloffen und werbefrei. Wenn dir die App gefällt, hilft eine kleine Spende, das Projekt weiterzuführen.</string>
<string name="support_button">Auf Ko-fi spenden</string>
<!-- first-launch guide -->
<string name="guide_skip">Überspringen</string>
<string name="guide_next">Weiter</string>
<string name="guide_start">Jetzt hören</string>
<string name="guide_page_of">Seite %1$d von %2$d</string>
<string name="guide_welcome_title">Willkommen bei Fogwave</string>
<string name="guide_welcome_text">Litauisches und lettisches Radio an einem Ort. Kostenlos, quelloffen, ohne Werbung und ohne Tracking.</string>
<string name="guide_listen_title">Sender antippen und hören</string>
<string name="guide_listen_text">Der Player öffnet sich im Vollbild. Wische ihn nach unten, um beim Stöbern weiterzuhören. Mit dem Herz landet ein Sender in den Favoriten, mit der Suche findest du ihn schnell.</string>
<string name="guide_info_title">Lerne die Sender kennen</string>
<string name="guide_info_text">Der Info-Tab im Player zeigt UKW-Frequenzen und einen Link zu Sendungen und Programm des Senders. Der Equalizer passt den Klang an Kopfhörer oder Auto an.</string>
<string name="guide_background_title">Die Musik läuft weiter</string>
<string name="guide_background_text">Steuere das Radio über die Benachrichtigung, deine Kopfhörer oder Android Auto. Bricht es bei ausgeschaltetem Bildschirm ab, erlaube Fogwave, ohne Akku-Einschränkungen zu laufen.</string>
<string name="guide_battery_button">Akku-Einstellungen</string>
<string name="guide_show">Anleitung anzeigen</string>
<string name="guide_show_subtitle">Ein kurzer Rundgang durch die App</string>
</resources> </resources>
+62 -11
View File
@@ -1,6 +1,5 @@
<resources> <resources>
<string name="app_name">Fogwave</string> <string name="app_name">Fogwave</string>
<string name="app_subtitle">インターネットラジオ</string>
<string name="about_version">バージョン %1$s</string> <string name="about_version">バージョン %1$s</string>
<string name="about_description">クリアなサウンドと調和のとれた幾何学的デザインを備えた、高速でエレガントなインターネットラジオプレーヤー。</string> <string name="about_description">クリアなサウンドと調和のとれた幾何学的デザインを備えた、高速でエレガントなインターネットラジオプレーヤー。</string>
@@ -9,9 +8,7 @@
<string name="fogwave_logo_content_desc">Fogwave ロゴ</string> <string name="fogwave_logo_content_desc">Fogwave ロゴ</string>
<string name="player_connecting">接続中…</string> <string name="player_connecting">接続中…</string>
<string name="player_on_air">オンエア中</string>
<string name="player_stopped">停止中</string> <string name="player_stopped">停止中</string>
<string name="now_playing_live">再生中 • ライブ</string>
<string name="now_playing_label">再生中</string> <string name="now_playing_label">再生中</string>
<string name="close_content_desc">閉じる</string> <string name="close_content_desc">閉じる</string>
<string name="equalizer_content_desc">イコライザー</string> <string name="equalizer_content_desc">イコライザー</string>
@@ -37,22 +34,23 @@
<string name="info_description">説明</string> <string name="info_description">説明</string>
<string name="info_genre">ジャンル</string> <string name="info_genre">ジャンル</string>
<string name="info_quality">音質</string> <string name="info_quality">音質</string>
<string name="info_fm">FM</string>
<string name="info_fm_line">%1$s · %2$s MHz</string>
<string name="info_fm_online_only">オンラインのみ</string>
<string name="info_schedule">番組と放送スケジュール</string>
<string name="info_open_website">局のウェブサイトを開く</string>
<string name="city_vilnius">ヴィリニュス</string>
<string name="city_kaunas">カウナス</string>
<string name="city_klaipeda">クライペダ</string>
<string name="city_riga">リガ</string>
<string name="info_status">状態</string> <string name="info_status">状態</string>
<string name="status_live">オンエア中 • ライブストリーム</string> <string name="status_live">オンエア中 • ライブストリーム</string>
<string name="view_mode_content_desc">表示モード</string>
<string name="display_mode_label">表示モード</string>
<string name="view_mode_list">リスト</string>
<string name="view_mode_table">テーブル</string>
<string name="view_mode_tiles">タイル</string>
<string name="view_mode_icons">アイコン</string>
<string name="size_label">サイズ</string>
<string name="favorites_empty_title">お気に入りはまだありません</string> <string name="favorites_empty_title">お気に入りはまだありません</string>
<string name="favorites_empty_subtitle">好きな局のプレーヤーを開き、ハートをタップしてお気に入りに追加してください。</string> <string name="favorites_empty_subtitle">好きな局のプレーヤーを開き、ハートをタップしてお気に入りに追加してください。</string>
<string name="stations_title">ラジオ局</string> <string name="stations_title">ラジオ局</string>
<string name="favorite_stations_title">お気に入りの局</string>
<string name="tab_radio">ラジオ</string> <string name="tab_radio">ラジオ</string>
<string name="tab_favorites">お気に入り</string> <string name="tab_favorites">お気に入り</string>
@@ -88,6 +86,10 @@
<string name="station_desc_plus">音楽と往年のヒット曲</string> <string name="station_desc_plus">音楽と往年のヒット曲</string>
<string name="station_desc_goldfm">ゴールデンヒット</string> <string name="station_desc_goldfm">ゴールデンヒット</string>
<string name="station_desc_rc">Radiocentras • リトアニア</string> <string name="station_desc_rc">Radiocentras • リトアニア</string>
<string name="station_desc_lrt">リトアニア公共放送 • ニュース</string>
<string name="station_desc_ziniu">ビジネスニュース・トーク • リトアニア</string>
<string name="station_desc_lr1">公共ニュース・トーク • ラトビア</string>
<string name="station_desc_lr2">ラトビア音楽 • ラトビア</string>
<string name="genre_hits">ヒット曲</string> <string name="genre_hits">ヒット曲</string>
<string name="genre_pop">ポップ</string> <string name="genre_pop">ポップ</string>
<string name="genre_dance">ダンス</string> <string name="genre_dance">ダンス</string>
@@ -95,6 +97,8 @@
<string name="genre_rock">ロック</string> <string name="genre_rock">ロック</string>
<string name="genre_easy_listening">イージーリスニング</string> <string name="genre_easy_listening">イージーリスニング</string>
<string name="genre_lithuanian">リトアニア音楽</string> <string name="genre_lithuanian">リトアニア音楽</string>
<string name="genre_news_talk">ニュース・トーク</string>
<string name="genre_latvian">ラトビア音楽</string>
<string name="eq_preset_normal">ノーマル</string> <string name="eq_preset_normal">ノーマル</string>
<string name="eq_preset_classical">クラシック</string> <string name="eq_preset_classical">クラシック</string>
@@ -106,4 +110,51 @@
<string name="eq_preset_jazz">ジャズ</string> <string name="eq_preset_jazz">ジャズ</string>
<string name="eq_preset_pop">ポップ</string> <string name="eq_preset_pop">ポップ</string>
<string name="eq_preset_rock">ロック</string> <string name="eq_preset_rock">ロック</string>
<string name="live_label">ライブ</string>
<string name="search_content_desc">検索</string>
<string name="search_hint">局を検索</string>
<string name="search_results_title">検索結果</string>
<string name="search_no_results">「%1$s」に一致する局はありません</string>
<plurals name="station_count">
<item quantity="other">%d 局</item>
</plurals>
<string name="share_content_desc">共有</string>
<string name="share_text">Fogwaveで%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>
<!-- 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>
<string name="support_title">Fogwave を応援する</string>
<string name="support_text">Fogwave は無料・オープンソースで、広告もありません。気に入っていただけたら、少額の寄付がプロジェクトの継続を支えます。</string>
<string name="support_button">Ko-fi で寄付する</string>
<!-- first-launch guide -->
<string name="guide_skip">スキップ</string>
<string name="guide_next">次へ</string>
<string name="guide_start">聴きはじめる</string>
<string name="guide_page_of">%2$dページ中%1$dページ</string>
<string name="guide_welcome_title">Fogwaveへようこそ</string>
<string name="guide_welcome_text">リトアニアとラトビアのラジオをひとつのアプリで。無料・オープンソースで、広告もトラッキングもありません。</string>
<string name="guide_listen_title">局をタップして聴く</string>
<string name="guide_listen_text">プレーヤーが全画面で開きます。下にスワイプすると、聴きながら他の局を探せます。ハートでお気に入りに保存、検索ですばやく見つけられます。</string>
<string name="guide_info_title">各局のことを知る</string>
<string name="guide_info_text">プレーヤーの「情報」タブにはFM周波数と、番組・放送スケジュールへのリンクがあります。イコライザーでヘッドホンや車に合わせて音を調整できます。</string>
<string name="guide_background_title">音楽を止めない</string>
<string name="guide_background_text">通知、ヘッドホン、Android Autoから操作できます。画面オフで止まる場合は、Fogwaveをバッテリーの制限なしで動作させてください。</string>
<string name="guide_battery_button">バッテリー設定</string>
<string name="guide_show">ガイドを表示</string>
<string name="guide_show_subtitle">アプリのかんたんな紹介</string>
</resources> </resources>
+65 -11
View File
@@ -1,6 +1,5 @@
<resources> <resources>
<string name="app_name">Fogwave</string> <string name="app_name">Fogwave</string>
<string name="app_subtitle">Interneto radijas</string>
<string name="about_version">Versija %1$s</string> <string name="about_version">Versija %1$s</string>
<string name="about_description">Greitas ir elegantiškas interneto radijo grotuvas su švariu garsu ir darniu geometriniu dizainu.</string> <string name="about_description">Greitas ir elegantiškas interneto radijo grotuvas su švariu garsu ir darniu geometriniu dizainu.</string>
@@ -9,9 +8,7 @@
<string name="fogwave_logo_content_desc">Fogwave logotipas</string> <string name="fogwave_logo_content_desc">Fogwave logotipas</string>
<string name="player_connecting">Jungiamasi…</string> <string name="player_connecting">Jungiamasi…</string>
<string name="player_on_air">Eteryje</string>
<string name="player_stopped">Sustabdyta</string> <string name="player_stopped">Sustabdyta</string>
<string name="now_playing_live">Dabar skamba • tiesiogiai</string>
<string name="now_playing_label">DABAR SKAMBA</string> <string name="now_playing_label">DABAR SKAMBA</string>
<string name="close_content_desc">Uždaryti</string> <string name="close_content_desc">Uždaryti</string>
<string name="equalizer_content_desc">Ekvalaizeris</string> <string name="equalizer_content_desc">Ekvalaizeris</string>
@@ -37,22 +34,23 @@
<string name="info_description">Aprašymas</string> <string name="info_description">Aprašymas</string>
<string name="info_genre">Žanras</string> <string name="info_genre">Žanras</string>
<string name="info_quality">Kokybė</string> <string name="info_quality">Kokybė</string>
<string name="info_fm">FM</string>
<string name="info_fm_line">%1$s · %2$s MHz</string>
<string name="info_fm_online_only">Tik internetu</string>
<string name="info_schedule">Laidos ir programa</string>
<string name="info_open_website">Atidaryti stoties svetainę</string>
<string name="city_vilnius">Vilnius</string>
<string name="city_kaunas">Kaunas</string>
<string name="city_klaipeda">Klaipėda</string>
<string name="city_riga">Ryga</string>
<string name="info_status">Būsena</string> <string name="info_status">Būsena</string>
<string name="status_live">Eteryje • tiesioginė transliacija</string> <string name="status_live">Eteryje • tiesioginė transliacija</string>
<string name="view_mode_content_desc">Rodymo būdas</string>
<string name="display_mode_label">RODYMO BŪDAS</string>
<string name="view_mode_list">Sąrašas</string>
<string name="view_mode_table">Lentelė</string>
<string name="view_mode_tiles">Plytelės</string>
<string name="view_mode_icons">Piktogramos</string>
<string name="size_label">DYDIS</string>
<string name="favorites_empty_title">Mėgstamų kol kas nėra</string> <string name="favorites_empty_title">Mėgstamų kol kas nėra</string>
<string name="favorites_empty_subtitle">Atverkite bet kurios stoties grotuvą ir bakstelėkite širdelę, kad pridėtumėte ją prie mėgstamų.</string> <string name="favorites_empty_subtitle">Atverkite bet kurios stoties grotuvą ir bakstelėkite širdelę, kad pridėtumėte ją prie mėgstamų.</string>
<string name="stations_title">Stotys</string> <string name="stations_title">Stotys</string>
<string name="favorite_stations_title">Mėgstamos stotys</string>
<string name="tab_radio">Radijas</string> <string name="tab_radio">Radijas</string>
<string name="tab_favorites">Mėgstami</string> <string name="tab_favorites">Mėgstami</string>
@@ -88,6 +86,10 @@
<string name="station_desc_plus">Muzika ir klasikiniai hitai</string> <string name="station_desc_plus">Muzika ir klasikiniai hitai</string>
<string name="station_desc_goldfm">Auksiniai hitai</string> <string name="station_desc_goldfm">Auksiniai hitai</string>
<string name="station_desc_rc">Radiocentras • Lietuva</string> <string name="station_desc_rc">Radiocentras • Lietuva</string>
<string name="station_desc_lrt">Lietuvos visuomeninis radijas • Žinios</string>
<string name="station_desc_ziniu">Verslo žinios ir pokalbiai • Lietuva</string>
<string name="station_desc_lr1">Visuomeninės žinios ir pokalbiai • Latvija</string>
<string name="station_desc_lr2">Latviška muzika • Latvija</string>
<string name="genre_hits">Hitai</string> <string name="genre_hits">Hitai</string>
<string name="genre_pop">Pop</string> <string name="genre_pop">Pop</string>
<string name="genre_dance">Šokių</string> <string name="genre_dance">Šokių</string>
@@ -95,6 +97,8 @@
<string name="genre_rock">Rokas</string> <string name="genre_rock">Rokas</string>
<string name="genre_easy_listening">Lengvoji muzika</string> <string name="genre_easy_listening">Lengvoji muzika</string>
<string name="genre_lithuanian">Lietuviška muzika</string> <string name="genre_lithuanian">Lietuviška muzika</string>
<string name="genre_news_talk">Žinios ir pokalbiai</string>
<string name="genre_latvian">Latviška muzika</string>
<string name="eq_preset_normal">Įprastas</string> <string name="eq_preset_normal">Įprastas</string>
<string name="eq_preset_classical">Klasika</string> <string name="eq_preset_classical">Klasika</string>
@@ -106,4 +110,54 @@
<string name="eq_preset_jazz">Džiazas</string> <string name="eq_preset_jazz">Džiazas</string>
<string name="eq_preset_pop">Pop</string> <string name="eq_preset_pop">Pop</string>
<string name="eq_preset_rock">Rokas</string> <string name="eq_preset_rock">Rokas</string>
<string name="live_label">TIESIOGIAI</string>
<string name="search_content_desc">Ieškoti</string>
<string name="search_hint">Ieškoti stočių</string>
<string name="search_results_title">Paieškos rezultatai</string>
<string name="search_no_results">Nėra stočių pagal „%1$s“</string>
<plurals name="station_count">
<item quantity="one">%d stotis</item>
<item quantity="few">%d stotys</item>
<item quantity="many">%d stoties</item>
<item quantity="other">%d stočių</item>
</plurals>
<string name="share_content_desc">Bendrinti</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="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>
<!-- 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>
<string name="support_title">Paremti Fogwave</string>
<string name="support_text">Fogwave nemokama, atvirojo kodo ir be reklamų. Jei programėlė patinka, nedidelė auka padeda projektui gyvuoti.</string>
<string name="support_button">Paaukoti per Ko-fi</string>
<!-- first-launch guide -->
<string name="guide_skip">Praleisti</string>
<string name="guide_next">Toliau</string>
<string name="guide_start">Pradėti klausytis</string>
<string name="guide_page_of">%1$d puslapis iš %2$d</string>
<string name="guide_welcome_title">Sveiki atvykę į Fogwave</string>
<string name="guide_welcome_text">Lietuvos ir Latvijos radijas vienoje vietoje. Nemokama, atvirojo kodo, be reklamų ir sekimo.</string>
<string name="guide_listen_title">Palieskite stotį ir klausykitės</string>
<string name="guide_listen_text">Grotuvas atsidaro per visą ekraną. Perbraukite jį žemyn, kad klausytumėtės toliau naršydami. Palieskite širdelę, kad išsaugotumėte stotį mėgstamose, arba ieškokite paieškoje.</string>
<string name="guide_info_title">Susipažinkite su stotimis</string>
<string name="guide_info_text">Grotuvo skiltyje „Info“ rasite FM dažnius ir nuorodą į stoties laidas ir programą. Ekvalaizeris pritaiko garsą ausinėms ar automobiliui.</string>
<string name="guide_background_title">Muzika neužgęsta</string>
<string name="guide_background_text">Radiją valdykite iš pranešimo, ausinėmis arba per Android Auto. Jei jis nutyla išjungus ekraną, leiskite Fogwave veikti be baterijos apribojimų.</string>
<string name="guide_battery_button">Baterijos nustatymai</string>
<string name="guide_show">Rodyti gidą</string>
<string name="guide_show_subtitle">Trumpa programėlės apžvalga</string>
</resources> </resources>
+65 -11
View File
@@ -1,6 +1,5 @@
<resources> <resources>
<string name="app_name">Fogwave</string> <string name="app_name">Fogwave</string>
<string name="app_subtitle">Интернет-радио</string>
<string name="about_version">Версия %1$s</string> <string name="about_version">Версия %1$s</string>
<string name="about_description">Быстрый и элегантный плеер интернет-радио с чистым звуком и гармоничным геометрическим дизайном.</string> <string name="about_description">Быстрый и элегантный плеер интернет-радио с чистым звуком и гармоничным геометрическим дизайном.</string>
@@ -9,9 +8,7 @@
<string name="fogwave_logo_content_desc">Логотип Fogwave</string> <string name="fogwave_logo_content_desc">Логотип Fogwave</string>
<string name="player_connecting">Подключение…</string> <string name="player_connecting">Подключение…</string>
<string name="player_on_air">В эфире</string>
<string name="player_stopped">Остановлено</string> <string name="player_stopped">Остановлено</string>
<string name="now_playing_live">Сейчас играет • прямой эфир</string>
<string name="now_playing_label">СЕЙЧАС ИГРАЕТ</string> <string name="now_playing_label">СЕЙЧАС ИГРАЕТ</string>
<string name="close_content_desc">Закрыть</string> <string name="close_content_desc">Закрыть</string>
<string name="equalizer_content_desc">Эквалайзер</string> <string name="equalizer_content_desc">Эквалайзер</string>
@@ -37,22 +34,23 @@
<string name="info_description">Описание</string> <string name="info_description">Описание</string>
<string name="info_genre">Жанр</string> <string name="info_genre">Жанр</string>
<string name="info_quality">Качество</string> <string name="info_quality">Качество</string>
<string name="info_fm">FM</string>
<string name="info_fm_line">%1$s · %2$s МГц</string>
<string name="info_fm_online_only">Только онлайн</string>
<string name="info_schedule">Передачи и расписание</string>
<string name="info_open_website">Открыть сайт станции</string>
<string name="city_vilnius">Вильнюс</string>
<string name="city_kaunas">Каунас</string>
<string name="city_klaipeda">Клайпеда</string>
<string name="city_riga">Рига</string>
<string name="info_status">Статус</string> <string name="info_status">Статус</string>
<string name="status_live">В эфире • прямая трансляция</string> <string name="status_live">В эфире • прямая трансляция</string>
<string name="view_mode_content_desc">Вид отображения</string>
<string name="display_mode_label">РЕЖИМ ОТОБРАЖЕНИЯ</string>
<string name="view_mode_list">Список</string>
<string name="view_mode_table">Таблица</string>
<string name="view_mode_tiles">Плитки</string>
<string name="view_mode_icons">Значки</string>
<string name="size_label">РАЗМЕР</string>
<string name="favorites_empty_title">В любимых пока ничего нет</string> <string name="favorites_empty_title">В любимых пока ничего нет</string>
<string name="favorites_empty_subtitle">Откройте плеер любой станции и нажмите на сердечко, чтобы добавить её в список любимых.</string> <string name="favorites_empty_subtitle">Откройте плеер любой станции и нажмите на сердечко, чтобы добавить её в список любимых.</string>
<string name="stations_title">Станции</string> <string name="stations_title">Станции</string>
<string name="favorite_stations_title">Любимые станции</string>
<string name="tab_radio">Радио</string> <string name="tab_radio">Радио</string>
<string name="tab_favorites">Любимые</string> <string name="tab_favorites">Любимые</string>
@@ -88,6 +86,10 @@
<string name="station_desc_plus">Музыка и хиты прошлых лет</string> <string name="station_desc_plus">Музыка и хиты прошлых лет</string>
<string name="station_desc_goldfm">Золотые хиты</string> <string name="station_desc_goldfm">Золотые хиты</string>
<string name="station_desc_rc">Radiocentras • Литва</string> <string name="station_desc_rc">Radiocentras • Литва</string>
<string name="station_desc_lrt">Общественное радио Литвы • Новости</string>
<string name="station_desc_ziniu">Деловые новости и ток-шоу • Литва</string>
<string name="station_desc_lr1">Общественные новости и ток-шоу • Латвия</string>
<string name="station_desc_lr2">Латышская музыка • Латвия</string>
<string name="genre_hits">Хиты</string> <string name="genre_hits">Хиты</string>
<string name="genre_pop">Поп</string> <string name="genre_pop">Поп</string>
<string name="genre_dance">Танцевальная</string> <string name="genre_dance">Танцевальная</string>
@@ -95,6 +97,8 @@
<string name="genre_rock">Рок</string> <string name="genre_rock">Рок</string>
<string name="genre_easy_listening">Лёгкая музыка</string> <string name="genre_easy_listening">Лёгкая музыка</string>
<string name="genre_lithuanian">Литовская музыка</string> <string name="genre_lithuanian">Литовская музыка</string>
<string name="genre_news_talk">Новости и разговорное</string>
<string name="genre_latvian">Латышская музыка</string>
<string name="eq_preset_normal">Обычный</string> <string name="eq_preset_normal">Обычный</string>
<string name="eq_preset_classical">Классика</string> <string name="eq_preset_classical">Классика</string>
@@ -106,4 +110,54 @@
<string name="eq_preset_jazz">Джаз</string> <string name="eq_preset_jazz">Джаз</string>
<string name="eq_preset_pop">Поп</string> <string name="eq_preset_pop">Поп</string>
<string name="eq_preset_rock">Рок</string> <string name="eq_preset_rock">Рок</string>
<string name="live_label">В ЭФИРЕ</string>
<string name="search_content_desc">Поиск</string>
<string name="search_hint">Поиск станций</string>
<string name="search_results_title">Результаты поиска</string>
<string name="search_no_results">Нет станций по запросу «%1$s»</string>
<plurals name="station_count">
<item quantity="one">%d станция</item>
<item quantity="few">%d станции</item>
<item quantity="many">%d станций</item>
<item quantity="other">%d станции</item>
</plurals>
<string name="share_content_desc">Поделиться</string>
<string name="share_text">Слушаю %1$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>
<!-- 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>
<string name="support_title">Поддержать Fogwave</string>
<string name="support_text">Fogwave бесплатное, с открытым кодом и без рекламы. Если приложение нравится, небольшое пожертвование помогает проекту развиваться.</string>
<string name="support_button">Пожертвовать через Ko-fi</string>
<!-- first-launch guide -->
<string name="guide_skip">Пропустить</string>
<string name="guide_next">Далее</string>
<string name="guide_start">Начать слушать</string>
<string name="guide_page_of">Страница %1$d из %2$d</string>
<string name="guide_welcome_title">Добро пожаловать в Fogwave</string>
<string name="guide_welcome_text">Литовское и латвийское радио в одном месте. Бесплатно, с открытым кодом, без рекламы и слежки.</string>
<string name="guide_listen_title">Нажмите на станцию, чтобы слушать</string>
<string name="guide_listen_text">Плеер откроется на весь экран. Смахните его вниз, чтобы слушать дальше и листать станции. Сердечко сохраняет станцию в избранное, а поиск помогает быстро найти нужную.</string>
<string name="guide_info_title">Узнайте больше о станциях</string>
<string name="guide_info_text">Во вкладке «Инфо» в плеере есть FM-частоты и ссылка на передачи и расписание станции. Эквалайзер подстроит звук под наушники или машину.</string>
<string name="guide_background_title">Музыка не прерывается</string>
<string name="guide_background_text">Управляйте радио из уведомления, наушниками или через Android Auto. Если оно замолкает при выключенном экране, разрешите Fogwave работать без ограничений батареи.</string>
<string name="guide_battery_button">Настройки батареи</string>
<string name="guide_show">Показать гид</string>
<string name="guide_show_subtitle">Короткий обзор приложения</string>
</resources> </resources>
+62 -11
View File
@@ -1,6 +1,5 @@
<resources> <resources>
<string name="app_name">Fogwave</string> <string name="app_name">Fogwave</string>
<string name="app_subtitle">网络电台</string>
<string name="about_version">版本 %1$s</string> <string name="about_version">版本 %1$s</string>
<string name="about_description">音质清晰、几何设计和谐统一的快速优雅网络电台播放器。</string> <string name="about_description">音质清晰、几何设计和谐统一的快速优雅网络电台播放器。</string>
@@ -9,9 +8,7 @@
<string name="fogwave_logo_content_desc">Fogwave 标志</string> <string name="fogwave_logo_content_desc">Fogwave 标志</string>
<string name="player_connecting">正在连接…</string> <string name="player_connecting">正在连接…</string>
<string name="player_on_air">正在直播</string>
<string name="player_stopped">已停止</string> <string name="player_stopped">已停止</string>
<string name="now_playing_live">正在播放 • 直播</string>
<string name="now_playing_label">正在播放</string> <string name="now_playing_label">正在播放</string>
<string name="close_content_desc">关闭</string> <string name="close_content_desc">关闭</string>
<string name="equalizer_content_desc">均衡器</string> <string name="equalizer_content_desc">均衡器</string>
@@ -37,22 +34,23 @@
<string name="info_description">简介</string> <string name="info_description">简介</string>
<string name="info_genre">类型</string> <string name="info_genre">类型</string>
<string name="info_quality">音质</string> <string name="info_quality">音质</string>
<string name="info_fm">FM</string>
<string name="info_fm_line">%1$s · %2$s MHz</string>
<string name="info_fm_online_only">仅限在线</string>
<string name="info_schedule">节目与时间表</string>
<string name="info_open_website">打开电台网站</string>
<string name="city_vilnius">维尔纽斯</string>
<string name="city_kaunas">考纳斯</string>
<string name="city_klaipeda">克莱佩达</string>
<string name="city_riga">里加</string>
<string name="info_status">状态</string> <string name="info_status">状态</string>
<string name="status_live">正在直播 • 实时音频流</string> <string name="status_live">正在直播 • 实时音频流</string>
<string name="view_mode_content_desc">显示模式</string>
<string name="display_mode_label">显示模式</string>
<string name="view_mode_list">列表</string>
<string name="view_mode_table">表格</string>
<string name="view_mode_tiles">磁贴</string>
<string name="view_mode_icons">图标</string>
<string name="size_label">大小</string>
<string name="favorites_empty_title">收藏夹还是空的</string> <string name="favorites_empty_title">收藏夹还是空的</string>
<string name="favorites_empty_subtitle">打开任意电台的播放器,点击心形图标即可将其加入收藏。</string> <string name="favorites_empty_subtitle">打开任意电台的播放器,点击心形图标即可将其加入收藏。</string>
<string name="stations_title">电台</string> <string name="stations_title">电台</string>
<string name="favorite_stations_title">收藏的电台</string>
<string name="tab_radio">电台</string> <string name="tab_radio">电台</string>
<string name="tab_favorites">收藏</string> <string name="tab_favorites">收藏</string>
@@ -88,6 +86,10 @@
<string name="station_desc_plus">音乐与经典金曲</string> <string name="station_desc_plus">音乐与经典金曲</string>
<string name="station_desc_goldfm">黄金金曲</string> <string name="station_desc_goldfm">黄金金曲</string>
<string name="station_desc_rc">Radiocentras • 立陶宛</string> <string name="station_desc_rc">Radiocentras • 立陶宛</string>
<string name="station_desc_lrt">立陶宛公共广播 • 新闻</string>
<string name="station_desc_ziniu">商业新闻与谈话 • 立陶宛</string>
<string name="station_desc_lr1">公共新闻与谈话 • 拉脱维亚</string>
<string name="station_desc_lr2">拉脱维亚音乐 • 拉脱维亚</string>
<string name="genre_hits">热门</string> <string name="genre_hits">热门</string>
<string name="genre_pop">流行</string> <string name="genre_pop">流行</string>
<string name="genre_dance">舞曲</string> <string name="genre_dance">舞曲</string>
@@ -95,6 +97,8 @@
<string name="genre_rock">摇滚</string> <string name="genre_rock">摇滚</string>
<string name="genre_easy_listening">轻音乐</string> <string name="genre_easy_listening">轻音乐</string>
<string name="genre_lithuanian">立陶宛音乐</string> <string name="genre_lithuanian">立陶宛音乐</string>
<string name="genre_news_talk">新闻与谈话</string>
<string name="genre_latvian">拉脱维亚音乐</string>
<string name="eq_preset_normal">正常</string> <string name="eq_preset_normal">正常</string>
<string name="eq_preset_classical">古典</string> <string name="eq_preset_classical">古典</string>
@@ -106,4 +110,51 @@
<string name="eq_preset_jazz">爵士</string> <string name="eq_preset_jazz">爵士</string>
<string name="eq_preset_pop">流行</string> <string name="eq_preset_pop">流行</string>
<string name="eq_preset_rock">摇滚</string> <string name="eq_preset_rock">摇滚</string>
<string name="live_label">直播</string>
<string name="search_content_desc">搜索</string>
<string name="search_hint">搜索电台</string>
<string name="search_results_title">搜索结果</string>
<string name="search_no_results">没有与“%1$s”匹配的电台</string>
<plurals name="station_count">
<item quantity="other">%d 个电台</item>
</plurals>
<string name="share_content_desc">分享</string>
<string name="share_text">我正在用 Fogwave 收听 %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>
<!-- 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>
<string name="support_title">支持 Fogwave</string>
<string name="support_text">Fogwave 免费、开源且无广告。如果你喜欢它,一笔小小的捐助能帮助项目持续下去。</string>
<string name="support_button">通过 Ko-fi 捐助</string>
<!-- first-launch guide -->
<string name="guide_skip">跳过</string>
<string name="guide_next">下一步</string>
<string name="guide_start">开始收听</string>
<string name="guide_page_of">第 %1$d 页,共 %2$d 页</string>
<string name="guide_welcome_title">欢迎使用 Fogwave</string>
<string name="guide_welcome_text">立陶宛和拉脱维亚电台尽在一处。免费、开源、无广告、无追踪。</string>
<string name="guide_listen_title">点按电台即可收听</string>
<string name="guide_listen_text">播放器会全屏打开。向下滑动即可一边收听一边浏览。点按爱心把电台加入收藏,或用搜索快速找到电台。</string>
<string name="guide_info_title">了解每个电台</string>
<string name="guide_info_text">播放器的“信息”标签页显示FM频率以及电台节目与时间表的链接。均衡器可按耳机或汽车调整音效。</string>
<string name="guide_background_title">音乐不停歇</string>
<string name="guide_background_text">可通过通知、耳机或 Android Auto 控制电台。如果熄屏后停止播放,请允许 Fogwave 不受电池限制地运行。</string>
<string name="guide_battery_button">电池设置</string>
<string name="guide_show">显示使用指南</string>
<string name="guide_show_subtitle">快速了解本应用</string>
</resources> </resources>
+1 -1
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="fogwave_background">#FF141218</color> <color name="fogwave_background">#FF0D1016</color>
</resources> </resources>
+64 -11
View File
@@ -1,6 +1,5 @@
<resources> <resources>
<string name="app_name">Fogwave</string> <string name="app_name">Fogwave</string>
<string name="app_subtitle">Internet Radio</string>
<string name="about_version">Version %1$s</string> <string name="about_version">Version %1$s</string>
<string name="about_description">A fast, elegant internet radio player with clean sound and a balanced geometric design.</string> <string name="about_description">A fast, elegant internet radio player with clean sound and a balanced geometric design.</string>
@@ -9,9 +8,7 @@
<string name="fogwave_logo_content_desc">Fogwave logo</string> <string name="fogwave_logo_content_desc">Fogwave logo</string>
<string name="player_connecting">Connecting…</string> <string name="player_connecting">Connecting…</string>
<string name="player_on_air">On air</string>
<string name="player_stopped">Stopped</string> <string name="player_stopped">Stopped</string>
<string name="now_playing_live">Now playing • LIVE</string>
<string name="now_playing_label">NOW PLAYING</string> <string name="now_playing_label">NOW PLAYING</string>
<string name="close_content_desc">Close</string> <string name="close_content_desc">Close</string>
<string name="equalizer_content_desc">Equalizer</string> <string name="equalizer_content_desc">Equalizer</string>
@@ -41,22 +38,23 @@
<string name="info_description">Description</string> <string name="info_description">Description</string>
<string name="info_genre">Genre</string> <string name="info_genre">Genre</string>
<string name="info_quality">Quality</string> <string name="info_quality">Quality</string>
<string name="info_fm">FM</string>
<string name="info_fm_line">%1$s · %2$s MHz</string>
<string name="info_fm_online_only">Online only</string>
<string name="info_schedule">Shows &amp; schedule</string>
<string name="info_open_website">Open the station\'s website</string>
<string name="city_vilnius">Vilnius</string>
<string name="city_kaunas">Kaunas</string>
<string name="city_klaipeda">Klaipėda</string>
<string name="city_riga">Riga</string>
<string name="info_status">Status</string> <string name="info_status">Status</string>
<string name="status_live">On air • Live Stream</string> <string name="status_live">On air • Live Stream</string>
<string name="view_mode_content_desc">Display mode</string>
<string name="display_mode_label">DISPLAY MODE</string>
<string name="view_mode_list">List</string>
<string name="view_mode_table">Table</string>
<string name="view_mode_tiles">Tiles</string>
<string name="view_mode_icons">Icons</string>
<string name="size_label">SIZE</string>
<string name="favorites_empty_title">Nothing in favorites yet</string> <string name="favorites_empty_title">Nothing in favorites yet</string>
<string name="favorites_empty_subtitle">Open any station\'s player and tap the heart to add it to favorites.</string> <string name="favorites_empty_subtitle">Open any station\'s player and tap the heart to add it to favorites.</string>
<string name="stations_title">Stations</string> <string name="stations_title">Stations</string>
<string name="favorite_stations_title">Favorite Stations</string>
<string name="tab_radio">Radio</string> <string name="tab_radio">Radio</string>
<string name="tab_favorites">Favorites</string> <string name="tab_favorites">Favorites</string>
@@ -88,6 +86,10 @@
<string name="station_desc_plus">Music &amp; classic hits</string> <string name="station_desc_plus">Music &amp; classic hits</string>
<string name="station_desc_goldfm">Golden hits</string> <string name="station_desc_goldfm">Golden hits</string>
<string name="station_desc_rc">Radiocentras • Lithuania</string> <string name="station_desc_rc">Radiocentras • Lithuania</string>
<string name="station_desc_lrt">Lithuanian public radio • News</string>
<string name="station_desc_ziniu">Business news &amp; talk • Lithuania</string>
<string name="station_desc_lr1">Public news &amp; talk • Latvia</string>
<string name="station_desc_lr2">Latvian music • Latvia</string>
<string name="genre_hits">Hits</string> <string name="genre_hits">Hits</string>
<string name="genre_pop">Pop</string> <string name="genre_pop">Pop</string>
<string name="genre_dance">Dance</string> <string name="genre_dance">Dance</string>
@@ -95,6 +97,8 @@
<string name="genre_rock">Rock</string> <string name="genre_rock">Rock</string>
<string name="genre_easy_listening">Easy listening</string> <string name="genre_easy_listening">Easy listening</string>
<string name="genre_lithuanian">Lithuanian music</string> <string name="genre_lithuanian">Lithuanian music</string>
<string name="genre_news_talk">News &amp; talk</string>
<string name="genre_latvian">Latvian music</string>
<string name="eq_preset_normal">Normal</string> <string name="eq_preset_normal">Normal</string>
<string name="eq_preset_classical">Classical</string> <string name="eq_preset_classical">Classical</string>
@@ -106,4 +110,53 @@
<string name="eq_preset_jazz">Jazz</string> <string name="eq_preset_jazz">Jazz</string>
<string name="eq_preset_pop">Pop</string> <string name="eq_preset_pop">Pop</string>
<string name="eq_preset_rock">Rock</string> <string name="eq_preset_rock">Rock</string>
<string name="live_label">LIVE</string>
<string name="search_content_desc">Search</string>
<string name="search_hint">Search stations</string>
<string name="search_results_title">Search results</string>
<string name="search_no_results">No stations match “%1$s”</string>
<plurals name="station_count">
<item quantity="one">%d station</item>
<item quantity="other">%d stations</item>
</plurals>
<string name="share_content_desc">Share</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="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>
<!-- 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>
<string name="support_title">Support Fogwave</string>
<string name="support_text">Fogwave is free, open source and has no ads. If you enjoy it, a small donation helps keep the project going.</string>
<string name="support_button">Donate on Ko-fi</string>
<!-- first-launch guide -->
<string name="guide_skip">Skip</string>
<string name="guide_next">Next</string>
<string name="guide_start">Start listening</string>
<string name="guide_page_of">Page %1$d of %2$d</string>
<string name="guide_welcome_title">Welcome to Fogwave</string>
<string name="guide_welcome_text">Lithuanian and Latvian radio in one place. Free, open source, with no ads and no tracking.</string>
<string name="guide_listen_title">Tap a station to listen</string>
<string name="guide_listen_text">The player opens full screen. Swipe it down to keep listening while you browse. Tap the heart to save a station to Favorites, or use search to find one fast.</string>
<string name="guide_info_title">Get to know each station</string>
<string name="guide_info_text">The Info tab in the player shows FM frequencies and a link to the station\'s shows and schedule. The equalizer tunes the sound for your headphones or car.</string>
<string name="guide_background_title">Keep the music playing</string>
<string name="guide_background_text">Control the radio from the notification, your headphones or Android Auto. If it stops when the screen is off, let Fogwave run without battery restrictions.</string>
<string name="guide_battery_button">Battery settings</string>
<string name="guide_show">Show the guide</string>
<string name="guide_show_subtitle">A quick tour of the app</string>
</resources> </resources>
-4
View File
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
</full-backup-content>
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<data-extraction-rules>
<cloud-backup>
</cloud-backup>
</data-extraction-rules>
@@ -3,10 +3,8 @@ package cc.skysparkle.fogwave
import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onRoot import androidx.compose.ui.test.onRoot
import cc.skysparkle.fogwave.data.model.Genre import cc.skysparkle.fogwave.data.model.Genre
import cc.skysparkle.fogwave.data.model.IconSizeStep
import cc.skysparkle.fogwave.data.model.RadioStation import cc.skysparkle.fogwave.data.model.RadioStation
import cc.skysparkle.fogwave.data.model.ViewMode import cc.skysparkle.fogwave.ui.components.StationRow
import cc.skysparkle.fogwave.ui.components.StationItem
import cc.skysparkle.fogwave.ui.theme.FogwaveTheme import cc.skysparkle.fogwave.ui.theme.FogwaveTheme
import com.github.takahirom.roborazzi.RobolectricDeviceQualifiers import com.github.takahirom.roborazzi.RobolectricDeviceQualifiers
import com.github.takahirom.roborazzi.captureRoboImage import com.github.takahirom.roborazzi.captureRoboImage
@@ -20,7 +18,7 @@ import org.robolectric.annotation.GraphicsMode
@RunWith(RobolectricTestRunner::class) @RunWith(RobolectricTestRunner::class)
@GraphicsMode(GraphicsMode.Mode.NATIVE) @GraphicsMode(GraphicsMode.Mode.NATIVE)
@Config(qualifiers = RobolectricDeviceQualifiers.Pixel8, sdk = [36]) @Config(qualifiers = RobolectricDeviceQualifiers.Pixel8, sdk = [36])
class StationItemScreenshotTest { class StationRowScreenshotTest {
@get:Rule val composeTestRule = createComposeRule() @get:Rule val composeTestRule = createComposeRule()
private val station = RadioStation( private val station = RadioStation(
@@ -34,20 +32,18 @@ class StationItemScreenshotTest {
) )
@Test @Test
fun stationItem_list_screenshot() { fun stationRow_screenshot() {
composeTestRule.setContent { composeTestRule.setContent {
FogwaveTheme { FogwaveTheme {
StationItem( StationRow(
station = station, station = station,
isCurrent = true, isCurrent = true,
isPlaying = false, isPlaying = false,
viewMode = ViewMode.LIST,
sizeStep = IconSizeStep.M,
onClick = {} onClick = {}
) )
} }
} }
composeTestRule.onRoot().captureRoboImage(filePath = "src/test/screenshots/station_item.png") composeTestRule.onRoot().captureRoboImage(filePath = "src/test/screenshots/station_row.png")
} }
} }
@@ -0,0 +1,79 @@
package cc.skysparkle.fogwave.data
import android.content.Context
import androidx.core.content.edit
import androidx.test.core.app.ApplicationProvider
import cc.skysparkle.fogwave.data.repository.RadioRepository
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [36])
class RadioRepositoryTest {
private val context: Context = ApplicationProvider.getApplicationContext()
@Before
fun clearPrefs() {
context.getSharedPreferences("fogwave_prefs", Context.MODE_PRIVATE).edit { clear() }
}
@Test
fun favoritesToggleAndSurviveARestart() {
val repository = RadioRepository(context)
assertTrue(repository.toggleFavorite("zip"))
assertTrue(repository.toggleFavorite("lrt"))
assertFalse(repository.toggleFavorite("zip"))
assertEquals(setOf("lrt"), RadioRepository(context).favoritesFlow.value)
}
@Test
fun unknownStationsAreDroppedFromSavedFavorites() {
context.getSharedPreferences("fogwave_prefs", Context.MODE_PRIVATE)
.edit { putStringSet("favorites", setOf("zip", "removed_station")) }
assertEquals(setOf("zip"), RadioRepository(context).favoritesFlow.value)
}
@Test
fun recentsPutTheLatestFirstWithoutDuplicatesAndKeepTen() {
val repository = RadioRepository(context)
val ids = repository.stations.map { it.id }
ids.forEach { repository.pushRecent(it) }
repository.pushRecent(ids[3])
val recents = RadioRepository(context).recentsFlow.value
assertEquals(10, recents.size)
assertEquals(ids[3], recents.first())
assertEquals(recents.size, recents.toSet().size)
}
@Test
fun mostPlayedStationsComeFirst() {
val repository = RadioRepository(context)
repeat(3) { repository.recordStationPlayed("lr2") }
repository.recordStationPlayed("rc")
val sorted = RadioRepository(context).stationsSortedByPopularity()
assertEquals(listOf("lr2", "rc"), sorted.take(2).map { it.id })
assertEquals(repository.stations.size, sorted.size)
}
@Test
fun everyStationHasAWebsiteAndValidFmFrequencies() {
RadioRepository(context).stations.forEach { station ->
assertTrue("${station.id} website", station.website?.startsWith("https://") == true)
station.frequencies.forEach { f ->
assertTrue("${station.id} ${f.mhz}", f.mhz in 87.5..108.0)
}
assertEquals("${station.id} cities", station.frequencies.size, station.frequencies.map { it.city }.toSet().size)
}
}
}
@@ -0,0 +1,119 @@
package cc.skysparkle.fogwave.player
import android.net.Uri
import android.os.Looper
import androidx.annotation.OptIn
import androidx.media3.common.PlaybackException
import androidx.media3.common.Player
import androidx.media3.common.SimpleBasePlayer
import androidx.media3.common.util.UnstableApi
import androidx.media3.datasource.DataSpec
import androidx.media3.datasource.HttpDataSource
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
@OptIn(UnstableApi::class)
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [36])
class PlaybackPolicyTest {
private fun httpError(code: Int) = PlaybackException(
"HTTP $code",
HttpDataSource.InvalidResponseCodeException(
code, null, null, emptyMap(), DataSpec(Uri.parse("https://example.com/stream")), ByteArray(0)
),
PlaybackException.ERROR_CODE_IO_BAD_HTTP_STATUS
)
private fun error(code: Int) = PlaybackException("error", null, code)
@Test
fun clientErrorsGetOnlyAFewAttempts() {
assertEquals(MAX_PERMANENT_ERROR_RETRY_ATTEMPTS, maxRetryAttemptsFor(httpError(404)))
assertEquals(MAX_PERMANENT_ERROR_RETRY_ATTEMPTS, maxRetryAttemptsFor(httpError(403)))
}
@Test
fun timeoutsRateLimitsAndServerErrorsGetTheFullBackoff() {
assertEquals(MAX_RETRY_ATTEMPTS, maxRetryAttemptsFor(httpError(408)))
assertEquals(MAX_RETRY_ATTEMPTS, maxRetryAttemptsFor(httpError(429)))
assertEquals(MAX_RETRY_ATTEMPTS, maxRetryAttemptsFor(httpError(503)))
}
@Test
fun unsupportedStreamsArePermanentAndNetworkErrorsAreNot() {
assertEquals(
MAX_PERMANENT_ERROR_RETRY_ATTEMPTS,
maxRetryAttemptsFor(error(PlaybackException.ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED))
)
assertEquals(
MAX_PERMANENT_ERROR_RETRY_ATTEMPTS,
maxRetryAttemptsFor(error(PlaybackException.ERROR_CODE_IO_CLEARTEXT_NOT_PERMITTED))
)
assertEquals(
MAX_RETRY_ATTEMPTS,
maxRetryAttemptsFor(error(PlaybackException.ERROR_CODE_IO_NETWORK_CONNECTION_FAILED))
)
assertEquals(
MAX_RETRY_ATTEMPTS,
maxRetryAttemptsFor(error(PlaybackException.ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT))
)
}
/** A player that only reports the given state. */
private class FakePlayer(private val fixed: State) : SimpleBasePlayer(Looper.getMainLooper()) {
override fun getState(): State = fixed
}
private fun player(
playbackState: Int,
playWhenReady: Boolean,
hasItem: Boolean = true,
error: PlaybackException? = null
): Player = FakePlayer(
SimpleBasePlayer.State.Builder()
.setAvailableCommands(Player.Commands.Builder().addAllCommands().build())
.setPlaylist(if (hasItem) listOf(SimpleBasePlayer.MediaItemData.Builder("station").build()) else emptyList())
.setPlaybackState(playbackState)
.setPlayWhenReady(playWhenReady, Player.PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST)
.setPlayerError(error)
.build()
)
private fun derive(p: Player) = deriveState(p) { "failed" }
@Test
fun readyMapsToPlayingOrPaused() {
assertEquals(PlayerState.Playing, derive(player(Player.STATE_READY, playWhenReady = true)))
assertEquals(PlayerState.Paused, derive(player(Player.STATE_READY, playWhenReady = false)))
}
@Test
fun bufferingAndADroppedStreamShowConnectingWhilePlayRequested() {
assertEquals(PlayerState.Connecting, derive(player(Player.STATE_BUFFERING, playWhenReady = true)))
assertEquals(PlayerState.Connecting, derive(player(Player.STATE_ENDED, playWhenReady = true)))
assertEquals(PlayerState.Paused, derive(player(Player.STATE_BUFFERING, playWhenReady = false)))
}
@Test
fun idleDependsOnWhetherAStationIsLoaded() {
assertEquals(PlayerState.Idle, derive(player(Player.STATE_IDLE, playWhenReady = false, hasItem = false)))
assertEquals(PlayerState.Connecting, derive(player(Player.STATE_IDLE, playWhenReady = true)))
assertEquals(PlayerState.Paused, derive(player(Player.STATE_IDLE, playWhenReady = false)))
}
@Test
fun anErrorWinsOverThePlaybackState() {
val state = derive(
player(
Player.STATE_IDLE,
playWhenReady = true,
error = error(PlaybackException.ERROR_CODE_IO_NETWORK_CONNECTION_FAILED)
)
)
assertEquals(PlayerState.Error("failed"), state)
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 784 KiB

After

Width:  |  Height:  |  Size: 639 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1020 KiB

After

Width:  |  Height:  |  Size: 794 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 989 KiB

After

Width:  |  Height:  |  Size: 658 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 658 KiB

After

Width:  |  Height:  |  Size: 709 KiB

@@ -2,5 +2,5 @@
• Weniger Aussetzer bei schwachem Netz • Weniger Aussetzer bei schwachem Netz
• Flüssigere Equalizer-Regler und schnellerer App-Start • Flüssigere Equalizer-Regler und schnellerer App-Start
• Nicht erreichbare Streams werden nicht mehr minutenlang neu versucht • Nicht erreichbare Streams werden nicht mehr minutenlang neu versucht
• Neue Sender: LRT Radijas, Žinių radijas, Latvijas Radio 1 und 2
Neue Versionen gibt es auch auf Gitea: https://git.skysparkle.cc/kalarina/Fogwave/releases • Ansichtsoptionen nur noch im Tab „Radio“
@@ -0,0 +1,4 @@
• Neues Design mit Suche und schwebendem Mini-Player
• Player mit rundem Sender-Cover und dem Titel des laufenden Songs
• Ziehender Nebel in der Farbe des laufenden Senders
• Teile den Sender oder Song, den du gerade hörst
@@ -0,0 +1,6 @@
• Farbstile, auch Material You; Nebel in Senderfarbe ist jetzt optional
• Weiter/Zurück funktioniert in der Benachrichtigung, am Kopfhörer und in Android Auto
• Sprachbefehle über Assistant und Android Auto stoppen den Player nicht mehr
• Die Wiedergabe läuft von selbst weiter, wenn das Netz zurück ist
• Der Lautstärke-Booster macht jetzt wirklich lauter
• Kleinere App, weniger Akkuverbrauch
@@ -0,0 +1,4 @@
• Info-Tab: UKW-Frequenzen in Vilnius, Kaunas, Klaipėda und Riga sowie ein Link zur Website des Senders mit Sendungen und Programm
• Unterstützungskarte mit Ko-fi-Button auf dem Info-Bildschirm
• Links zum Quellcode führen jetzt zu GitHub
• Eine kurze Anleitung beim ersten Start; erneut aufrufbar unter „Info“
@@ -1,12 +1,12 @@
<p>Nimm Litauens beliebteste Radiosender mit – ganz ohne Ballast. Mit Fogwave schaltest du einfach ein, hörst im Hintergrund und genießt ein aufgeräumtes, werbefreies Erlebnis ohne Konto und ohne Tracking.</p> <p>Nimm Litauens beliebteste Radiosender mit – ganz ohne Ballast. Mit Fogwave schaltest du einfach ein, hörst im Hintergrund und genießt ein aufgeräumtes, werbefreies Erlebnis ohne Konto und ohne Tracking.</p>
<ul> <ul>
<li>Höre 10 litauische Sender, darunter ZIP FM, Power Hit Radio, Rock FM, Relax FM, M-1 und Gold FM.</li> <li>Höre 14 Sender aus Litauen und Lettland, darunter ZIP FM, Power Hit Radio, Rock FM, LRT Radijas, Žinių radijas und Latvijas Radio.</li>
<li>Hör weiter, während du andere Apps nutzt – mit Steuerung über Sperrbildschirm, Benachrichtigungen, Kopfhörer und Bluetooth.</li> <li>Hör weiter, während du andere Apps nutzt – mit Steuerung über Sperrbildschirm, Benachrichtigungen, Kopfhörer und Bluetooth.</li>
<li>Genieße deinen Lieblingsklang mit Equalizer, gespeicherten Einstellungen, Lautstärkeverstärkung und Audio-Presets.</li> <li>Genieße deinen Lieblingsklang mit Equalizer, gespeicherten Einstellungen, Lautstärkeverstärkung und Audio-Presets.</li>
<li>Hör einfach weiter: Bricht der Stream oder das Netz ab, verbindet sich die App automatisch neu.</li> <li>Hör einfach weiter: Bricht der Stream oder das Netz ab, verbindet sich die App automatisch neu.</li>
<li>Nimm das Radio mit auf die Straße – mit Android-Auto-Unterstützung.</li> <li>Nimm das Radio mit auf die Straße – mit Android-Auto-Unterstützung.</li>
<li>Finde Sender auf deine Art: Favoriten, zuletzt gehörte Sender, passende Genres und vier Ansichten.</li> <li>Finde Sender auf deine Art: Suche, Favoriten, zuletzt gehörte und ähnliche Sender – dazu der laufende Song.</li>
</ul> </ul>
<p>Wähle einen Sender und tippe auf Wiedergabe. Fogwave spielt im Hintergrund weiter und speichert deine Equalizer-Einstellungen für das nächste Mal. Das dunkle, aufgeräumte Design gibt es auf Englisch, Russisch, Deutsch, Japanisch, Litauisch und Chinesisch.</p> <p>Wähle einen Sender und tippe auf Wiedergabe. Fogwave spielt im Hintergrund weiter und speichert deine Equalizer-Einstellungen für das nächste Mal. Das dunkle, aufgeräumte Design gibt es auf Englisch, Russisch, Deutsch, Japanisch, Litauisch und Chinesisch.</p>
@@ -2,5 +2,5 @@
• Less stuttering on a weak network • Less stuttering on a weak network
• Smoother equalizer sliders and faster app start • Smoother equalizer sliders and faster app start
• Hopeless streams are no longer retried for minutes • Hopeless streams are no longer retried for minutes
• New stations: LRT Radijas, Žinių radijas, Latvijas Radio 1 and 2
New versions are also available on Gitea: https://git.skysparkle.cc/kalarina/Fogwave/releases • View options are now on the Radio tab only
@@ -0,0 +1,4 @@
• New design with search and a floating mini player
• Player with a round station disc and the title of the song on air
• Drifting fog in the color of the playing station
• Share the station or song you are listening to
@@ -0,0 +1,6 @@
• Color styles, including Material You; fog in the station's color is now optional
• Next/previous now work from the notification, headphones and Android Auto
• Voice requests from Assistant and Android Auto no longer stop the player
• Playback resumes by itself when the network comes back
• Loudness Enhancer now really makes the sound louder
• Smaller app and lower battery use
@@ -0,0 +1,4 @@
• Info tab: FM frequencies in Vilnius, Kaunas, Klaipėda and Riga, and a link to the station's website with its shows and schedule
• Support card with a Ko-fi button on the About screen
• Source code links now lead to GitHub
• A short guide on first launch; open it again from About
@@ -1,12 +1,12 @@
<p>Bring Lithuania's favorite radio stations along, without the clutter. Fogwave makes it easy to tune in, listen in the background, and enjoy a clean, ad-free experience with no account or tracking required.</p> <p>Bring Lithuania's favorite radio stations along, without the clutter. Fogwave makes it easy to tune in, listen in the background, and enjoy a clean, ad-free experience with no account or tracking required.</p>
<ul> <ul>
<li>Tune in to 10 Lithuanian stations, including ZIP FM, Power Hit Radio, Rock FM, Relax FM, M-1, and Gold FM.</li> <li>Tune in to 14 stations from Lithuania and Latvia, including ZIP FM, Power Hit Radio, Rock FM, LRT Radijas, Žinių radijas, and Latvijas Radio.</li>
<li>Keep listening while you use other apps, with controls on your lock screen, notifications, headphones, and Bluetooth.</li> <li>Keep listening while you use other apps, with controls on your lock screen, notifications, headphones, and Bluetooth.</li>
<li>Enjoy your favorite sound with an equalizer, saved settings, loudness boost, and audio presets.</li> <li>Enjoy your favorite sound with an equalizer, saved settings, loudness boost, and audio presets.</li>
<li>Get back to listening easily with auto-reconnect when your stream or network drops.</li> <li>Get back to listening easily with auto-reconnect when your stream or network drops.</li>
<li>Take radio on the road with Android Auto support.</li> <li>Take radio on the road with Android Auto support.</li>
<li>Find stations your way with favorites, recently played stations, genre matches, and four viewing layouts.</li> <li>Find stations your way with search, favorites, recently played and similar stations, and see the song that is on air.</li>
</ul> </ul>
<p>Choose a station and press play. Fogwave keeps audio running in the background and saves your equalizer settings for your next session. Its dark, uncluttered design is available in English, Russian, German, Japanese, Lithuanian, and Chinese.</p> <p>Choose a station and press play. Fogwave keeps audio running in the background and saves your equalizer settings for your next session. Its dark, uncluttered design is available in English, Russian, German, Japanese, Lithuanian, and Chinese.</p>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 784 KiB

After

Width:  |  Height:  |  Size: 639 KiB

Some files were not shown because too many files have changed in this diff Show More