Thread
#compose
    orangy

    orangy

    1 year ago
    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?
    Adam Powell

    Adam Powell

    1 year ago
    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?
    orangy

    orangy

    1 year ago
    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?
    Adam Powell

    Adam Powell

    1 year ago
    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
    should be able to start with
    ComponentActivity.setContent {}
    so just about as analogous as it gets to starting from Window
    orangy

    orangy

    1 year ago
    Never did anything Android, sorry 😃) will Google it tomorrow
    Adam Powell

    Adam Powell

    1 year ago
    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
    orangy

    orangy

    1 year ago
    Thanks! Will report back here in thread on how it goes
    I doubt there is ready-made wizard for compose and TV 😃
    Colton Idle

    Colton Idle

    1 year ago
    Ooooh 5 point directional stuff landed in beta08? Gotta try to find those commits. I didn't think that was coming in 1.0
    orangy

    orangy

    1 year ago
    Any ideas on what I could build for TV? Besides weather 😃
    Adam Powell

    Adam Powell

    1 year ago
    @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
    Colton Idle

    Colton Idle

    1 year ago
    #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.
    orangy

    orangy

    1 year ago
    Oh, right. Tetris using remote 😃)
    Adam Powell

    Adam Powell

    1 year ago
    @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 🙂
    orangy

    orangy

    1 year ago
    Adam, it doesn’t sound like a weekend project 😃
    Arkadii Ivanov

    Arkadii Ivanov

    1 year ago
    orangy

    orangy

    1 year ago
    It plays just nice with a remote d-pad 🙂
    Arkadii Ivanov

    Arkadii Ivanov

    1 year ago
    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?
    orangy

    orangy

    1 year ago
    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 🙂
    Colton Idle

    Colton Idle

    1 year ago
    I'm surprised it just works. I thought d-pad wouldn't work.
    orangy

    orangy

    1 year ago
    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