Status Update
Comments
rm...@google.com <rm...@google.com> #2
Running into a similar issue, any update on this?
ku...@gmail.com <ku...@gmail.com> #3
This is a platform behavior change.
rm...@google.com <rm...@google.com>
ch...@google.com <ch...@google.com>
zh...@gmail.com <zh...@gmail.com> #4
di...@google.com <di...@google.com>
da...@google.com <da...@google.com> #5
pa...@google.com <pa...@google.com> #9
pa...@google.com <pa...@google.com> #10
This issue is also stopping us from being able to support edge-to-edge in Android 15. Given it's a enforced requirement for targeting Android 15, couldn't this be prioritised higher? Companies like us have hundreds of screens to fix so waiting until 2025 for a workaround is going to be tough work.
hu...@google.com <hu...@google.com> #11
Maybe you can create a static method, com.your.company.ViewGroupCompat#installCompatInsetsDispatch
, like this:
After creating the method, you need to call ViewGroupCompat.installCompatInsetsDispatch(getWindow().getDecorView())
in onCreate()
of your activity to make the behavior compatible with API 30+.
When the new library with the API is released, you can replace com.your.company.ViewGroupCompat
with androidx.core.view.ViewGroupCompat
.
dr...@gmail.com <dr...@gmail.com> #12
Wow quick response, thanks! I just tried applying that workaround to our root view and can confirm it fixes the issue. (Also FYI there's a typo in the PR; "comsumed")
hu...@google.com <hu...@google.com> #13
I'm getting a crash when using new version of ktx-core 1.16.0-alpha01
with fixed ViewCompat and ViewGroupCompat on API < 30. This is related to FragmentContainerView
:
java.lang.NullPointerException: Parameter specified as non-null is null: method androidx.fragment.app.FragmentContainerView.setOnApplyWindowInsetsListener, parameter listener
at androidx.fragment.app.FragmentContainerView.setOnApplyWindowInsetsListener(Unknown Source:2)
at androidx.core.view.ViewGroupCompat.dispatchApplyWindowInsets(ViewGroupCompat.java:255)
at androidx.core.view.ViewGroupCompat.dispatchApplyWindowInsets(ViewGroupCompat.java:264)
at androidx.core.view.ViewGroupCompat.dispatchApplyWindowInsets(ViewGroupCompat.java:264)
at androidx.core.view.ViewGroupCompat.dispatchApplyWindowInsets(ViewGroupCompat.java:264)
at androidx.core.view.ViewGroupCompat.dispatchApplyWindowInsets(ViewGroupCompat.java:264)
at androidx.core.view.ViewGroupCompat.dispatchApplyWindowInsets(ViewGroupCompat.java:264)
at androidx.core.view.ViewGroupCompat.dispatchApplyWindowInsets(ViewGroupCompat.java:264)
at androidx.core.view.ViewGroupCompat.lambda$installCompatInsetsDispatch$0(ViewGroupCompat.java:218)
at androidx.core.view.ViewGroupCompat$$ExternalSyntheticLambda1.onApplyWindowInsets(D8$$SyntheticClass:0)
at android.view.View.dispatchApplyWindowInsets(View.java:10499)
at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:7191)
at android.view.ViewRootImpl.dispatchApplyInsets(ViewRootImpl.java:1925)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2030)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1721)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7598)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:966)
at android.view.Choreographer.doCallbacks(Choreographer.java:790)
at android.view.Choreographer.doFrame(Choreographer.java:725)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:951)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
hu...@google.com <hu...@google.com> #14
Re
I think the @NonNull
annotation of androidx.fragment.app.FragmentContainerView.setOnApplyWindowInsetsListener
has been removed since
Do you mind upgrading your androidx.fragment version to 1.4.0-alpha09 or above? The latest version is
hu...@google.com <hu...@google.com> #17
Ah, you are right. It still requires a non-null object since the required type is not OnApplyWindowInsetsListener?
but OnApplyWindowInsetsListener
.
public override fun setOnApplyWindowInsetsListener(listener: OnApplyWindowInsetsListener) {
applyWindowInsetsListener = listener
}
Hi Jeremy,
Do you mind checking why androidx.fragment.app.FragmentContainerView.setOnApplyWindowInsetsListener
requires a non-null parameter? The restriction was added in
ap...@google.com <ap...@google.com> #18
Project: platform/frameworks/support
Branch: androidx-main
Author: Jeremy Woods <
Link:
Change the nullability of setOnApplyWindowInsetsListener
Expand for full commit details
Change the nullability of setOnApplyWindowInsetsListener
Since setOnApplyWindowInsetsListener overrides a method from the View
class which is in java and has no nullability, we did not know the
proper nullability.
It seems there are cases when the inset listener could indeed be null,
so we can make that nullable now.
RelNote: "FragmentContainerView's `setOnApplyWindowInsetsListener`
override now takes a null listener."
Test: All tests pass
Bug: 282790626
Change-Id: I575f0b5da72d096b14393afd9819ab66e061b002
Files:
- M
fragment/fragment/src/main/java/androidx/fragment/app/FragmentContainerView.kt
Hash: 415aeef3c0a44db3b614b717a65f8f028feef165
Date: Wed Jan 08 18:27:20 2025
pa...@google.com <pa...@google.com> #19
Hey Tiger,
I made it nullable again. We will release this in the next couple of weeks or so.
hu...@google.com <hu...@google.com> #20
Thank you Jeremy.
Since androidx.core
as mentioned at
If the issue mentioned at
da...@spotify.com <da...@spotify.com> #21
Any update on this to fix the crashing? Also does this new API will also fix the callback not being triggered after configuration change (orientation) for Android Tablet running on Android 21? We noticed another fragmented behavior between phone at tablet size devices where the setOnApplyWindowInsetsListener
callback is not being triggered in Fragments after configuration change.
Activity (callback is being triggered on both phone and tablet after configuration change)
ViewCompat.setOnApplyWindowInsetsListener(root) { _: View, insets: WindowInsetsCompat ->
// Return WindowInsetsCompat.CONSUMED if you don't want the window insets to keep passing down
// to descendant views including all views of Fragment(s) under this Activity
insets
}
Fragment with Jetpack Navigation (callback is being triggered regardless of Android version on phone size device after configuration change, but not on tablet running on Android 21)
ViewCompat.setOnApplyWindowInsetsListener(root) { _: View, insets: WindowInsetsCompat ->
// Return WindowInsetsCompat.CONSUMED if you don't want the window insets to keep passing down
// to descendant views including all views of Fragment(s) under this Activity
WindowInsetsCompat.CONSUMED
}
Also hoping
me...@gmail.com <me...@gmail.com> #22
Any chance this issue gets higher priority? It's a shame that Google is forcing developers to migrate to Android 15 and setup edge-to-edge while still having critical compatibility issues with older Android versions even in apps with relatively modern stack (Fragment + Compose)
hu...@google.com <hu...@google.com> #23
hu...@google.com <hu...@google.com> #24
Hi Jeremy,
Do you have any update about the new release?
ja...@gmail.com <ja...@gmail.com> #25
Build cut is this Wednesday and it will be released next week as part of Fragment 1.8.6
.
hu...@google.com <hu...@google.com> #26
hu...@google.com <hu...@google.com> #27
ku...@gmail.com <ku...@gmail.com> #28
hu...@google.com <hu...@google.com> #29
Finally, I've managed to reproduce this issue and found the root cause. I've explained this in detail at
I'll write a fix for this.
Description
Tested on AGP: 3.2.0
error: cannot generate view binders java.io.IOException: Stream closed
at java.util.zip.InflaterInputStream.ensureOpen(InflaterInputStream.java:67)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:142)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.Reader.read(Reader.java:140)
at kotlin.io.TextStreamsKt.copyTo(ReadWrite.kt:122)
at kotlin.io.TextStreamsKt.copyTo$default(ReadWrite.kt:115)
at kotlin.io.TextStreamsKt.readText(ReadWrite.kt:102)
at com.android.tools.build.jetifier.core.config.ConfigParser.loadDefaultConfig(ConfigParser.kt:54)
at android.databinding.tool.LibTypes$typeRewriter$2.invoke(LibTypes.kt:30)
at android.databinding.tool.LibTypes$typeRewriter$2.invoke(LibTypes.kt:23)
at kotlin.UnsafeLazyImpl.getValue(Lazy.kt:154)
at android.databinding.tool.LibTypes.getTypeRewriter(LibTypes.kt)
at android.databinding.tool.LibTypes.convert(LibTypes.kt:179)
at android.databinding.tool.LibTypes$nonNull$2.invoke(LibTypes.kt:117)
at android.databinding.tool.LibTypes$nonNull$2.invoke(LibTypes.kt:23)
at kotlin.UnsafeLazyImpl.getValue(Lazy.kt:154)
at android.databinding.tool.LibTypes.getNonNull(LibTypes.kt)
at android.databinding.tool.writer.LayoutBinderWriter$write$1.invoke(LayoutBinderWriter.kt:350)
at android.databinding.tool.writer.LayoutBinderWriter$write$1.invoke(LayoutBinderWriter.kt:315)
at android.databinding.tool.writer.KCodeKt.kcode(KCode.kt:172)
at android.databinding.tool.writer.LayoutBinderWriter.write(LayoutBinderWriter.kt:347)
at android.databinding.tool.LayoutBinder.writeViewBinder(LayoutBinder.java:360)
at android.databinding.tool.DataBinder.writeBinders(DataBinder.java:137)