From 1d1a27540a9c5955be154f7b09ca5ca94f7baafe Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 28 May 2026 00:51:50 -0400 Subject: [PATCH] =?UTF-8?q?feat(android):=20chunk=20Home=20Recently-Added?= =?UTF-8?q?=20into=2025-album=20carousels=20(audit=20v3=20=C2=A74.6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../minstrel/home/ui/HomeScreen.kt | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/android/app/src/main/java/com/fabledsword/minstrel/home/ui/HomeScreen.kt b/android/app/src/main/java/com/fabledsword/minstrel/home/ui/HomeScreen.kt index fec89414..15c3bfda 100644 --- a/android/app/src/main/java/com/fabledsword/minstrel/home/ui/HomeScreen.kt +++ b/android/app/src/main/java/com/fabledsword/minstrel/home/ui/HomeScreen.kt @@ -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.",