diff options
3 files changed, 35 insertions, 1 deletions
diff --git a/packages/SystemUI/res/layout/auth_biometric_contents.xml b/packages/SystemUI/res/layout/auth_biometric_contents.xml index 58adb9146bd0..e1b294f2d757 100644 --- a/packages/SystemUI/res/layout/auth_biometric_contents.xml +++ b/packages/SystemUI/res/layout/auth_biometric_contents.xml @@ -21,6 +21,9 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="@integer/biometric_dialog_text_gravity" + android:singleLine="true" + android:marqueeRepeatLimit="1" + android:ellipsize="marquee" style="@style/TextAppearance.AuthCredential.Title"/> <TextView @@ -28,13 +31,16 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="@integer/biometric_dialog_text_gravity" + android:singleLine="true" + android:marqueeRepeatLimit="1" + android:ellipsize="marquee" style="@style/TextAppearance.AuthCredential.Subtitle"/> <TextView android:id="@+id/description" android:layout_width="match_parent" android:layout_height="wrap_content" - android:gravity="@integer/biometric_dialog_text_gravity" + android:scrollbars ="vertical" style="@style/TextAppearance.AuthCredential.Description"/> <Space android:id="@+id/space_above_icon" diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java index 55da8da6cc33..1413f4a81574 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java @@ -34,6 +34,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.text.TextUtils; +import android.text.method.ScrollingMovementMethod; import android.util.AttributeSet; import android.util.Log; import android.view.View; @@ -706,6 +707,12 @@ public class AuthBiometricView extends LinearLayout { mTitleView.setText(mPromptInfo.getTitle()); + //setSelected could make marguee work + mTitleView.setSelected(true); + mSubtitleView.setSelected(true); + //make description view become scrollable + mDescriptionView.setMovementMethod(new ScrollingMovementMethod()); + if (isDeviceCredentialAllowed()) { final CharSequence credentialButtonText; @Utils.CredentialType final int credentialType = diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsDialogMeasureAdapter.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsDialogMeasureAdapter.java index 6afe420a9d02..dbfce2ed2532 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsDialogMeasureAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsDialogMeasureAdapter.java @@ -139,6 +139,9 @@ public class UdfpsDialogMeasureAdapter { child.measure( MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(clampedSpacerHeight, MeasureSpec.EXACTLY)); + } else if (child.getId() == R.id.description) { + //skip description view and compute later + continue; } else { child.measure( MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), @@ -150,9 +153,27 @@ public class UdfpsDialogMeasureAdapter { } } + //re-calculate the height of description + View description = mView.findViewById(R.id.description); + totalHeight += measureDescription(description, displayHeight, width, totalHeight); + return new AuthDialog.LayoutParams(width, totalHeight); } + private int measureDescription(View description, int displayHeight, int currWidth, + int currHeight) { + //description view should be measured in AuthBiometricFingerprintView#onMeasureInternal + //so we could getMeasuredHeight in onMeasureInternalPortrait directly. + int newHeight = description.getMeasuredHeight() + currHeight; + int limit = (int) (displayHeight * 0.75); + if (newHeight > limit) { + description.measure( + MeasureSpec.makeMeasureSpec(currWidth, MeasureSpec.EXACTLY), + MeasureSpec.makeMeasureSpec(limit - currHeight, MeasureSpec.EXACTLY)); + } + return description.getMeasuredHeight(); + } + @NonNull private AuthDialog.LayoutParams onMeasureInternalLandscape(int width, int height) { final WindowMetrics windowMetrics = mWindowManager.getMaximumWindowMetrics(); |