GetStream / butterfly

🦋 Butterfly helps you to build adaptive and responsive UIs for Android with Jetpack WindowManager.
https://getstream.github.io/butterfly/
Apache License 2.0
213 stars 10 forks source link

Folding Feature & state is null always #5

Open oianmol opened 2 years ago

oianmol commented 2 years ago

I am using a CompositionLocalProvider like

CompositionLocalProvider(
                    LocalWindowDpSize provides rememberWindowDpSize(),
                    LocalWindowLayoutInfo provides windowLayoutInfoState.value,
                    LocalPosture provides postureState.value
                )

and in my composable

LocalWindowLayoutInfo.current.isSeparating is always false

and

val foldingFeature = LocalWindowLayoutInfo.current.findFoldingFeature()
            if (foldingFeature?.state != FoldingFeature.State.HALF_OPENED) {
                Text(
                    stringResource(screen.resourceId),
                    maxLines = 1,
                    style = SlackCloneTypography.overline,
                )
            }

foldingFeature?.state is always null.

skydoves commented 2 years ago

Hi @Anmol92verma! Could you share your mobile device information? I just checked Microsoft's Surface Duo 2 works well for me.

oianmol commented 2 years ago

@skydoves I have tried both, Surface duo 2 and 7.6 fold in display. I ran the butterfly demo sample also, it does not work the same way.

oianmol commented 2 years ago

Here's the link to where It's implemented Link to My Implementation

I am using 1.0.1 version

Moreover LocalWindowLayoutInfo.current.displayFeatures is empty on a foldable device.

skydoves commented 2 years ago

I guess there's something issue with the WindowManager API. The isSeparating is just an extension function, which delegates the original WindowManager API. I'll look into it more and share solutions with you if I find anything.

oianmol commented 2 years ago

Cool, thanks @skydoves for confirming on the reproducibility at your end. thanks!

skydoves commented 2 years ago

Hey @Anmol92verma, I found the ticket on issuetracker, it seems still fixing on. I'll trace upcoming versions and let you know if there's any update!