Files
Android-247-Radio/chat-summaries/2026-03-09_tabbed-station-libraries.md
2026-03-10 20:17:03 -04:00

1.7 KiB

Tabbed Station Libraries

Task

Replace the single station list with a tabbed interface where every playlist gets its own tab, SomaFM is a built-in tab with listener-count sorting, and imported playlists become their own tabs automatically.

Changes Made

Data Model

  • Station.kt -- Added listenerCount: Int = 0 field for sort-by-listeners feature
  • Playlist.kt -- Added isBuiltIn: Boolean = false to protect built-in playlists (SomaFM) from deletion

Database

  • RadioDatabase.kt -- Bumped to version 2, added MIGRATION_1_2 that adds the new columns and seeds SomaFM data for existing installs
  • SomaFmSeedData.kt -- Added listener counts to all 44 stations, set isBuiltIn = true on SomaFM playlist, extracted shared seedStations() function used by both onCreate and the migration
  • RadioApplication.kt -- Registered MIGRATION_1_2

UI

  • StationListScreen.kt -- Complete restructure: ScrollableTabRow for tabs, SortChipRow with FilterChips (Default, A-Z, Z-A, Listeners), per-tab station list. Built-in tabs hide add/import/delete actions. Listener count shown inline on SomaFM stations. Long-press edit/delete disabled on built-in tab stations.
  • StationListViewModel.kt -- New state model with TabInfo, SortMode, tab selection, and in-memory sorting. Import now creates a new playlist (tab) from the file name and assigns all parsed stations to it, then switches to the new tab.
  • AddStationDialog.kt -- Simplified: removed playlist picker (stations go to current tab's playlist automatically)
  • EditStationDialog.kt -- Simplified: removed playlist picker

Follow-up Items

  • Drag-and-drop reordering within tabs
  • Tab reordering
  • Renaming tabs/playlists