This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Android Week View is a Kotlin Android library for displaying weekly schedules/timetables using Jetpack Compose. The legacy View-based implementation was removed in 3.0.0; the library is now Compose-only.
- Package:
de.tobiasschuerg.weekview - Modules:
library/(the published library) andapp/(sample/demo app) - Distribution: JitPack from GitHub tags
- Min SDK: 26, Compile/Target SDK: 36, Java: 17 toolchain
- Kotlin uses AGP 9.0 built-in Kotlin support (no separate
kotlin-androidplugin) - Dependency versions are in
gradle/libs.versions.toml
./gradlew clean build # Full build
./gradlew library:build # Library only
./gradlew test # Run unit tests (library/src/test/)
./gradlew library:testDebugUnitTest # Library unit tests only
./gradlew library:testDebugUnitTest --tests "de.tobiasschuerg.weekview.data.WeekDataTest" # Single test class
./gradlew ktlintCheck # Verify code style
./gradlew ktlintFormat # Auto-format code
./gradlew assembleDebug # Build debug APK (sample app)Always run ./gradlew ktlintFormat before committing. Use conventional commit messages (feat:, fix:, docs:, refactor:, test:).
All library source is under library/src/main/java/de/tobiasschuerg/weekview/ in three layers:
- Event — sealed class:
Event.Single(timed),Event.AllDay,Event.MultiDay - WeekData — event container that auto-expands its visible time span as events are added; validates events fall within its
LocalDateRange - TimeSpan — start/end
LocalTimepair with lazyDuration. Factory:TimeSpan.of(startTime, duration) - EventConfig / WeekViewConfig — display configuration data classes
- EventOverlapCalculator — BFS graph algorithm to find connected components of overlapping events, returns layout fractions (widthFraction, offsetFraction)
- EventPositionUtil — vertical offset and height from scaling factor and visible time range
- DayOfWeekUtil — locale-aware day-of-week to column index mapping
- WeekViewCompose — main entry composable; takes
WeekData, config objects, andWeekViewActionscallbacks components/— extracted composables: grid canvas, day headers, time axis, events pane, all-day/multi-day rowsstate/—WeekViewMetricsfor layout calculations;rememberWeekViewMetricsfor Compose state integrationstyle/—WeekViewStyletheming withWeekViewColors- WeekViewGesture — pinch-zoom via
TransformableState, swipe navigation
java.timeAPI everywhere (LocalDate, LocalTime, Duration) — available natively with minSdk 26- Sealed class hierarchy for type-safe event variants
- Stateless composables rendered from
WeekDatastate WeekViewActionsdata class for loosely-coupled event callbacks (all nullable lambdas)
GitHub Actions workflows (.github/workflows/):
pr.yml— runs on PRs: lint, unit tests, debug build. Auto-merges Dependabot patch/minor PRs.build.yml— runs on push tomaster/develop: same quality checks + build.release.yml— triggers after successfulbuild.ymlonmaster. Runsscripts/determine-version.shto auto-bump version based on conventional commits (feat:→ minor,fix:→ patch,!/BREAKING CHANGE→ major). UpdateslibVersioningradle.properties, creates a git tag (bareX.Y.Z, novprefix), and publishes a GitHub Release. JitPack picks up the tag automatically.
Library version is defined in gradle.properties (libVersion) and read by the root build.gradle.kts.
Unit tests in library/src/test/ using JUnit 4:
WeekDataTest— event addition, time span expansion, date range validationTimeSpanTest— duration calculation, hourly time generationEventPositionUtilTest— vertical offset/height calculationsDayOfWeekUtilTest— day-to-column mapping
Use the sample app (app/ module) for manual integration testing.