material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[Snackbar] Refactor mandatory system gesture insets handling

Open pubiqq opened this issue 2 years ago • 3 comments

  • 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 and anchorViewLayoutListenerEnabled = false
  • Removes endless layout pass requests when calling the margin update with gestureInsetBottomIgnored = false and anchorViewLayoutListenerEnabled = true

Fixes https://github.com/material-components/material-components-android/issues/4326

pubiqq avatar Feb 20 '23 15:02 pubiqq

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?

drchen avatar Dec 11 '23 16:12 drchen

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()?

dsn5ft avatar Dec 15 '23 16:12 dsn5ft

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.

pubiqq avatar Dec 19 '23 01:12 pubiqq

Bump

pubiqq avatar May 07 '24 19:05 pubiqq