Modern Android library for displaying weekly schedules and events with both Compose and Classic View implementations.
Initially created for Schedule Deluxe, this library provides a flexible week view component that's perfect for calendar apps, timetables, and schedule management.
View-based Implementation | Compose Implementation |
---|---|
![]() |
![]() |
β Recommended |
The modern, performant implementation built with Jetpack Compose.
@Composable
fun MyWeekView() {
val weekData = remember { WeekData() }
val eventConfig = remember { EventConfig() }
val weekViewConfig = remember { WeekViewConfig() }
WeekViewCompose(
weekData = weekData,
eventConfig = eventConfig,
weekViewConfig = weekViewConfig,
onEventClick = { eventId ->
// Handle event click
}
)
}
val event = Event.Single(
id = 1L,
date = LocalDate.now(),
title = "Team Meeting",
shortTitle = "Meeting",
timeSpan = TimeSpan.of(LocalTime.of(10, 0), Duration.ofHours(1)),
backgroundColor = Color.Blue,
textColor = Color.White
)
weekData.add(event)
β οΈ Warning: The View-based implementation is deprecated. Please migrate to the Compose version for better performance, modern UI patterns, and future support.
<de.tobiasschuerg.weekview.view.WeekView android:id="@+id/week_view" android:layout_width="match_parent" android:layout_height="wrap_content" app:accent_color="@color/colorAccent" app:start_hour="8" app:end_hour="18" />
// β οΈ DEPRECATED - Use WeekViewCompose instead
val config = EventConfig(showSubtitle = false, showTimeEnd = false)
weekView.eventConfig = config
weekView.setShowNowIndicator(true)
weekView.setEventClickListener { eventView ->
// Handle event click
}
val event = Event.Single(
id = 1337,
date = LocalDate.now(),
title = "Dentist Appointment",
shortTitle = "DENT",
timeSpan = TimeSpan.of(LocalTime.of(10, 0), Duration.ofHours(1)),
backgroundColor = Color.RED,
textColor = Color.WHITE
)
weekView.addEvent(event)
val eventConfig = EventConfig(
showSubtitle = true,
showTimeEnd = true
)
val weekViewConfig = WeekViewConfig().apply {
scalingFactor = 1.2f
}
// Single event with specific time (fully supported)
val meeting = Event.Single(
id = 1L,
date = LocalDate.of(2024, 1, 15),
title = "Project Review",
shortTitle = "Review",
timeSpan = TimeSpan.of(LocalTime.of(14, 0), Duration.ofHours(2)),
backgroundColor = Color.Blue,
textColor = Color.White
)
// All-day event (data model available)
val holiday = Event.AllDay(
id = 2L,
date = LocalDate.of(2024, 1, 16),
title = "National Holiday",
shortTitle = "Holiday"
)
// Multi-day event (data model available)
val conference = Event.MultiDay(
id = 3L,
date = LocalDate.of(2024, 1, 20),
title = "Tech Conference",
shortTitle = "Conf",
lastDate = LocalDate.of(2024, 1, 22)
)
Note: Currently, only
Event.Single
is fully implemented in the view rendering.Event.AllDay
andEvent.MultiDay
have data models but no view implementation yet.
Add this to your root build.gradle
file:
allprojects {
repositories {
// ... other repositories
maven { url 'https://jitpack.io' }
}
}
Add this to your app build.gradle
file:
dependencies {
implementation 'com.github.tobiasschuerg:android-week-view:2.0.0'
// Required for Compose implementation
implementation platform('androidx.compose:compose-bom:2025.08.01')
implementation 'androidx.compose.ui:ui'
implementation 'androidx.compose.material3:material3'
// Required for java.time API support on older Android versions
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
}
In your app build.gradle
:
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
coreLibraryDesugaringEnabled true
}
}
Before (Deprecated):
// XML Layout
<de.tobiasschuerg.weekview.view.WeekView android : id ="@+id/week_view" ... />
// Activity
weekView.addEvent(event)
weekView.setEventClickListener { ... }
After (Recommended):
// Compose
WeekViewCompose(
weekData = weekData.apply { add(event) },
onEventClick = { eventId -> TODO }
)
The included sample app demonstrates both implementations:
- Modern Compose WeekView
- Legacy View-based WeekView
Run the sample app to see all features in action and choose the implementation that fits your needs.
Starting from version 2.0.0:
- β Compose implementation is the recommended approach
β οΈ View-based implementation is deprecated but maintained for compatibility
Starting from version 1.8.0:
- Switched from ThreeTen Backport to core library desugaring
- Requires
coreLibraryDesugaring
to be enabled
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Run
./gradlew ktlintFormat
before committing - Add tests for new functionality
- Update documentation
- Submit a pull request
- JitPack: https://jitpack.io/#tobiasschuerg/android-week-view
- Sample App: See
app/
module in this repository - Issues: https://github.com/tobiasschuerg/android-week-view/issues
β Don't forget to star this repository if you find it useful!