escodro

    escodro

    1 year ago
    Hello, everyone! 👋 I’m facing some issues with Compose and SplitScreen support. When my application first loads in Split Screen, it works fine. But if I try to resize it, the UI no longer loads. If I resize for a second time, it loads again. Basically, the first resize does work, the second does not, the third does works and goes on. Is it a Compose issue? Am I doing something wrong? Could someone help me, please? Thanks a lot in advance. ❤️
    m

    Mark Murphy

    1 year ago
    Split screen can trigger a configuration change. It should do so as you enter and exit the split-screen mode. It might also do so on a resize operation, depending on circumstances. So, you might want to play around with configuration changes and see if there is a connection. For example, if you added
    android:configChanges
    to the manifest for your activity, perhaps you missed a change type that occurs as part of split-screen resizes, and the destroy-and-recreate cycle is breaking things. Or, conversely, perhaps configuration changes are working fine, but resizes that do not trigger a configuration change are the ones that are failing.
    escodro

    escodro

    1 year ago
    Thanks, I will try to take a look! 😊 At a first glance I’m not adding anything that would break this behavior. Also, landscape is working fine… The only issue seems related to Split Screen.
    Adam Powell

    Adam Powell

    1 year ago
    KI. There's a bug where compose is making an assumption about window decor views across activity recreation for config changes that doesn't hold for certain cases of resizing.
    There's a workaround you can do involving creating your own Recomposer; I can post it when I'm at my desk later today
    escodro

    escodro

    1 year ago
    As always, thanks a lot @Adam Powell. 😊 Should I open a IssueTracker or is it already tracked?
    Adam Powell

    Adam Powell

    1 year ago
    (Specifically, Android can reuse the same View instances across activity recreation and Compose ends up using a stale Recomposer stored there that was shut down/inactive when the old activity was destroyed. We'll have a proper fix out soon but it might not make the next beta.)
    I think there's one open already, let me check some slack history
    escodro

    escodro

    1 year ago
    Adam Powell

    Adam Powell

    1 year ago
    Looks like there's a few 🙂
    escodro

    escodro

    1 year ago
    Thanks again! ❤️
    ppvi

    ppvi

    1 year ago
    is this why the keyboard doesn't trigger recomposition either? https://issuetracker.google.com/175864912
    Adam Powell

    Adam Powell

    1 year ago
    Can't see that one from my phone but I can check later. I wouldn't think so unless an activity destroy/recreate is involved
    That's a specific requirement for this bug in particular
    ppvi

    ppvi

    1 year ago
    ah, true
    Adam Powell

    Adam Powell

    1 year ago
    Workaround steps for now:
    Call
    setParentCompositionContext(recomposer)
    with a recomposer you create as outlined there
    the one compose is setting is kept in a view tag on the root view of the window and it's getting reused; if you specify your own on a
    ComposeView
    instance and
    setContentView(myComposeView)
    instead, you won't see the reuse.
    escodro

    escodro

    1 year ago
    Awesome! Thanks a lot! ❤️ Have a great weekend!