Merge "PIN landscape updates for larger display setting" into sc-dev am: 91d027b5fa

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15222712

Change-Id: If672639fcbfc385738e6fce8c7ec6f90382d3b71
This commit is contained in:
Matt Pietal
2021-07-08 12:41:06 +00:00
committed by Automerger Merge Worker
3 changed files with 41 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2021, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<resources>
<dimen name="num_pad_row_margin_bottom">3dp</dimen>
<dimen name="keyguard_eca_top_margin">0dp</dimen>
<dimen name="keyguard_eca_bottom_margin">2dp</dimen>
<dimen name="keyguard_password_height">26dp</dimen>
<dimen name="num_pad_entry_row_margin_bottom">0dp</dimen>
<!-- The size of PIN text in the PIN unlock method. -->
<integer name="scaled_password_text_size">26</integer>
</resources>

View File

@@ -23,4 +23,7 @@
<dimen name="keyguard_eca_bottom_margin">4dp</dimen>
<dimen name="keyguard_password_height">50dp</dimen>
<dimen name="num_pad_entry_row_margin_bottom">4dp</dimen>
<!-- The size of PIN text in the PIN unlock method. -->
<integer name="scaled_password_text_size">40</integer>
</resources>

View File

@@ -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<CharState> 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();