From 6b624651fd18f30611b1dc08788af626b58ea235 Mon Sep 17 00:00:00 2001 From: Kyle Bolen Date: Tue, 28 Jul 2026 06:24:08 +0000 Subject: [PATCH] Fix: extract FolderSection/GridItem to GridModels.kt, make FolderDividerHeader internal FolderSection was private in BrowseScreen.kt, blocking DensePhotoGrid from using it. Moved to GridModels.kt along with GridItemType and GridItem. FolderDividerHeader made internal so both grid views can share it. --- .../bolenpad/photophetch/ui/BrowseScreen.kt | 8 +------ .../bolenpad/photophetch/ui/DensePhotoGrid.kt | 9 +------- .../com/bolenpad/photophetch/ui/GridModels.kt | 21 +++++++++++++++++++ 3 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 src/main/kotlin/com/bolenpad/photophetch/ui/GridModels.kt diff --git a/src/main/kotlin/com/bolenpad/photophetch/ui/BrowseScreen.kt b/src/main/kotlin/com/bolenpad/photophetch/ui/BrowseScreen.kt index bc0c742..476af23 100644 --- a/src/main/kotlin/com/bolenpad/photophetch/ui/BrowseScreen.kt +++ b/src/main/kotlin/com/bolenpad/photophetch/ui/BrowseScreen.kt @@ -191,12 +191,6 @@ fun BrowseScreen(state: AppState) { // ─── Data helpers ────────────────────────────────────────────────────────────── -private data class FolderSection( - val folder: FolderInfo, - val byDay: List>>, - val allPhotos: List, -) - private fun buildFolderSections(pl: PhotoListState.Loaded): List { val zoneId = java.time.ZoneId.systemDefault() return pl.folders.map { folder -> @@ -400,7 +394,7 @@ private fun UnifiedPhotoScroll( } @Composable -private fun FolderDividerHeader( +internal fun FolderDividerHeader( name: String, total: Int, selected: Int, diff --git a/src/main/kotlin/com/bolenpad/photophetch/ui/DensePhotoGrid.kt b/src/main/kotlin/com/bolenpad/photophetch/ui/DensePhotoGrid.kt index d8397ab..4115ce3 100644 --- a/src/main/kotlin/com/bolenpad/photophetch/ui/DensePhotoGrid.kt +++ b/src/main/kotlin/com/bolenpad/photophetch/ui/DensePhotoGrid.kt @@ -47,7 +47,7 @@ import java.time.format.DateTimeFormatter */ @Composable fun DensePhotoGrid( - folderSections: List, + folderSections: List, selectedPhotos: Set, device: DeviceInfo?, adbBin: String, @@ -69,13 +69,6 @@ fun DensePhotoGrid( val scope = rememberCoroutineScope() // Build flat item list: folder header + photo rows per section - data class GridItem( - val type: GridItemType, - val folderSection: com.bolenpad.photophetch.ui.FolderSection? = null, - val rowPhotos: List? = null, - ) - enum class GridItemType { FOLDER_HEADER, PHOTO_ROW } - val items: List = buildList { folderSections.forEach { section -> if (section.allPhotos.isEmpty()) return@forEach diff --git a/src/main/kotlin/com/bolenpad/photophetch/ui/GridModels.kt b/src/main/kotlin/com/bolenpad/photophetch/ui/GridModels.kt new file mode 100644 index 0000000..58c049a --- /dev/null +++ b/src/main/kotlin/com/bolenpad/photophetch/ui/GridModels.kt @@ -0,0 +1,21 @@ +package com.bolenpad.photophetch.ui + +import com.bolenpad.photophetch.model.PhonePhoto +import java.time.LocalDate + +/** A folder's photos grouped by day, used by both Grouped and Dense grid views */ +data class FolderSection( + val folder: FolderInfo, + val byDay: List>>, + val allPhotos: List, +) + +/** Item types used in the DensePhotoGrid flat list */ +enum class GridItemType { FOLDER_HEADER, PHOTO_ROW } + +/** A single item in the DensePhotoGrid flat list */ +data class GridItem( + val type: GridItemType, + val folderSection: FolderSection? = null, + val rowPhotos: List? = null, +)