Giter Site home page Giter Site logo

Comments (12)

dzolnai avatar dzolnai commented on July 30, 2024

It should be possible, since the cells are created dynamically, only the ones you see on the screen are stored in memory. You could try extending the ranges to like 1 month, and see what happens :)

from android-tv-program-guide.

IvanAbakumov avatar IvanAbakumov commented on July 30, 2024

Could you point the place in the code where I can do it ?

from android-tv-program-guide.

dzolnai avatar dzolnai commented on July 30, 2024

Hello Ivan,

Here's a diff where I change the timeline to extend to 90 days, and I also fill the demo program with random data for those days. Only thing that needs to be fixed is that the day selector should also update based on the current day (as the time-of-day-selector does), but that shouldn't be too hard :)

90days_timeline.txt

from android-tv-program-guide.

IvanAbakumov avatar IvanAbakumov commented on July 30, 2024

You are savior. Thank you so much)
I haven't even thought this way.

from android-tv-program-guide.

AaravPatel1999 avatar AaravPatel1999 commented on July 30, 2024

Hi, I have a similar problem with implementing scrolling for multiple days in the past and future. Specifically, I want to implement scrolling for 7 days into the past and 7 days into the future. These days are set from the current day. I tried your code and it works for days in the "future".

Your code:

EpgFragment.kt

val MIN_CHANNEL_END_TIME =
localDate.atStartOfDay().plusDays(89).withHour(21).truncatedTo(ChronoUnit.HOURS)
.atZone(DISPLAY_TIMEZONE)
                 
val MAX_CHANNEL_END_TIME =
localDate.plusDays(90).atStartOfDay().withHour(4).truncatedTo(ChronoUnit.HOURS)
.atZone(DISPLAY_TIMEZONE)

ProgramGuideManager.kt

val timelineEndsAt =
timelineStartsAt.plusDays(90).withHour(DAY_ENDS_NEXT_DAY_AT_HOUR)

By analogy, I changed the code for days in the "past" and it works strangely.

My code:
ProgramGuideManager.kt

val timelineStartsAt =
selectedDate.minusDays(7).atStartOfDay(timeZone).withHour(DAY_STARTS_AT_HOUR)

EpgFragment.kt

  val MIN_CHANNEL_START_TIME =
            localDate.atStartOfDay().minusDays(7).withHour(2).truncatedTo(ChronoUnit.HOURS)
                .atZone(DISPLAY_TIMEZONE)
        val MAX_CHANNEL_START_TIME =
            localDate.atStartOfDay().minusDays(7).withHour(8).truncatedTo(ChronoUnit.HOURS)
                .atZone(DISPLAY_TIMEZONE)

It broked the "live" day, shows only 3 days, and the scroll works only for 3 days. I'm a beginner and don't quite understand what needs to be changed.

from android-tv-program-guide.

dzolnai avatar dzolnai commented on July 30, 2024

Hi @AaravPatel1999 could you upload a diff perhaps?

from android-tv-program-guide.

AaravPatel1999 avatar AaravPatel1999 commented on July 30, 2024

sure
file.txt

from android-tv-program-guide.

dzolnai avatar dzolnai commented on July 30, 2024

I think your issue is this - your code looks something like:

                    val timelineStartsAt =
                        selectedDate.atStartOfDay(timeZone).minusDays(7).withHour(DAY_STARTS_AT_HOUR)
                    val timelineEndsAt =
                        timelineStartsAt.plusDays(7).withHour(DAY_ENDS_NEXT_DAY_AT_HOUR)

Which means that first, the timeline will start at 7 days before - but then you add 7 days to the timeline start, ending at today. You need to either add 14 days to the start date, or 7 days to the selectedDate, then it should work.

Btw, your diff did not apply, so probably mine won't work on your branch, but I think it is short enough that you get the gist of it. This version works if you apply it on the main branch in this repo: 7days_before_after.txt

from android-tv-program-guide.

AaravPatel1999 avatar AaravPatel1999 commented on July 30, 2024

Thank you very much, this solution was quite helpful, and I also made some adjustments. I have one more question: can we incorporate pagination into your solution?

I attempted a pagination solution for a normal RecyclerView, and each time a new page of items is loaded, the grid thinks I am loading a completely new list. It seems logical, but I haven't yet figured out how to modify it.

I also tried to implement pagination within ProgramGuideManager. So, I load my full list into ProgramGuideManager, but inside ProgramGuideManager, I show only 20 items. In the onRequestChildFocus method, I catch when the user scrolls to the very bottom and load more items from ProgramGuideManager. But this solution has an issue with the initial load; for some reason, it takes 10-12 seconds.

from android-tv-program-guide.

dzolnai avatar dzolnai commented on July 30, 2024

Is the issue that focus is not kept on the current item, and it just jumps to the top?

I could investigate if you send me the full example code, but without that, I can not see what is going on.

from android-tv-program-guide.

AaravPatel1999 avatar AaravPatel1999 commented on July 30, 2024

The problem is that I don’t understand how to correctly implement pagination for the ProgramGuideManager.

from android-tv-program-guide.

dzolnai avatar dzolnai commented on July 30, 2024

I'm sorry, I'm not able to help with that. I do have the time to help debugging issues with the current features of this library, but won't be able to assist extending the library with new features. If you need some explanation regarding the code in the library, I can help you with that though.

from android-tv-program-guide.

Related Issues (20)

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.