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.
This commit is contained in:
Kyle Bolen
2026-07-28 06:24:08 +00:00
parent f3e93c2bd0
commit 6b624651fd
3 changed files with 23 additions and 15 deletions

View File

@@ -191,12 +191,6 @@ fun BrowseScreen(state: AppState) {
// ─── Data helpers ────────────────────────────────────────────────────────────── // ─── Data helpers ──────────────────────────────────────────────────────────────
private data class FolderSection(
val folder: FolderInfo,
val byDay: List<Pair<java.time.LocalDate, List<PhonePhoto>>>,
val allPhotos: List<PhonePhoto>,
)
private fun buildFolderSections(pl: PhotoListState.Loaded): List<FolderSection> { private fun buildFolderSections(pl: PhotoListState.Loaded): List<FolderSection> {
val zoneId = java.time.ZoneId.systemDefault() val zoneId = java.time.ZoneId.systemDefault()
return pl.folders.map { folder -> return pl.folders.map { folder ->
@@ -400,7 +394,7 @@ private fun UnifiedPhotoScroll(
} }
@Composable @Composable
private fun FolderDividerHeader( internal fun FolderDividerHeader(
name: String, name: String,
total: Int, total: Int,
selected: Int, selected: Int,

View File

@@ -47,7 +47,7 @@ import java.time.format.DateTimeFormatter
*/ */
@Composable @Composable
fun DensePhotoGrid( fun DensePhotoGrid(
folderSections: List<com.bolenpad.photophetch.ui.FolderSection>, folderSections: List<FolderSection>,
selectedPhotos: Set<PhonePhoto>, selectedPhotos: Set<PhonePhoto>,
device: DeviceInfo?, device: DeviceInfo?,
adbBin: String, adbBin: String,
@@ -69,13 +69,6 @@ fun DensePhotoGrid(
val scope = rememberCoroutineScope() val scope = rememberCoroutineScope()
// Build flat item list: folder header + photo rows per section // 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<PhonePhoto>? = null,
)
enum class GridItemType { FOLDER_HEADER, PHOTO_ROW }
val items: List<GridItem> = buildList { val items: List<GridItem> = buildList {
folderSections.forEach { section -> folderSections.forEach { section ->
if (section.allPhotos.isEmpty()) return@forEach if (section.allPhotos.isEmpty()) return@forEach

View File

@@ -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<Pair<LocalDate, List<PhonePhoto>>>,
val allPhotos: List<PhonePhoto>,
)
/** 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<PhonePhoto>? = null,
)