butterfly icon indicating copy to clipboard operation
butterfly copied to clipboard

Folding Feature & state is null always

Open oianmol opened this issue 3 years ago • 6 comments

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.

oianmol avatar Jan 31 '22 07:01 oianmol

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

skydoves avatar Jan 31 '22 07:01 skydoves

@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 avatar Jan 31 '22 07:01 oianmol

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.

oianmol avatar Jan 31 '22 07:01 oianmol

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.

skydoves avatar Jan 31 '22 08:01 skydoves

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

oianmol avatar Jan 31 '22 08:01 oianmol

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!

skydoves avatar Feb 03 '22 09:02 skydoves