Component used: ViewCompat
Version used:
Devices/Android versions reproduced on: All devices running Android 10 or earlier versions
I'm an SDK developer, and my SDK is showing a banner over the client app content.
I'm doing that by adding my view with addContentView so that my view is not affected by the client's views.
The problem I'm trying to solve is that the client can use any API that allows drawing under the system bars, and I need to get those insets and add a margin to my view.
I tried to get it by using ViewCompat.setOnApplyWindowInsetsListener and passing my view to it, and it works perfectly on devices running Android versions prior to Android 10, but in earlier versions the callback is not getting called.
I understand that there is a difference in the way of dispatching the insets between the versions but I didn't find a workaround for my case because I cannot override dispatchApplyWindowInsets since the components that don't dispatch it is the decorView that is not in my code base and this event cannot be registered in runtime.
When I register to ViewCompat.setOnApplyWindowInsetsListener with the decorView I get the insets but I have no way to know if this is a situation in that I need to consume those insets or not because it is not adjusted to my view specifically.
Is this a bug?
Is there a way to achieve that behavior?
Alternatively, if you have any idea how can I display a view in the client App while ignoring changes that are made by him that can make system bars overlap my view I'll be happy to know.
Thanks
Description
Component used: ViewCompat
Version used: Devices/Android versions reproduced on: All devices running Android 10 or earlier versions
I'm an SDK developer, and my SDK is showing a banner over the client app content. I'm doing that by adding my view with addContentView so that my view is not affected by the client's views. The problem I'm trying to solve is that the client can use any API that allows drawing under the system bars, and I need to get those insets and add a margin to my view. I tried to get it by using ViewCompat.setOnApplyWindowInsetsListener and passing my view to it, and it works perfectly on devices running Android versions prior to Android 10, but in earlier versions the callback is not getting called. I understand that there is a difference in the way of dispatching the insets between the versions but I didn't find a workaround for my case because I cannot override dispatchApplyWindowInsets since the components that don't dispatch it is the decorView that is not in my code base and this event cannot be registered in runtime. When I register to ViewCompat.setOnApplyWindowInsetsListener with the decorView I get the insets but I have no way to know if this is a situation in that I need to consume those insets or not because it is not adjusted to my view specifically.
Is this a bug?
Is there a way to achieve that behavior?
Alternatively, if you have any idea how can I display a view in the client App while ignoring changes that are made by him that can make system bars overlap my view I'll be happy to know.
Thanks