Files
Android-247-Radio/chat-summaries/2026-03-09_bugfix-and-seek-to-live.md

35 lines
1.8 KiB
Markdown
Raw Normal View History

# 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: `primary` color when starred, faded `onSurfaceVariant` (40% alpha) when unstarred.
- Applies to both station rows and playlist section headers.
### 2. Station switching race condition (RadioPlaybackService.kt)
- Added `playJob` tracking — each new play request cancels the previous playback coroutine before starting a new one.
- The old job's `finally` block now checks `playJob == coroutineContext[Job]` to avoid calling `cleanup()`/`stopSelf()` when being replaced by a new station.
- Tapping the same station now restarts it (re-fires `ACTION_PLAY`).
- Fixed collector coroutine leak: `return@collect` on terminal events (`Error`, `Stopped`) so the SharedFlow collection terminates.
### 3. Seek-to-live feature
- Added `ACTION_SEEK_LIVE` to `RadioPlaybackService` — ends current connection span, stops/restarts the engine for the current station without creating a new `ListeningSession`.
- Added `seekToLive()` to `RadioController`.
- Added `seekToLive()` to `NowPlayingViewModel`.
- Added "SKIP TO LIVE" `FilledTonalButton` to `NowPlayingScreen`, positioned between latency indicator and Stay Connected toggle. Disabled during reconnection.
## Files changed
- `app/src/main/java/.../ui/screens/stationlist/StationListScreen.kt`
- `app/src/main/java/.../service/RadioPlaybackService.kt`
- `app/src/main/java/.../service/RadioController.kt`
- `app/src/main/java/.../ui/screens/nowplaying/NowPlayingScreen.kt`
- `app/src/main/java/.../ui/screens/nowplaying/NowPlayingViewModel.kt`
## Follow-up items
- None identified.