Status Update
Comments
mo...@google.com <mo...@google.com> #2
I'm not sure what isVisible
is. Can you explain? Won't the insets be 0 if the IME isn't showing?
va...@google.com <va...@google.com> #3
isVisible
would just be the exposed value from WindowInsetsCompat.isVisible
:
Here is where it is set in accompanist/insets:
And yes, checking if the insets are 0 should be pretty much equivalent, but WindowInsetsCompat.isVisible
has the full backported behavior for the different types.
mo...@google.com <mo...@google.com> #4
I'm going to wait on shared element transitions work to be done before exploring the animation APIs. I think we're going to want to treat the animations completely differently.
I can add an isVisible
function. I can see that as being convenient.
ap...@google.com <ap...@google.com> #5
Branch: androidx-main
commit 9ad715087ea11e0d321c1da32cc2a62e8003a161
Author: George Mount <mount@google.com>
Date: Mon Mar 21 10:15:11 2022
Add window insets visibility
Bug: 217770337
Relnote: "WindowInsets companion now exposes the visibility
(whether they are on the screen, regardless of
whether thy intersect with the window), and the
size they could be if they are available on the device,
but not currently active."
Test: new tests for R+
Change-Id: I65182e3c8cdc868b9f6de3aef403c9f4d5074711
A compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/WindowInsetsIgnoringVisibilityTest.kt
M compose/foundation/foundation-layout/api/public_plus_experimental_current.txt
M compose/foundation/foundation-layout/src/androidMain/kotlin/androidx/compose/foundation/layout/WindowInsets.android.kt
lu...@gmail.com <lu...@gmail.com> #6
Is there any temporary solution for a isVisible
function? Or should I wait for the issue to be fixed before I migrate Insets Accompanist to the Compose foundation insets?
va...@google.com <va...@google.com> #7
The isVisible
portion has been merged but didn't make it into 1.2.0-alpha07
that was just released.
If you'd like, you should be able to use isVisible
with one of the most recent androidx snapshots until it is released normally.
re...@gmail.com <re...@gmail.com> #8
In terms of temporary workaround, try this code:
val WindowInsets.Companion.isImeVisible: Boolean
@Composable
get() {
val density = LocalDensity.current
val ime = this.ime
return remember {
derivedStateOf {
ime.getBottom(density) > 0
}
}.value
}
Source:
ry...@educast.com <ry...@educast.com> #9
mo...@google.com <mo...@google.com> #10
LookaheadLayout
is now available, but isn't complete. SubcomposeLayout
implementations for BoxWithConstraints
and LazyColumn
/LazyRow
are yet to be done.
When those complete, I expect to make the look-ahead work with WindowInsets. You'll be able to see the target position of the IME, for example, and then customize your animation for it.
da...@gmail.com <da...@gmail.com> #11
Nice, thanks for the update. Where can we see the work in progress?
Please keep us updated!!
Nice work!
mo...@google.com <mo...@google.com> #12
Alex suggested a different solution that will work well. I can provide the source and target IME WindowInsets and you can use it to determine where the IME will be and the progress (combined with the current IME insets).
mo...@google.com <mo...@google.com>
ap...@google.com <ap...@google.com> #14
Branch: androidx-main
commit 977d53a595ad75ee1693140c84c052cc60bce305
Author: George Mount <mount@google.com>
Date: Fri Aug 26 14:58:13 2022
Added WindowInsets IME animation source and target
Fixes: 217770337
Relnote: "Added WindowInsets.imeAnimationSource and
WindowInsets.imeAnimationTarget to determine the
animation progress and know where the IME will be
after animation completes."
Test: new tests, manual
Change-Id: I356f1bac4ac4ff311573eb8df7227098b9186c20
M compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/WindowInsetsActivity.kt
M compose/foundation/foundation-layout/src/androidAndroidTest/AndroidManifest.xml
A compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/WindowInsetsAnimationTest.kt
M compose/foundation/foundation-layout/api/public_plus_experimental_current.txt
M compose/foundation/foundation-layout/src/androidMain/kotlin/androidx/compose/foundation/layout/WindowInsets.android.kt
na...@google.com <na...@google.com> #15
The following release(s) address this bug:
androidx.compose.foundation:foundation-layout:1.4.0-alpha01
Description
accompanist/insets provides a few additional pieces of information about each type of insets, other than just the current size.
These include:
isVisible
- if a type of insets are currently visible (especially useful for IME)animationInProgress
- whether that type of insets are currently being animatedanimationFraction
- the current fraction of animation (useful for running with another animation)layoutInsets
/animatedInsets
- contains the last normally applied insets, and the currently animated insets, respectively. (useful for informing external animations)