summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2021-05-12 22:21:32 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-05-12 22:21:32 +0000
commit4d2b82b01fa9eb55238f6cee432bec108c7ee438 (patch)
treed0d8482a5701eef0be819aaf9570779b5cb12a05
parent3009a4d87dee1ba5b24bed52fb74136ac2944393 (diff)
parent1b69a1d33ef961a30c621a3ace2d03c5a8072e5a (diff)
Merge "Do not ignore views that are GONE" into sc-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tileimpl/IgnorableChildLinearLayout.kt16
1 files 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 705576059b58..2bac29846893 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)
+ }
}
}
}