Month widget: day totals from countByDay, test split bars (#491)

This commit is contained in:
makiolaj committed 2026-11-09 19:24:57 +01:00
1 parent dec2d1cb05
commit 1004356e75
3 files changed
+15 -2

No files matched your search

@@ -72,7 +72,7 @@ internal class WeekLayout(
/** The single lane of a [mixed] week, bars cut short where a day shows its count instead; null otherwise. */
val mixedLane: List<GridCell<LaneItem>>? = if (!mixed) null else mergeGaps(week.days.size) { col ->
val day = seating[col]
if (day.hidden.isNotEmpty()) return@mergeGaps GridCell(LaneItem.Count(day.seated.size + day.hidden.size), 1)
if (day.hidden.isNotEmpty()) return@mergeGaps GridCell(LaneItem.Count(week.countByDay[week.days[col]] ?: day.hidden.size), 1)
val seat = day.seated.firstOrNull() ?: return@mergeGaps null
val spanEnd = if (seat.bar) week.spanAt(col, seat.lane)?.endCol ?: col else col
val end = (col + 1..spanEnd).firstOrNull { seating[it].hidden.isNotEmpty() }?.minus(1) ?: spanEnd
@@ -107,7 +107,7 @@ private fun weekViews(
return week
}
layout.lanes.forEach { cells ->
val lane = laneViews(context, layout.compact)
val lane = laneViews(context)
cells.forEach { cell ->
val event = cell.item
lane.addView(R.id.lane, if (event == null) gap(context, cell.cols) else bar(context, event, cell.cols, soften, mode))