c

    codeslubber

    2 years ago
    The SwiftUI Tutorial has a section where they wrap their paging component and then use it from SwiftUI, each ‘view’ in the sequence is then declarative and the coordinator logic is bolted on. I want to do the equivalent in Compose. Is there a way to integrate Compose code with just standard View components? and/or an example of doing this? It would seem that the whole idea of a framework entitled Compose would be to demonstrate the creation of components that are made up of other components (like a ViewPager2).
    Luca Nicoletti

    Luca Nicoletti

    2 years ago
    so, if you want to know how to use an
    old view
    in
    compose
    , have a look at how
    webview
    is done
    If you want to do vice-versa, you need to wait for the
    @GenerateView
    annotation to be completed
    c

    codeslubber

    2 years ago
    oh ok, I think that’s probably what I would need..
    Luca Nicoletti

    Luca Nicoletti

    2 years ago
    Btw, I see no point in using
    Compose
    inside the old Android Framework
    I’d rather wait and start with small screens entirely in
    Compose
    c

    codeslubber

    2 years ago
    well that’s not really what they are doing
    Luca Nicoletti

    Luca Nicoletti

    2 years ago
    Well, they need a solid base before allowing you to use
    components
    inside old view system
    c

    codeslubber

    2 years ago
    ok, and how would you tie them all together into a wizard? rewrite
    ViewPager2
    ? [no snark there]
    Luca Nicoletti

    Luca Nicoletti

    2 years ago
    There are already examples of
    Tabs
    in compose
    c

    codeslubber

    2 years ago
    ok maybe that’s enough thanks I will look at that
    Luca Nicoletti

    Luca Nicoletti

    2 years ago
    The idea would be to have 2 components, one for the
    tabs
    themselves and 1 for the
    content
    both built in
    compose
    , interacting with each other 🙂
    c

    codeslubber

    2 years ago
    right
    Luca Nicoletti

    Luca Nicoletti

    2 years ago
    nw 🙂
    c

    codeslubber

    2 years ago
    sure
    so you are basically saying you don’t really need
    ViewPager
    , just make the views in compose, and then treat them as tabs and bolt the nav logic on top
    Luca Nicoletti

    Luca Nicoletti

    2 years ago
    Well, I’m saying you could do that
    c

    codeslubber

    2 years ago
    yes
    thanks it’s helpful I will look at the tab samples..
    Luca Nicoletti

    Luca Nicoletti

    2 years ago
    And, for navigation (really basic) there are already examples already
    There’s a drawer example and JetSample handles it 🙂
    State was not handled properly in the example
    c

    codeslubber

    2 years ago
    wow fantastic! thanks..
    l

    Leland Richardson [G]

    2 years ago
    I have some code that integrates with RecyclerView and ViewPager. it’s a little bit hacky… but could put in a gist or something
    one thing to take into account is that while integration with android views is explicitly possible and was a primary design goal of compose, it is something where the IDE support for it right now is still really lacking
    so we haven’t shown very many examples with it
    because it feels wierd when the IDE complains about stuff or doesn’t work right and nothing is wrong
    IDE support will happen, but at the moment we are putting more resources into getting the compose toolkit working smoothly
    c

    codeslubber

    2 years ago
    thanks Leland! that makes a lot of sense.. have you guys done any brainstorming on what the DSL could unlock, in terms of those kinds of UI patterns? (wizards, onboarding, multi-panel config, etc.)?
    l

    Leland Richardson [G]

    2 years ago
    i have a few things in mind for sure. there was a cool hackathon project this week that hooked up compose to RemoteViews for notifications. Was nice that you could use compose to create dynamic UI in the notifications pane where the code felt seamlessly integrated with the rest of your UI
    and could be done from background services etc too
    pretty cool
    not sure if that is going to go anywhere, but might give you an idea for what type of things you could do
    c

    codeslubber

    2 years ago
    wow fantastic
    l

    Leland Richardson [G]

    2 years ago
    there already exists some work in compose on a composer that builds of Vectors instead of ComponentNodes or Views. It could basically replace AnimatedVectorDrawable IMO
    c

    codeslubber

    2 years ago
    have a piece I need to do that is going to involve getting a moderately complex
    ViewModel
    to drive a bunch of composable Views so I think this should be a great way to go..