Status Update
Comments
su...@google.com <su...@google.com> #2
Running into a similar issue, any update on this?
su...@google.com <su...@google.com> #3
This is a platform behavior change.
pu...@gmail.com <pu...@gmail.com> #4
fe...@tv2.no <fe...@tv2.no> #5
pu...@gmail.com <pu...@gmail.com> #6
Any progress?
pu...@gmail.com <pu...@gmail.com> #7
da...@bt.com <da...@bt.com> #9
ba...@google.com <ba...@google.com>
ma...@persgroep.net <ma...@persgroep.net> #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.
pu...@gmail.com <pu...@gmail.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
.
sz...@gmail.com <sz...@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")
pu...@gmail.com <pu...@gmail.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)
ol...@google.com <ol...@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
ol...@google.com <ol...@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
pu...@gmail.com <pu...@gmail.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
bl...@moshikids.com <bl...@moshikids.com> #19
Hey Tiger,
I made it nullable again. We will release this in the next couple of weeks or so.
ol...@google.com <ol...@google.com> #20
Thank you Jeremy.
Since androidx.core
as mentioned at
If the issue mentioned at
bu...@google.com <bu...@google.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
na...@google.com <na...@google.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)
Description
Component used: androidx.mediarouter:mediarouter Version used: 1.2.5 Devices/Android versions reproduced on: Samsung / Android 11
I've seen crash below happening on Samsung Android 11 devices (various models). It is fairly rare, as it happened only for 5 users 1 or twice, in an app with lots of users. Maybe it can be worked-around catching IllegalArgumentException.