![](https://private-user-images.githubusercontent.com/20944869/240821247-40f7d757-ff5f-4b9a-a4d4-5666a46d09f9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM0MDk0NzEsIm5iZiI6MTcyMzQwOTE3MSwicGF0aCI6Ii8yMDk0NDg2OS8yNDA4MjEyNDctNDBmN2Q3NTctZmY1Zi00YjlhLWE0ZDQtNTY2NmE0NmQwOWY5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODExVDIwNDYxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFhMzc1ZDFiNDJiZjBmN2NjMjY0NWI1Nzk3ZGVlYTk1NzI5MDY0MDAwYTA3MmQzOGQ0NzYxMTk1YjcwNTI4YTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.A_2Q-wZEmhiwSDtuGyZBvYRnOAmyiQOro0lNKs6wzOs)
Program Guide, aka EPG, library for Jetpack Compose.
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.
Step 1. Add the MavenCentral repository to your build file.
Add it in your root build.gradle
at the end of repositories:
allprojects {
repositories {
...
mavenCentral()
}
}
Or in settings.gradle
:
pluginManagement {
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.