New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose display cutout insets as well as the raw window insets #685
Conversation
* | ||
* Prefer using one of the predefined types instead of this. | ||
*/ | ||
val rawInsets: WindowInsetsCompat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are exposed because copying all of the intricacies of DisplayCutout
isn't feasible so users who require advanced insets handling can use this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure on this. We specifically want to keep Android types out of the API surface.
What's the use case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can agree with that. The use case would be more advanced display cutout handling such as knowing the exact path or something like that. For my use case the safe insets are typically fine.
Another option is to surface it as a separate composition local that is android specific.
The problem in general is that a view can only have a single insets listener so if you use accompanist you cannot access the underlying insets and you have to wait for a PR to fix things that is missing from the API.
I'm OK with removing it for now though.
While converting our old code I found that most apps probably want to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR
I removed the raw insets. |
036b221
to
2ad6e81
Compare
@@ -79,12 +79,14 @@ package com.google.accompanist.insets { | |||
} | |||
|
|||
@androidx.compose.runtime.Stable public interface WindowInsets { | |||
method public default com.google.accompanist.insets.WindowInsets copy(optional com.google.accompanist.insets.WindowInsets.Type navigationBars, optional com.google.accompanist.insets.WindowInsets.Type statusBars, optional com.google.accompanist.insets.WindowInsets.Type systemGestures, optional com.google.accompanist.insets.WindowInsets.Type ime); | |||
method public default com.google.accompanist.insets.WindowInsets copy(optional com.google.accompanist.insets.WindowInsets.Type navigationBars, optional com.google.accompanist.insets.WindowInsets.Type statusBars, optional com.google.accompanist.insets.WindowInsets.Type systemGestures, optional com.google.accompanist.insets.WindowInsets.Type ime, optional com.google.accompanist.insets.WindowInsets.Type displayCutout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It binary compatibility is important we'd have to add another copy method
2ad6e81
to
cfc4a87
Compare
Thanks! |
This fixes #681