Git Product home page Git Product logo

android-tv-program-guide's Introduction

android-tv-program-guide

Scrolling demo

This is an open-source EPG (electronic program guide) implementation for Android TV only. The code in this repository is based on the official Android TV channel browser implementation.

We have removed the parts where it fetches all the program data from the cable TV connection, and replaced it with the ability to set your own data. Also we have converted the code to Kotlin and AndroidX.

The demo project

Features and usage

The programs you give to the program guide manager will be put in a row. Each channel has its own row, so you can quickly switch channels (up and down) or scroll in time (left and right). Next to that, there are quick buttons to switch between days and times of the day. Also, you can jump to the current time by clicking on the jump to live button.

Selecting a day

By extending the ProgramGuideFragment, you can get callbacks for when the selected program has changed, a program has been clicked, or the user requested that the data for a different day should be loaded.

Package

The repo consists of a library and demo project. The demo project showcases the usage and provides a quick way to test the workings of the library module.

Since there can be a lot of program guide designs, we do not provide the library as a package. You will probably have to fork this project to modify it according to your specifications and layouts. For the same reason, a lot of features are not configurable, to keep the code simple. If you feel that we should still offer a package, feel free to open a ticket to discuss :)

Right-to-Left (RTL) layout direction

This library supports RTL devices. When the layout direction is inverted, it will show the top and bottom widgets aligned to the right side, as well as the channel list, and the timeline will count up from right to left, so it will be inverted as well. If you don't wish to change the timeline, you can revert commit d7ba2af7e5d82bc9751a66a1a2f491ea85bfe458.

Support

Have you found a bug, or does the library not work on your device? Open a ticket with the reproduction steps and the manufacturer and model of your device, and we will do our best to help you. Pull requests are always welcome.

Java implementation

This library is written in Kotlin, and you should be able to integrate it in your project without any issues, even if the rest of the project is written in Java. But if you are still looking for a Java version, there is a fork of this repository available, with all of the code converted to Java: https://github.com/swinder0161/android-tv-program-guide

License

This project is licensed under the Apache 2.0 license

android-tv-program-guide's People

Contributors

dzolnai avatar halilozel1903 avatar iuliastana avatar okaymak avatar petercv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-tv-program-guide's Issues

Possibility of lazy loading

Hi,

Thanks for this amazing library. It works perfect for me. I just needed to check that if there is any possibility that we can load data on scroll rather than we just all the EPG data at once.

My current scenarios is that I need to load epg for Next 7 days but that takes a lot of time to populate. So Can you please help me with that how can I load the epg day by day as soon as that's available from API.

Thanks in advance.

Error building demo app

Hi, I just cloned the repo and loaded the project in Android Studio. When I try to run the demo I get the following error during build.

Cannot create service of type TaskExecuter using ProjectExecutionServices.createTaskExecuter() as there is a problem with parameter #16 of type ReservedFileSystemLocationRegistry.
> Cannot create service of type ReservedFileSystemLocationRegistry using ProjectExecutionServices.createReservedFileLocationRegistry() as there is a problem with parameter #1 of type List<ReservedFileSystemLocation>.

Extend progress for past shows

Hello,

Is it possible to extend progress to shows which are in past? Currently you can see progress on current shows, but I would like to make progress visible also on shows which are in past.

Show list is in random format.

Hii,

First of all thanks for this amazing library. It works well. Currently, I am using this library & facing an issue in channel view that all the channels listed well. But the shows which are listed horizontally in a particular channel are in random format. I tried to check the function in the collection class as well as I tried to set a loop inside the while-loop which maps the channel with shows but failed. I got stuck over there so can you help me to find the way that how can i get the horizontal shows list in a format from api call and not in random format. Any help will be appreciable.

"Jump To Live" & individual scrolling.

Hii there,

All thanks for this awesome library. The library is for a best use for tv program, but it is also working in mobile device for channel view. Now the issue,

1.) I am facing the issue is whenever I do a horizontal scroll to shows of any individual channel then it will scroll that particular channel and not scrolling whole gridview. Now I want to make a scroll to whole gridview even if I scroll any individual channel horizontally.

2.) "Jump to live" button works properly in tv UI but if we scroll horizontally and at the same time if we press the button then after that it will not navigate us to the live programs.

Any guidance will be appreciable.

Dynamic channel selector.

Hello Daniel,

Again I am here to bother you :) Here I want to know that is there any way to highlight the channel block.
Explanation:- When we navigate the shows using remote it will highlight it and informs the user that at which show the cursor or remote controller is. Same ways if we scroll vertically then again the remote controller movement and selected shows highlighted. Now during vertical scroll, I want to highlight the channel also that currently, which channel is selected.

Image:- https://drive.google.com/file/d/1y9It6Gvi1TjLxrWEEvELrYw402hl_yKD/view?usp=sharing

Thanks & Regards,
Nikhil,

Facing issue related Timeline and program syncing

Hello,
I am facing the issue when setting the time in timeline row from 12:00 AM to the end of the day at 23.59PM.
Could anyone please suggest how to do this?

as I already changed the parameter of "
private const val DAY_STARTS_AT_HOUR = 1
private const val DAY_ENDS_NEXT_DAY_AT_HOUR = 2" in "ProgramGuideManager" file but no effect reflection is visible.

I have added my live data inside that so because this start time issue, I am not able to show the correct current program.

It will help me a lot if anyone can help me.

Thanks in advance.

Manage focus on Program view

Hi, I am facing problem with manage focus in program view. When our program guide screen is going to start, I want default focus on current time program. When user scroll up and down, focus will move only current time program. This time when I launch the app the default program is selected either 1 or 2 hours later or earlier.

IndexOutOfBoundsException

Hello again,

We are getting some crashes on Firebase, so I was wondering if someone else also got this error. Below is the log from Firebase:

Fatal Exception: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 7(offset:7).state:20 com.egeniq.androidtvprogramguide.row.ProgramGuideRowGridView{a496714 V.ED..... ......ID 0,0-1920,135 #7f0b01fa app:id/row}, adapter:com.egeniq.androidtvprogramguide.ProgramGuideListAdapter@bc62826, layout:com.egeniq.androidtvprogramguide.timeline.ProgramGuideTimelineGridView$1@6fedc67, context:rs.maketv.lakitv.leanback.activities.HomeActivity@fd690bd
       at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6183)
       at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6118)
       at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6114)
       at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2303)
       at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1627)
       at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1587)
       at androidx.recyclerview.widget.LinearLayoutManager.scrollBy(LinearLayoutManager.java:1391)
       at androidx.recyclerview.widget.LinearLayoutManager.scrollHorizontallyBy(LinearLayoutManager.java:1116)
       at androidx.recyclerview.widget.RecyclerView.scrollStep(RecyclerView.java:1838)
       at androidx.recyclerview.widget.RecyclerView.scrollByInternal(RecyclerView.java:1940)
       at androidx.recyclerview.widget.RecyclerView.scrollBy(RecyclerView.java:1812)
       at com.egeniq.androidtvprogramguide.ProgramGuideFragment.onHorizontalScrolled(ProgramGuideFragment.kt:431)
       at com.egeniq.androidtvprogramguide.ProgramGuideFragment.access$onHorizontalScrolled(ProgramGuideFragment.kt:63)
       at com.egeniq.androidtvprogramguide.ProgramGuideFragment$setupComponents$onScrollListener$1.onScrolled(ProgramGuideFragment.kt:320)
       at androidx.recyclerview.widget.RecyclerView.dispatchOnScrolled(RecyclerView.java:5173)
       at androidx.recyclerview.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:5338)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
       at android.view.Choreographer.doCallbacks(Choreographer.java:670)
       at android.view.Choreographer.doFrame(Choreographer.java:603)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
       at android.os.Handler.handleCallback(Handler.java:739)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5422)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Progress bars display the progress on non-broadcast time

Hello @dzolnai,
I think this is a bug that appeared when I changed some parameters in the original demo.

  • I changed DAY_STARTS_AT_HOUR to 0, DAY_ENDS_NEXT_DAY_AT_HOUR to 6.
  • And I changed min, max length:
    val MIN_SHOW_LENGTH_SECONDS = TimeUnit.MINUTES.toSeconds(5)
    val MAX_SHOW_LENGTH_SECONDS = TimeUnit.MINUTES.toSeconds(60)

I have tested on real device and an emulator. Real Device: Sony Bravia 4K GB ATV3 (Android version 8.0.0) + emulator(Android TV 720p API 27)

screen_issue

not able to refresh data with new schedule list

Hi Sir,

i removed day filters and added 3 filter buttons, on clicking each button will fetch different data from api and I passed required values to createschedule method and it is working fine, but here my problem is how i can load the new schedule list data to adapter.

Timeline doesn't match schedule start time

Hello,
In the demo project the schedule items that we layout in a row does not correspond to the information displayed in the timeline.

Screenshot 2023-01-30 at 12 29 13

My system is configured on UTC +1
I supposed I might be missing something maybe ?

Hi @dzolnai

You did a great job.
I can see , this code is built using Kotlin, but I am really not good at Kotlin.
Do you have the same code in Java?
Please let me know.
Thanks. Shang.

Focus issue

In my app there is toolbar at top so when I open the activity first time focus goes to the Search icon & then goes down to the particular current program with focus .But I want initially focus goes to current program not to the Search icon on toolbar.

Support dynamically load epg list

In some cases for iptv, server may not support getting all epg data in one request, the data is huge for iptv providers who provides a few thousands of channels. Instead, they support getting epg channel by channel. In our current solution, we have to set data in advance, can we have a function e.g.
fun updateData(channelId: String, programList: List<ProgramGuideSchedule<T>>)
which only updates the channel's epg data and add:
notifyScheduleUpdated(channelId: String)
in the listener that only one row of data is updated?

current program view not updating currectly

Hi Sir,

the current program is not showing when opening the epg, which means that the program is scrolled to the left side with timeline and it is not visible. we have to use remote to navigate back to current program.
how to fix this problem?

Updating EPG

Hello! Just want to say, thank you for this great library. I'm forced to ask help here, because I have tried everything and no luck with this one. I have modified a little library and added function which will update row by row and that is working fine, but problem is that when update is finished, timeline is scrolled at the beginning. I will show you my code:

fun updateData(reverse: Boolean, count: Int) {
        val channelCount = programManager.channelCount
        if (!reverse) {
            for (i in (channelCount - count) until channelCount) {
                val listAdapter = ProgramGuideListAdapter(context.resources, programGuideHolder, i)
                if (reverse) {
                    programListAdapters.add(0, listAdapter)
                    notifyItemInserted(0)
                } else {
                    programListAdapters.add(listAdapter)
                    notifyItemInserted(programListAdapters.size)
                }
            }
        } else {
            for (i in count - 1 downTo 0) {
                val listAdapter = ProgramGuideListAdapter(context.resources, programGuideHolder, i)
                if (reverse) {
                    programListAdapters.add(0, listAdapter)
                    notifyItemInserted(0)
                } else {
                    programListAdapters.add(listAdapter)
                    notifyItemInserted(programListAdapters.size)
                }
            }
        }
    }

Also I have tried to comment this functions updateTimeline(), autoScrollToBestProgramme(), but no luck.

Timeline broken when returning from other fragment

Hello @dzolnai
I'm integrating your library with my application and I've found an issue with timeline row. It is reproducible in demo application.

In the method EpgFragment.onScheduleClicked() I'm opening a new fragment (it can be blank fragment) using this code:

val transaction = activity?.supportFragmentManager?.beginTransaction()
transaction?.replace(R.id.fragment_container, BlankFragment())
transaction?.addToBackStack("blank")
transaction?.commit()

It opens the new blank fragment (in my app this is fragment with asset details). Then I want to return to EpgFragment by pressing back button. When I do this, the timeline on EpgFragment is moved by 4.5 hours and also programguide_current_time_indicator has a wrong position. For other DISPLAY_TIMEZONE setting, the time difference is different, but always not correct. I attached the screenshots to show this behaviour.

BEFORE (House of Cards starts at 11:09 and this is correct on the timeline)
image

OPENING NEW FRAGMENT
image

AFTER BACK BUTTON PRESSED (House of Cards starts at 11:09 but on the timeline it starts at 6:39)
image

Open specific channel position

Hello, I want to go to a specific channel when EPG fragment is opened (scroll to that channel), how can I achieve this?
Regards.

Scroll the center Program Guide Grid when move from right to left

Hi,

I'm looking for a way to scroll the center Program Guide Grid when move from right to left. Can you guys tell me how to do it?
Also there is a variable in ProgramGuideGridView I don't understand yet is overlapStart in line it.overlapStart = it.resources.getDimensionPixelOffset(R.dimen.programguide_channel_column_width). Can you explain to me what it is, please?

Thanks & Regards.

Programs overlays under channel rows.

Hello Daniel,

After resolving the previous issues for mobile device with your guidance. I encountered with an another issue.
Here, when we scroll programs from right to left then it works perfect but they are still visible or go through channel row.

Image:- https://raw.githubusercontent.com/egeniq/android-tv-program-guide/master/documentation/demo_overview.png
Video:- https://raw.githubusercontent.com/egeniq/android-tv-program-guide/master/documentation/scrolling.gif

Here, shows are still visible under the channel row. I applied margin and padding in different xml and classes but failed. Kindly, can you help me to resolve this. @dzolnai

Thanks & Regards,

Facing issue related timeline dimen

Hello,
Thanks for this amazing library.
I want to change the distance between hours. I am facing the issue when changing "programguide_table_width_per_hour" in dimen values from 300dp to 80dp. I find that progress of some programs is not working properly with current time.
Can you guys tell me how can I fix this issue?
Thanks & Regards.
screen

Channel Image Focusable

Hello,

I wanted to ask if it is possible to make the channel image focusable. What i want is to make channel detail more accesible, so when i go all way left, access the channel by clicking the image.

Thanks,
Joaquín.

Only need to show yesterday, today and tomorrow shows in single scroll without any Filters of days.

Hi,

I hope you are doing well,

I'm using your EPG library but facing a problem in getting yesterday's data. I just commented on the filter part (setup filters method) because that is not needed in my project. I need only three days yesterday, today, and tomorrow data for programs with single scrolling only but unable to find the where to make a change in the program guide fragment. Can you please help me to resolve this?

Time line not sync with current time

Hi, Sir Thank you for your contribution.

I am new to this android TV development, I know java I don't know kotlin, I modified your UI according to my requirement but now the timeline and current time are not syncing. can you help me to solve this issue, in the program you are using hardcoded data can you provide one example of how to get data from API to the program in kotlin for this EPG program?

I want to use your skills in my java project

I am a Tv Player app developer. My senior developer told me that your epg format is very suitable for use in a tv app, and it will be written in java, so I tried to refer to your project. But it was code written in your Kotlin. Did you refactor the project that was implemented in Java through an update? If so, is there any way to refer to the project source of the previous Java version? It seems that there is no case other than you that implemented timeline and viewgroup control that changes according to time through Leanback. I would like help

Code Available in Java

Hi. My dear friend,

I am trying to convert kotlin to java.
Do you have same code in java (android) platform?

From last 1-2 month i am searching for the same but still not getting any proper solution.
Stuck totally. Please help me for the same. If you have any idea pls share with me,
[email protected]

Program Guide Grid not getting focused

Hi,

I found the issue when I am trying to change date to 3-4 days after the current date. I am not able to focus the Programs grid. And after switching amount dates sometime I am not even able to focus the program guide of current date as well.

I am using Xiaomi MIBOX3 with Android 9.

Unable to parse DateTime

Hi Sir,
you are passing nextTime and endTime in 2023-04-04T13:23:35Z this format.
in my case i am getting 2023-04-04T10:32:05+05:30 this format but i am not able to parse this format to your format can you please suggest how can i parse my data?

Not able to call setState(State.Content) from Android TV java project

Hi again,

I'm currently using the library from a Android TV project written in Java.
So far I'm able to show the ProgramGuideFragment inside my Android TV project and I'm now populating the channels and schedule. I believe I have to call setState(State.Content) in order to have the ProgramGuideFragment show the data (I'm also before this calling SetData)?
But it seems as if I'm not able to call setState(State.Content) or setState(State.Loading) from my Fragment which inherits from the ProgramGuideFragment.

error: cannot find symbol setState(State.Content); (this compile error is shown when trying to compile my code)...

Perhaps I'm doing something wrong here? :)

Kind regards

/Mattias

Not able to build release of library - constructor Handler()' is deprecated

Hi,

many thanks for developing this library!
I'm trying to build a release version of the library but Android Studio say's the constructor of Handler is deprecated and refuses to compile. Although it works in debug... Not sure if I'm doing something wrong here... :)

Here's the error message from Android Studio:
w: C:\AndroidProjects\android-tv-program-guide-master\library\src\main\java\com\egeniq\androidtvprogramguide\util\WeakHandler.kt: (54, 24): 'constructor Handler()' is deprecated. Deprecated in Java

Focus the specified program

Hi,
I'm trying to focus the specified program from programId.
I get child view from recyclerView of ProgramGuideRowGridView and requestFocus it, but child view is null.

Can you tell me how can I focus the specified program?

play stream onScheduleSelected

Thank you for your great work, the guide is excellent.

I want to know if it possible to display the stream instead of the image at the bottom of the screen on the left onScheduleSelected ?
is there a way to do it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.