From 1b69a1d33ef961a30c621a3ace2d03c5a8072e5a Mon Sep 17 00:00:00 2001 From: Fabian Kozynski Date: Wed, 12 May 2021 16:36:51 -0400 Subject: [PATCH] Do not ignore views that are GONE If the view is GONE, we don't remove the size for the final size. Test: manual Fixes: 187881823 Change-Id: I29e4fc2cb0196799f2486661b2f76b4bfc01594a --- .../qs/tileimpl/IgnorableChildLinearLayout.kt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/IgnorableChildLinearLayout.kt b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/IgnorableChildLinearLayout.kt index 705576059b581..2bac29846893d 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/IgnorableChildLinearLayout.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/IgnorableChildLinearLayout.kt @@ -45,13 +45,15 @@ class IgnorableChildLinearLayout @JvmOverloads constructor( super.onMeasure(widthMeasureSpec, heightMeasureSpec) if (ignoreLastView && childCount > 0) { val lastView = getChildAt(childCount - 1) - val lp = lastView.layoutParams as MarginLayoutParams - if (orientation == VERTICAL) { - val height = lastView.measuredHeight + lp.bottomMargin + lp.topMargin - setMeasuredDimension(measuredWidth, measuredHeight - height) - } else { - val width = lastView.measuredWidth + lp.leftMargin + lp.rightMargin - setMeasuredDimension(measuredWidth - width, measuredHeight) + if (lastView.visibility != GONE) { + val lp = lastView.layoutParams as MarginLayoutParams + if (orientation == VERTICAL) { + val height = lastView.measuredHeight + lp.bottomMargin + lp.topMargin + setMeasuredDimension(measuredWidth, measuredHeight - height) + } else { + val width = lastView.measuredWidth + lp.leftMargin + lp.rightMargin + setMeasuredDimension(measuredWidth - width, measuredHeight) + } } } }