- Star icons now use distinct tint colors (primary vs faded) for clear state - Station switching no longer races — old playback job is cancelled before new - Skip-ahead drops ~1s of buffered audio per tap via atomic counter - Custom SocketFactory with SO_RCVBUF=16KB and TCP_NODELAY for minimal TCP buffering - Catch-up drain: discards pre-buffered frames until network reads block (live edge) - AudioTrack PERFORMANCE_MODE_LOW_LATENCY for smallest hardware buffer Made-with: Cursor
1.8 KiB
1.8 KiB
Bugfix: Star icons, station switching, and seek-to-live
Date: 2026-03-09
Task description
Fixed three issues found during manual testing of the app.
Changes made
1. Star icon visual state (StationListScreen.kt)
- Added explicit tint colors to star icons:
primarycolor when starred, fadedonSurfaceVariant(40% alpha) when unstarred. - Applies to both station rows and playlist section headers.
2. Station switching race condition (RadioPlaybackService.kt)
- Added
playJobtracking — each new play request cancels the previous playback coroutine before starting a new one. - The old job's
finallyblock now checksplayJob == coroutineContext[Job]to avoid callingcleanup()/stopSelf()when being replaced by a new station. - Tapping the same station now restarts it (re-fires
ACTION_PLAY). - Fixed collector coroutine leak:
return@collecton terminal events (Error,Stopped) so the SharedFlow collection terminates.
3. Seek-to-live feature
- Added
ACTION_SEEK_LIVEtoRadioPlaybackService— ends current connection span, stops/restarts the engine for the current station without creating a newListeningSession. - Added
seekToLive()toRadioController. - Added
seekToLive()toNowPlayingViewModel. - Added "SKIP TO LIVE"
FilledTonalButtontoNowPlayingScreen, positioned between latency indicator and Stay Connected toggle. Disabled during reconnection.
Files changed
app/src/main/java/.../ui/screens/stationlist/StationListScreen.ktapp/src/main/java/.../service/RadioPlaybackService.ktapp/src/main/java/.../service/RadioController.ktapp/src/main/java/.../ui/screens/nowplaying/NowPlayingScreen.ktapp/src/main/java/.../ui/screens/nowplaying/NowPlayingViewModel.kt
Follow-up items
- None identified.