Fix bottom bar judder when hiding UI.

This commit is contained in:
Nicholas Tinsley 2022-10-25 17:06:35 -04:00
parent 2b4c01c106
commit 529211c3a5

View file

@ -280,13 +280,11 @@ class MediaPreviewV2Fragment : Fragment(R.layout.fragment_media_preview_v2), Med
private fun anchorMarginsToBottomInsets(viewToAnchor: View) {
ViewCompat.setOnApplyWindowInsetsListener(viewToAnchor) { view: View, windowInsetsCompat: WindowInsetsCompat ->
val layoutParams = view.layoutParams as MarginLayoutParams
val systemBarInsets = windowInsetsCompat.getInsets(WindowInsetsCompat.Type.systemBars())
layoutParams.setMargins(
systemBarInsets.left,
windowInsetsCompat.getSystemWindowInsetLeft(),
layoutParams.topMargin,
systemBarInsets.right,
systemBarInsets.bottom
)
windowInsetsCompat.getSystemWindowInsetRight(),
windowInsetsCompat.getSystemWindowInsetBottom())
view.layoutParams = layoutParams
windowInsetsCompat
}