egeniq/android-tv-program-guide

Updating grid data in chunks

Closed this issue · 4 comments

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.

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.

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?

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.

Closing because of inactivity