Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 131daa53 authored by Matt Pietal's avatar Matt Pietal
Browse files

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
parent 679e91ac
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
<?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>
+3 −0
Original line number Diff line number Diff line
@@ -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>
+9 −1
Original line number Diff line number Diff line
@@ -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();