-
Notifications
You must be signed in to change notification settings - Fork 5
Edge-to-edge behaviour on Android R #4
Description
On Android R, the behaviour of ViewCompat.setOnApplyWindowInsetsListener has changed to support IME (see for example https://proandroiddev.com/exploring-windowinsets-on-android-11-a80cf8fe19be).
I currently have a fragment that is used in two different location in my app:
- As the main fragment of a single activity
- As a fragment inside a CoordinatorLayout in another activity
My app is build like so:
- The fragment calls
edgeToEdge()to include padding for the top system bar - The CoordinatorLayout also calls
edgeToEdge()to include padding for the top system bar
In API 29, the fragment inside the CoordinatorLayout won't get OnApplyWindowInsetsListener called
In API 30, the fragment do get OnApplyWindowInsetsListener called (probably due to the change for the new IME code)
Now, my fix right now is just to check if the fragment is not inside a CoordinatorLayout to call fragment.edgeToEdge().
But I'm wondering if there is anything that could be done in the edge-to-edge library to fix this instead. What do you think?