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

Commit 2e8db7df authored by Aaron Liu's avatar Aaron Liu
Browse files

Make sim pin views more responsive

Port over the constraint layout logic from the pin view to the sim pin
and sim puk view. I also reduced the sim icon to be a static 40x40 dp
and added a top margin to the password text view.

Also add some refinements to numpad jank. Firstly, ensure that we set
the corner radius correctly upon every layout. Secondly, re-enable auto
resize. There was an issue with this api (b/261552438) but this
shouldn't be an issue anymore because we are resetting the bouncer view
everytime upon show.

Fixes: 257213890
Test: open sim pin and sim puk view from foldable device. Instead of
adding an esim, which isn't possible on my device, I hard coded the
logic for the view to show up. I tested on various orientations and
display sizes.
Test: open/close bouncer a bunch of times and change orientation a bunch
of times on foldable.

Change-Id: I56966ea64e03155b05db9e7f5886f14ac127949f
parent 8b1b61c5
Loading
Loading
Loading
Loading
−2.54 KiB
Loading image diff...
−5.08 KiB
Loading image diff...
+3 −1
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@
    <TextView
        android:id="@+id/digit_text"
        style="@style/Widget.TextView.NumPadKey.Digit"
        android:autoSizeMaxTextSize="32sp"
        android:autoSizeTextType="uniform"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        />
+170 −171
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
**
** Copyright 2012, The Android Open Source Project
**
@@ -17,185 +16,185 @@
*/
-->
<!-- This is the SIM PIN view that allows the user to enter a SIM PIN to unlock the device. -->
<com.android.keyguard.KeyguardSimPinView
        xmlns:android="http://schemas.android.com/apk/res/android"
<com.android.keyguard.KeyguardSimPinView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/res-auto"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/keyguard_sim_pin_view"
        android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    androidprv:layout_maxWidth="@dimen/keyguard_security_width"
    android:layout_gravity="center_horizontal|bottom">
    <include layout="@layout/keyguard_bouncer_message_area"/>
    <Space

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
          android:layout_weight="1" />
    <ImageView
            android:id="@+id/keyguard_sim"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:tint="@color/background_protected"
            android:src="@drawable/ic_lockscreen_sim"/>
        android:layout_weight="1"
        android:layoutDirection="ltr">
        <LinearLayout
            android:id="@+id/pin_area"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:gravity="center"
            android:layoutDirection="ltr"
            >
        <include layout="@layout/keyguard_esim_area"
            android:gravity="center_horizontal"
            android:paddingTop="@dimen/num_pad_entry_row_margin_bottom"
            android:paddingBottom="@dimen/num_pad_entry_row_margin_bottom"
            androidprv:layout_constraintBottom_toTopOf="@+id/flow1"
            androidprv:layout_constraintEnd_toEndOf="parent"
            androidprv:layout_constraintStart_toStartOf="parent"
            androidprv:layout_constraintTop_toTopOf="parent">

            <ImageView
                android:id="@+id/keyguard_sim"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:layout_gravity="center_horizontal"
                android:src="@drawable/ic_lockscreen_sim"
                app:tint="@color/background_protected" />

            <include
                android:id="@+id/keyguard_esim_area"
                layout="@layout/keyguard_esim_area"
                android:layout_gravity="center_horizontal"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
        <RelativeLayout
                android:id="@+id/row0"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingBottom="4dp"
                >

            <com.android.keyguard.PasswordTextView
                android:id="@+id/simPinEntry"
                style="@style/Widget.TextView.Password"
                android:layout_width="@dimen/keyguard_security_width"
                android:layout_height="@dimen/keyguard_password_height"
                android:layout_centerHorizontal="true"
                android:layout_marginRight="72dp"
                android:contentDescription="@string/keyguard_accessibility_sim_pin_area"
                android:gravity="center"
                android:layout_gravity="center_horizontal"
                androidprv:scaledTextSize="@integer/scaled_password_text_size" />
        </RelativeLayout>
        <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
        </LinearLayout>

        <androidx.constraintlayout.helper.widget.Flow
            android:id="@+id/flow1"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:clipChildren="false"
            android:clipToPadding="false"
            android:orientation="horizontal"
                android:layout_gravity="center_horizontal"
                android:layout_marginBottom="@dimen/num_pad_row_margin_bottom"
                >
            androidprv:constraint_referenced_ids="key1,key2,key3,key4,key5,key6,key7,key8,key9,delete_button,key0,key_enter"
            androidprv:flow_horizontalGap="@dimen/num_pad_key_margin_end"
            androidprv:flow_horizontalStyle="packed"
            androidprv:flow_maxElementsWrap="3"
            androidprv:flow_verticalBias="1.0"
            androidprv:flow_verticalGap="@dimen/num_pad_entry_row_margin_bottom"
            androidprv:flow_verticalStyle="packed"
            androidprv:flow_wrapMode="aligned"
            androidprv:layout_constraintBottom_toBottomOf="parent"
            androidprv:layout_constraintEnd_toEndOf="parent"
            androidprv:layout_constraintStart_toStartOf="parent"
            androidprv:layout_constraintTop_toBottomOf="@id/pin_area" />

        <com.android.keyguard.NumPadButton
            android:id="@+id/delete_button"
            style="@style/NumPadKey.Delete"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:accessibilityTraversalBefore="@id/key0"
            android:contentDescription="@string/keyboardview_keycode_delete" />

        <com.android.keyguard.NumPadButton
            android:id="@+id/key_enter"
            style="@style/NumPadKey.Enter"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:contentDescription="@string/keyboardview_keycode_enter" />

        <com.android.keyguard.NumPadKey
            android:id="@+id/key1"
                    android:layout_width="@dimen/num_pad_key_width"
                    android:layout_height="match_parent"
                    android:layout_marginEnd="@dimen/num_pad_key_margin_end"
                    androidprv:textView="@+id/simPinEntry"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:accessibilityTraversalBefore="@id/key2"
            androidprv:digit="1"
                    />
            androidprv:textView="@+id/simPinEntry" />

        <com.android.keyguard.NumPadKey
            android:id="@+id/key2"
                    android:layout_width="@dimen/num_pad_key_width"
                    android:layout_height="match_parent"
                    android:layout_marginEnd="@dimen/num_pad_key_margin_end"
                    androidprv:textView="@+id/simPinEntry"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:accessibilityTraversalBefore="@id/key3"
            androidprv:digit="2"
                    />
            androidprv:textView="@+id/simPinEntry" />

        <com.android.keyguard.NumPadKey
            android:id="@+id/key3"
                    android:layout_width="@dimen/num_pad_key_width"
                    android:layout_height="match_parent"
                    androidprv:textView="@+id/simPinEntry"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:accessibilityTraversalBefore="@id/key4"
            androidprv:digit="3"
                    />
        </LinearLayout>
        <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:layout_gravity="center_horizontal"
                android:layout_marginBottom="@dimen/num_pad_row_margin_bottom"
                >
            androidprv:textView="@+id/simPinEntry" />

        <com.android.keyguard.NumPadKey
            android:id="@+id/key4"
                    android:layout_width="@dimen/num_pad_key_width"
                    android:layout_height="match_parent"
                    android:layout_marginEnd="@dimen/num_pad_key_margin_end"
                    androidprv:textView="@+id/simPinEntry"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:accessibilityTraversalBefore="@id/key5"
            androidprv:digit="4"
                    />
            androidprv:textView="@+id/simPinEntry" />

        <com.android.keyguard.NumPadKey
            android:id="@+id/key5"
                    android:layout_width="@dimen/num_pad_key_width"
                    android:layout_height="match_parent"
                    android:layout_marginEnd="@dimen/num_pad_key_margin_end"
                    androidprv:textView="@+id/simPinEntry"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:accessibilityTraversalBefore="@id/key6"
            androidprv:digit="5"
                    />
            androidprv:textView="@+id/simPinEntry" />


        <com.android.keyguard.NumPadKey
            android:id="@+id/key6"
                    android:layout_width="@dimen/num_pad_key_width"
                    android:layout_height="match_parent"
                    androidprv:textView="@+id/simPinEntry"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:accessibilityTraversalBefore="@id/key7"
            androidprv:digit="6"
                    />
        </LinearLayout>
        <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:layout_gravity="center_horizontal"
                android:layout_marginBottom="@dimen/num_pad_row_margin_bottom"
                >
            androidprv:textView="@+id/simPinEntry" />

        <com.android.keyguard.NumPadKey
            android:id="@+id/key7"
                    android:layout_width="@dimen/num_pad_key_width"
                    android:layout_height="match_parent"
                    android:layout_marginEnd="@dimen/num_pad_key_margin_end"
                    androidprv:textView="@+id/simPinEntry"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:accessibilityTraversalBefore="@id/key8"
            androidprv:digit="7"
                    />
            androidprv:textView="@+id/simPinEntry" />

        <com.android.keyguard.NumPadKey
            android:id="@+id/key8"
                    android:layout_width="@dimen/num_pad_key_width"
                    android:layout_height="match_parent"
                    android:layout_marginEnd="@dimen/num_pad_key_margin_end"
                    androidprv:textView="@+id/simPinEntry"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:accessibilityTraversalBefore="@id/key9"
            androidprv:digit="8"
                    />
            androidprv:textView="@+id/simPinEntry" />

        <com.android.keyguard.NumPadKey
            android:id="@+id/key9"
                    android:layout_width="@dimen/num_pad_key_width"
                    android:layout_height="match_parent"
                    androidprv:textView="@+id/simPinEntry"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:accessibilityTraversalBefore="@id/delete_button"
            androidprv:digit="9"
                    />
        </LinearLayout>
        <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:layout_gravity="center_horizontal"
                >
            <com.android.keyguard.NumPadButton
                    android:id="@+id/delete_button"
                    android:layout_width="@dimen/num_pad_key_width"
                    android:layout_height="match_parent"
                    android:layout_marginEnd="@dimen/num_pad_key_margin_end"
                    android:contentDescription="@string/keyboardview_keycode_delete"
                    style="@style/NumPadKey.Delete"
                    />
            androidprv:textView="@+id/simPinEntry" />

        <com.android.keyguard.NumPadKey
            android:id="@+id/key0"
                    android:layout_width="@dimen/num_pad_key_width"
                    android:layout_height="match_parent"
                    android:layout_marginEnd="@dimen/num_pad_key_margin_end"
                    androidprv:textView="@+id/simPinEntry"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:accessibilityTraversalBefore="@id/key_enter"
            androidprv:digit="0"
                    />
            <com.android.keyguard.NumPadButton
                    android:id="@+id/key_enter"
                    android:layout_width="@dimen/num_pad_key_width"
                    android:layout_height="match_parent"
                    style="@style/NumPadKey.Enter"
                    android:contentDescription="@string/keyboardview_keycode_enter"
                    />
        </LinearLayout>
    </LinearLayout>
    <include layout="@layout/keyguard_eca"
            androidprv:textView="@+id/simPinEntry" />
    </androidx.constraintlayout.widget.ConstraintLayout>

    <include
        android:id="@+id/keyguard_selector_fade_container"
        layout="@layout/keyguard_eca"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
             android:orientation="vertical"
        android:layout_gravity="bottom|center_horizontal"
             android:layout_marginTop="@dimen/keyguard_eca_top_margin"
        android:layout_marginBottom="2dp"
             android:gravity="center_horizontal"/>
        android:layout_marginTop="@dimen/keyguard_eca_top_margin"
        android:gravity="center_horizontal"
        android:orientation="vertical" />
</com.android.keyguard.KeyguardSimPinView>
Loading