egeniq / android-tv-program-guide

Android TV Program Guide
Apache License 2.0
164 stars 66 forks source link

Updating grid data in chunks #70

Closed ngan9elova closed 3 months ago

ngan9elova commented 4 months ago

I'm currently trying to implement lazy loading, but I'm facing the following problem, when adding new programs for each channel in the grid, the grid always restarts the scroll position and returns me to the beginning of the grid. One approach I tried was in ProgramGuideRowGridView in onRequestFocusInDescendants using programGuideManager.jumpTo(newlyAddedChunkStartMillis), but this creates not a really nice UI behaviour and the scroll still first goes to the start position and then to the jumpTo position. Is there a way to resolve this issue.

dzolnai commented 4 months ago

I'm sorry, lazy loading is not a supported feature. I assume, that when you load the new items, it will recreate the recyclerviews, or fill them with new items, so the focus will be lost and regained, jumping to the beginning.

ngan9elova commented 4 months ago

I see, thank you, I made some changes which kind of give me this behaviour, but I have some focus issues. Do you possibly have any ideas in which area should I concentrate, regarding the mentioned issues such as: focus sometimes skipping element in the row, or sometimes not being able to move the focus downwards unless I move it a couple of times in random direction (I think perhaps the focusSearch or findNextFocusedProgram might be responsible). Can you tell me a bit more why those methods were needed or what use case required them to be added?

dzolnai commented 4 months ago

If you enable view layout debugging in the developer options, you can see the current focus with a big X on it, that can help, maybe some other component catches the focus when the items are removed. But that means that the current items are removed, so maybe you should look at some different behavior, like implementing DiffUtil on the RecyclerViews and ensuring that existing items are kept.

dzolnai commented 3 months ago

Closing because of inactivity