From c2ea8f264f8abc5c89a57b3d63cd4b4b4d39565f Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Wed, 18 Sep 2019 11:47:24 -0700 Subject: [PATCH] Take optional fields into consideration when measuring Also, move the padding to the icon so it's not dependent on an optional view. Bug: 123378871 Test: Do not set subtitle/description. Dialog layout looks normal now. Change-Id: Ia6ae768660442aeaadeb09aa7117780b8a97d56f --- packages/SystemUI/res/layout/auth_biometric_contents.xml | 2 +- .../com/android/systemui/biometrics/AuthBiometricView.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/res/layout/auth_biometric_contents.xml b/packages/SystemUI/res/layout/auth_biometric_contents.xml index 925e4fad103d6..a1006a8396e0f 100644 --- a/packages/SystemUI/res/layout/auth_biometric_contents.xml +++ b/packages/SystemUI/res/layout/auth_biometric_contents.xml @@ -42,7 +42,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingHorizontal="24dp" - android:paddingBottom="48dp" android:paddingTop="8dp" android:gravity="@integer/biometric_dialog_text_gravity" android:textSize="16sp" @@ -52,6 +51,7 @@ android:id="@+id/biometric_icon" android:layout_width="@dimen/biometric_dialog_biometric_icon_size" android:layout_height="@dimen/biometric_dialog_biometric_icon_size" + android:paddingTop="48dp" android:layout_gravity="center_horizontal" android:scaleType="fitXY" /> diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java index e4d2005c88675..73bbce9c5b356 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java @@ -608,7 +608,10 @@ public abstract class AuthBiometricView extends LinearLayout { MeasureSpec.makeMeasureSpec(newWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST)); } - totalHeight += child.getMeasuredHeight(); + + if (child.getVisibility() != View.GONE) { + totalHeight += child.getMeasuredHeight(); + } } // Use the new width so it's centered horizontally