henryblue / TvRecyclerView

A custom RecyclerView for Android TV end
Apache License 2.0
7 stars 4 forks source link

More than one TvRecyclerView steals focus #19

Closed kingargyle closed 5 years ago

kingargyle commented 5 years ago

So if I have more than one TvRecylcerView in an activity, say one on top of the other. If the bottom one loads content for the top when item in the bottom has focuse, content in the top is not selected and isn't assigned to the Top or at least a top item doesn't show it. Focus kinda goes no where until you start moving with a D-Pad and then it will jump to the top item usually near the end.

I've worked around this a bit, after the adapter is loaded with items for the top recylcer view, setting the first item in there as selected.

https://github.com/kingargyle/serenity-android/blob/dac_issue378_migrate_recyclerview/serenity-app/src/main/java/us/nineworlds/serenity/ui/browser/tv/seasons/TVShowSeasonBrowserActivity.java#L203

You can probably replicate the issue with a simple test that includes two TvRecylerViews, and have one of the recylcerViews populate content in the other when an item in it has focus.

If it helps, the bottom recylcer view is using a LinearLayoutManager, and the top recyclerview is using a GridLayoutManager.

henryblue commented 5 years ago

ok, thanks, i am on vacation, so i will reply to this question in two days.

kingargyle commented 5 years ago

No rush. I have a work around for now that seems to useable.

henryblue commented 5 years ago

I don't quite understand what you mean, i create an activity that contains multiple TvRecyclerView, and the focus moves without finding problems.

kingargyle commented 5 years ago

This may be a problem in the way I had implemented things on my end. There are times when the view can select a Null view and pass it into the onFocusChanged state listener. This typically happened when I had two of them on the same screen. I'll close this for now, as I have things working on the screen that was causing me problems before, and re-open if I can give you a better way to reproduce.