From 131daa5336b6638042b9b9990e99b40fda519524 Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Wed, 7 Jul 2021 11:08:53 -0400 Subject: [PATCH] PIN landscape updates for larger display setting When using large/larger display settings in landscape, the pin views get cut off. Tweak the layouts to better fit PIN views. This addresses a regression from Android 11. Fixes: 185735801 Test: manual (follow bug steps) Change-Id: Ice7a08eccb5a0c98a2b73e23c6c156b73ce511b4 --- .../res-keyguard/values-land/dimens.xml | 29 +++++++++++++++++++ .../values-sw360dp-land/dimens.xml | 3 ++ .../android/keyguard/PasswordTextView.java | 10 ++++++- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 packages/SystemUI/res-keyguard/values-land/dimens.xml diff --git a/packages/SystemUI/res-keyguard/values-land/dimens.xml b/packages/SystemUI/res-keyguard/values-land/dimens.xml new file mode 100644 index 0000000000000..6342b9c0c7f0b --- /dev/null +++ b/packages/SystemUI/res-keyguard/values-land/dimens.xml @@ -0,0 +1,29 @@ + + + + 3dp + 0dp + 2dp + 26dp + 0dp + + + 26 + diff --git a/packages/SystemUI/res-keyguard/values-sw360dp-land/dimens.xml b/packages/SystemUI/res-keyguard/values-sw360dp-land/dimens.xml index eb5843b5a1b7c..f465be4f5228a 100644 --- a/packages/SystemUI/res-keyguard/values-sw360dp-land/dimens.xml +++ b/packages/SystemUI/res-keyguard/values-sw360dp-land/dimens.xml @@ -23,4 +23,7 @@ 4dp 50dp 4dp + + + 40 diff --git a/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java b/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java index b80f8bd64dcf6..b1597144d2376 100644 --- a/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java +++ b/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java @@ -21,6 +21,7 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ValueAnimator; import android.content.Context; +import android.content.res.Configuration; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; @@ -87,7 +88,7 @@ public class PasswordTextView extends View { /** * The raw text size, will be multiplied by the scaled density when drawn */ - private final int mTextHeightRaw; + private int mTextHeightRaw; private final int mGravity; private ArrayList mTextChars = new ArrayList<>(); private String mText = ""; @@ -147,6 +148,7 @@ public class PasswordTextView extends View { } finally { a.recycle(); } + mDrawPaint.setFlags(Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); mDrawPaint.setTextAlign(Paint.Align.CENTER); mDrawPaint.setTypeface(Typeface.create( @@ -163,6 +165,12 @@ public class PasswordTextView extends View { mPM = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); } + @Override + protected void onConfigurationChanged(Configuration newConfig) { + mTextHeightRaw = getContext().getResources().getInteger( + R.integer.scaled_password_text_size); + } + @Override protected void onDraw(Canvas canvas) { float totalDrawingWidth = getDrawingWidth();