feat(android): chunk Home Recently-Added into 25-album carousels (audit v3 §4.6)
A large library rendered all recently-added albums in one horizontal LazyRow that scrolled forever. Now the list is chunked into stacked carousels of 25 (RECENTLY_ADDED_CHUNK); the first carries the "Recently added" title and the rest are untitled continuation rows, matching Flutter's shared-ScrollController layout. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -75,6 +75,7 @@ import javax.inject.Inject
|
||||
|
||||
private const val SHARE_STOP_TIMEOUT_MS = 5_000L
|
||||
private const val BOTTOM_PADDING_FOR_MINIPLAYER_DP = 140
|
||||
private const val RECENTLY_ADDED_CHUNK = 25
|
||||
|
||||
// ─── State ───────────────────────────────────────────────────────────
|
||||
|
||||
@@ -290,10 +291,24 @@ private fun HomeSuccessContent(
|
||||
if (sections.playlists.isNotEmpty()) {
|
||||
item { PlaylistsRow(sections.playlists, onPlaylistClick) }
|
||||
}
|
||||
item {
|
||||
if (sections.recentlyAddedAlbums.isNotEmpty()) {
|
||||
AlbumsRow("Recently added", sections.recentlyAddedAlbums, onAlbumClick)
|
||||
} else {
|
||||
if (sections.recentlyAddedAlbums.isNotEmpty()) {
|
||||
// Chunk into stacked carousels of 25 so a large library
|
||||
// reads as multiple rows instead of one unwieldy LazyRow.
|
||||
// Only the first chunk carries the section title; the rest
|
||||
// are untitled continuation rows (matches Flutter).
|
||||
val chunks = sections.recentlyAddedAlbums.chunked(RECENTLY_ADDED_CHUNK)
|
||||
itemsIndexed(
|
||||
items = chunks,
|
||||
key = { index, chunk -> "recent-$index-${chunk.first().id}" },
|
||||
) { index, chunk ->
|
||||
AlbumsRow(
|
||||
title = if (index == 0) "Recently added" else "",
|
||||
albums = chunk,
|
||||
onAlbumClick = onAlbumClick,
|
||||
)
|
||||
}
|
||||
} else {
|
||||
item {
|
||||
EmptySection(
|
||||
title = "Recently added",
|
||||
body = "Albums you add to the library will show up here first.",
|
||||
|
||||
Reference in New Issue
Block a user