material-components-android
material-components-android copied to clipboard
[Snackbar] Refactor mandatory system gesture insets handling
- Fixes Snackbar flickering that occurs when its anchor view is updated off-screen and
gestureInsetBottomIgnored = false
- Removes a double layout pass request when calling the margin update with
gestureInsetBottomIgnored = false
andanchorViewLayoutListenerEnabled = false
- Removes endless layout pass requests when calling the margin update with
gestureInsetBottomIgnored = false
andanchorViewLayoutListenerEnabled = true
Fixes https://github.com/material-components/material-components-android/issues/4326
I think we post to update gesture insets for a reason. @dsn5ft do you have an idea why we did that in the first place?
I don't really remember, maybe updateMargins() was originally not called as often as it is now? @pubiqq do you know why the post() is not necessary anymore and you can call calculateExtraBottomMargin() directly in updateMargins()?
I'm pretty sure .post()
was added just because it was the easiest way to add mandatory system gesture inset support. There are no objective reasons to keep this approach.
Bump