I’ve got Sony TV which runs Google TV (which is still Android TV afaik), so is it possible to run Co...
o
I’ve got Sony TV which runs Google TV (which is still Android TV afaik), so is it possible to run Compose on it? :) or may be #compose-desktop fits better? Did anyone try it already?
a
shouldn't be anything stopping it 🙂 I've got what I think is a 2015 Bravia in the other room that I haven't tried running compose stuff on yet
the biggest hurdle is that some of the 5-way focus traversal stuff has been landing fairly recently
I think a bunch of that should be there in beta08?
o
I have whole weekend ahead of me :) gonna try it :)
But I still have to deal with Android views and such, right? Can’t have just Window as in desktop compose?
a
I am very interested to hear how it goes 😄 I think if I started playing with the living room TV too much I'd risk the ire of my wife and kids
😂 2
should be able to start with
ComponentActivity.setContent {}
1
so just about as analogous as it gets to starting from Window
o
Never did anything Android, sorry :)) will Google it tomorrow
a
Copy code
class MyTvActivity : ComponentActivity() {
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContent {
      ComposeStuff()
    }
  }
}
that's about it
the android studio new project wizard with compose for the Arctic Fox beta or newer should generate that plus some other theming stuff you'll likely discard for you
o
Thanks! Will report back here in thread on how it goes
👍 1
I doubt there is ready-made wizard for compose and TV :)
c
Ooooh 5 point directional stuff landed in beta08? Gotta try to find those commits. I didn't think that was coming in 1.0
o
Any ideas on what I could build for TV? Besides weather :)
a
@Colton Idle don't quote me on that, I know it's been coming in but I'm not sure which side of that build cut it landed on
c
#compose-desktop had a few games that you could pretty easily pretty I would think.
@Adam Powell any way to find out? Maybe I'll search issue tracker.
o
Oh, right. Tetris using remote :))
a
@orangy last time I wrote a hobby android tv app I used leanback to write a snes emulator frontend; a bunch of the emulators on play store are pretty good at accepting
ACTION_VIEW
intents pointing at roms on shared storage 🙂
o
Adam, it doesn’t sound like a weekend project :)
😄 2
a
Try porting CompoSnake https://github.com/arkivanov/CompoSnake 🤭
🆗 2
☝️ 4
o
❤️ 3
👍 2
K 5
It plays just nice with a remote d-pad 🙂
a
This is super cool! Originally I wrote CompoSnake for desktop, then it was ported to web (https://github.com/Foso/compose-snake-web) by @Foso, and now it is running on TV! Are you going to open source it?
o
There is nothing to open source 🙂 I made only a single bit of change – replaced Window main with ComponentActivity, as @Adam Powell wrote above. It just works out of the box 🙂
🦜 2
K 2
c
I'm surprised it just works. I thought d-pad wouldn't work.
o
Note, that this particular game doesn’t have any focusable controls, so it is just handling
KEYCODE_DPAD_LEFT
to control the snake. I will try more “traditional” app later today or tomorrow
👍 2