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:
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.
https://github.com/oleksandrbalan/programguide/assets/20944869/20fefbce-80cc-4e43-87d9-e359edf64c35
Fully configurable layout.
https://github.com/oleksandrbalan/programguide/assets/20944869/9ce2ecc6-7b80-470b-9254-77dcd5e670c1
If you need further customization options, check MinaBox library.