Skip to content
This repository was archived by the owner on Sep 30, 2023. It is now read-only.

Edge-to-edge behaviour on Android R #4

@mr-thierry

Description

@mr-thierry

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:

  1. As the main fragment of a single activity
  2. As a fragment inside a CoordinatorLayout in another activity

My app is build like so:

  1. The fragment calls edgeToEdge() to include padding for the top system bar
  2. 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions