Program Guide, aka EPG, library for Compose UI.
Lazy layout to display program guide data on the two directional plane. It is build on the MinaBox (which is build on LazyLayout
) and provides methods to register item(s) and handles scrolling on the plane.
Library supports Android, iOS and Desktop (Windows, MacOS, Linux) targets.
Step 1. Add the MavenCentral repository to your build file.
Add it in your root build.gradle.kts
at the end of repositories:
allprojects {
repositories {
...
mavenCentral()
}
}
Or in settings.gradle.kts
:
dependencyResolutionManagement {
repositories {
...
mavenCentral()
}
}
Step 2. Add the dependency. Check latest version on the releases page.
dependencies {
implementation("io.github.oleksandrbalan:programguide:$version")
}
The core element of the ProgramGuide
layout is a content
lambda, where program, channel and timeline items are registered in the similar manner as in LazyColumn
or LazyRow
.
There are multiple types of items to register:
- Programs - program item cells. Each program must define channel index, and where it starts and ends.
- Channels - channel item cells, displayed to the left of the program guide. Each channel must define its index.
- Timeline - timeline cells, displayed on the top. Each timeline item must define where it starts and ends, so it is not locked to per-hour granularity.
- Current time - vertical line of the current time.
- Top corner - place for content in the top left corner, above channels and timeline.
Note: To be independent on date-time libraries, hours are defined as float numbers. For example: 9.5f represents 09:30 and 16.25f represents 16:15.
The size of the items are defined via dimensions
parameter.
It is also possible to observe on the scroll state and change it programmatically using an instance of the ProgramGuideState
.
ProgramGuide {
programs(
// Count of programs
count = ...,
// Necessary layout info of the single program cell
layoutInfo = { ProgramGuideItem.Program(...) }
) {
// Composable for single program cell
}
channels(
// Count of channels
count = ...,
// Necessary layout info of the single channel cell
layoutInfo = { ProgramGuideItem.Channel(...) }
) {
// Composable for single channel cell
}
timeline(
// Count of timeline blocks
count = ...,
// Necessary layout info of the single timeline cell
layoutInfo = { ProgramGuideItem.Timeline(...) }
) {
// Composable for single timeline cell
}
}
See Demo application and examples for more usage examples.
Simple EPG data.
simple.mp4
Fully configurable layout.
configuration.mp4
If you need further customization options, check MinaBox library.