Are there any good resources (blogpost, Github projects) available to understand the focus API’s in ...
t
Are there any good resources (blogpost, Github projects) available to understand the focus API’s in Compose. Especially in combination with TV/DPAD Leanback experience. Thanks in advance
y
There seem to be at least a few early apps using it https://github.com/nielsvanvelzen/tv-launcher
t
Ow yes ;) I’m looking for more in depth samples than the easy samples. Seems like even the easiest things like multiple LazyRow’s in a LazyColumn is behaving weirdly on a TV device. • Not remembering the previously selected item. • Random crashes when using focusRequester. Especially when components are out of the viewport. • ComposeView not giving transfering the focus to Compose world • …
Looking at the sample it has the same issues. sad panda
z
Cc @Ralston Da Silva
r
Hi Tim, thanks for raising these issues. Sorry that had a hard time trying out the new TV experimental APIs. I'll try to address some of the issues here: Remembering Focus LazyRow/LazyColumn are higher level concepts that are not available to the lower level focus APIs. We plan to add some lower level features to remember focus automatically. However right now, you could use the enter/exit focus properties to store the index of the focused item and then restore focus. Here is some sample code to get you started: Crashes with FocusRequester From the description it looks like you are calling requestFocus when the item is not composed. You need to scroll to the item so that is is visible, and then call requestFocus. Interoperability with the View System's focus This is something that we are still working on.