Closed IvanAbakumov closed 4 months ago
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 :)
Could you point the place in the code where I can do it ?
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 :)
You are savior. Thank you so much) I haven't even thought this way.
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.
Hi @AaravPatel1999 could you upload a diff perhaps?
sure file.txt
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
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.
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.
The problem is that I don’t understand how to correctly implement pagination for the ProgramGuideManager.
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.
Is it possible to make endless EPG when if you scroll to the end of the day it will seamlessly go in the next day and so on ?