mirror of
https://github.com/material-components/material-components-android.git
synced 2026-01-20 20:12:52 +08:00
The anchor view can be detached even when the snack bar (or any transient bottom bar) is showing. If this situation happens the global layout listener it registers with the anchor view will become not removable due to a bug/intended behavior of Android View's implementation. We need to remove the listener when the anchor view is detached to fix the issue. This CL also refactors the whole implementation of anchor view and consolidates the anchoring/unanchoring logic to improve readability and robustness of it. Resolves https://github.com/material-components/material-components-android/issues/2042 PiperOrigin-RevId: 382603130