Skip to content

feat: add sort options to Downloads screen#1751

Open
lesquel wants to merge 2 commits into
maxrave-dev:devfrom
lesquel:feature/download-sort-options
Open

feat: add sort options to Downloads screen#1751
lesquel wants to merge 2 commits into
maxrave-dev:devfrom
lesquel:feature/download-sort-options

Conversation

@lesquel

@lesquel lesquel commented Feb 23, 2026

Copy link
Copy Markdown

Summary

Add the ability to sort downloaded songs by multiple criteria with ascending/descending direction. The sort preference persists between sessions.

Sort Options

Option Description
Newest first Download date, most recent first (default — current behavior)
Oldest first Download date, oldest first
Title (A-Z) Alphabetical by song title
Title (Z-A) Reverse alphabetical by song title
Artist (A-Z) Alphabetical by artist name
Artist (Z-A) Reverse alphabetical by artist name

Implementation Details

Architecture

  • No changes to core submodule — all new code lives in composeApp
  • Follows the same MVVM + StateFlow + Compose patterns used throughout the app
  • Reuses the visual style of SortPlaylistBottomSheet from LocalPlaylistScreen

New Files

  • DownloadSortType.kt — Sealed class with 6 sort variants + serialization (toKey()/fromKey())

Modified Files

  • LibraryDynamicPlaylistViewModel.kt — Reactive sorting via combine(rawSongs, sortType), preference persistence via DataStoreManager.putString()/getString()
  • LibraryDynamicPlaylistScreen.kt — Sort icon button in TopAppBar (visible only for Downloaded type), SortDownloadsBottomSheet integration
  • ModalBottomSheet.kt — New SortDownloadsBottomSheet composable
  • AllExt.ktDownloadSortType.displayNameRes() extension function
  • 26 strings.xml files — i18n support for all existing locales (ar, az, bg, ca, de, es, fa, fi, fr, hi, in, it, iw, ja, ko, nl, pl, pt, ru, th, tr, uk, vi, zh, zh-rTW)

Key Design Decisions

  • DownloadSortType is separate from FilterState (avoids modifying core submodule)
  • DataStoreManager injected via by inject() from KoinComponent (no DI module changes needed)
  • Client-side sorting (in-memory) — appropriate for typical download list sizes
  • Sort preference key: "download_sort_type"

Screenshots

Sort icon appears in the Downloads screen TopAppBar. Tapping opens a bottom sheet with 6 sort options.

Testing Checklist

  • Navigate to Library → Downloaded → sort icon is visible
  • Each sort option reorders the list correctly
  • Sort preference persists after leaving and returning to the screen
  • Search works correctly with any active sort order
  • Empty download list doesn't crash
  • Songs without artist name sort correctly (fallback to empty string)

Add the ability to sort downloaded songs by:
- Title (A-Z / Z-A)
- Download date (Newest / Oldest first)
- Artist name (A-Z / Z-A)

The sort preference is persisted via DataStoreManager so it survives
app restarts. The implementation follows the same patterns used in
LocalPlaylistScreen (SortPlaylistBottomSheet).

Changes:
- New DownloadSortType sealed class with 6 sort variants
- New SortDownloadsBottomSheet composable in ModalBottomSheet.kt
- DownloadSortType.displayNameRes() extension in AllExt.kt
- LibraryDynamicPlaylistViewModel: reactive sorting via combine() of
  raw songs + sort type, preference persistence with putString/getString
- LibraryDynamicPlaylistScreen: sort icon in TopAppBar (Downloads only)
- i18n strings for all 26 locales
@slynobody

slynobody commented May 26, 2026

Copy link
Copy Markdown

highly second that to be merged soon, had the same idea.

@slynobody

slynobody commented Jun 11, 2026

Copy link
Copy Markdown

issue: advertised funcionality: 'Caching and offline playback' (main page) not working

  • Context: app used offline (WiFi/Mobile data disabled) with downloaded playlists.
  • Reproduce Issue: go offline, switch to 'library' / 'downloaded playlists', choose album

    black screen, no direct cache display (hanging while trying to fetch data online)

  • Symptom: Music playback works, but navigating 'back' results in black screens continuing to load indefinitely.
  • ui: Album covers seemingly missing in-app , though they appear correctly in the One UI 6.0 notification panel.
  • workaround: inside 'library' / 'downloaded playlists' press album > black screen > navigate back (iterate): album show up randomly (sometimes 3-4x back, sometimes 5-8 times), data is there but not handled right in this context.

also see this 2 year old reddit-issue usablity of caches inside downloaded playlists (reddit, not fixed)
also see: #1604 #1292 #1753 #1750 #1576

if you dont want to fix this, please at least give hints on compiling source (link on main page).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants