PIN Views - Make a bit smaller for better reachability
Align with latest UX guidance, making buttons better spaced and a bit
smaller
Fixes: 182196214
Test: manual
Change-Id: Ibc29e04da3867071d558c7f3643addeb2826b2bc
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml
index 6ae759c..50ffbc8 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml
@@ -59,124 +59,127 @@
</com.android.keyguard.AlphaOptimizedRelativeLayout>
<LinearLayout
android:id="@+id/row1"
- android:layout_width="match_parent"
+ 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"
>
<com.android.keyguard.NumPadKey
android:id="@+id/key1"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/pinEntry"
androidprv:digit="1"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key2"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/pinEntry"
androidprv:digit="2"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key3"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
androidprv:textView="@+id/pinEntry"
androidprv:digit="3"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/row2"
- android:layout_width="match_parent"
+ 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"
>
<com.android.keyguard.NumPadKey
android:id="@+id/key4"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/pinEntry"
androidprv:digit="4"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key5"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/pinEntry"
androidprv:digit="5"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key6"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
androidprv:textView="@+id/pinEntry"
androidprv:digit="6"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/row3"
- android:layout_width="match_parent"
+ 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"
>
<com.android.keyguard.NumPadKey
android:id="@+id/key7"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/pinEntry"
androidprv:digit="7"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key8"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/pinEntry"
androidprv:digit="8"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key9"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
androidprv:textView="@+id/pinEntry"
androidprv:digit="9"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/row4"
- android:layout_width="match_parent"
+ 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="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
android:contentDescription="@string/keyboardview_keycode_delete"
style="@style/NumPadKey.Delete"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key0"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/pinEntry"
androidprv:digit="0"
/>
<com.android.keyguard.NumPadButton
android:id="@+id/key_enter"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
style="@style/NumPadKey.Enter"
android:contentDescription="@string/keyboardview_keycode_enter"
/>
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml
index f709424..297c20e 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml
@@ -71,121 +71,124 @@
/>
</RelativeLayout>
<LinearLayout
- android:layout_width="match_parent"
+ 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"
>
<com.android.keyguard.NumPadKey
android:id="@+id/key1"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/simPinEntry"
androidprv:digit="1"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key2"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/simPinEntry"
androidprv:digit="2"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key3"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
androidprv:textView="@+id/simPinEntry"
androidprv:digit="3"
/>
</LinearLayout>
<LinearLayout
- android:layout_width="match_parent"
+ 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"
>
<com.android.keyguard.NumPadKey
android:id="@+id/key4"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/simPinEntry"
androidprv:digit="4"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key5"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/simPinEntry"
androidprv:digit="5"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key6"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
androidprv:textView="@+id/simPinEntry"
androidprv:digit="6"
/>
</LinearLayout>
<LinearLayout
- android:layout_width="match_parent"
+ 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"
>
<com.android.keyguard.NumPadKey
android:id="@+id/key7"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/simPinEntry"
androidprv:digit="7"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key8"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/simPinEntry"
androidprv:digit="8"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key9"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
androidprv:textView="@+id/simPinEntry"
androidprv:digit="9"
/>
</LinearLayout>
<LinearLayout
- android:layout_width="match_parent"
+ 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="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
android:contentDescription="@string/keyboardview_keycode_delete"
style="@style/NumPadKey.Delete"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key0"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/simPinEntry"
androidprv:digit="0"
/>
<com.android.keyguard.NumPadButton
android:id="@+id/key_enter"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
style="@style/NumPadKey.Enter"
android:contentDescription="@string/keyboardview_keycode_enter"
/>
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml
index 2f9fed6..388919e 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml
@@ -72,121 +72,125 @@
/>
</RelativeLayout>
<LinearLayout
- android:layout_width="match_parent"
+ 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"
>
<com.android.keyguard.NumPadKey
android:id="@+id/key1"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/pukEntry"
androidprv:digit="1"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key2"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/pukEntry"
androidprv:digit="2"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key3"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
androidprv:textView="@+id/pukEntry"
androidprv:digit="3"
/>
</LinearLayout>
<LinearLayout
- android:layout_width="match_parent"
+ 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"
+
>
<com.android.keyguard.NumPadKey
android:id="@+id/key4"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/pukEntry"
androidprv:digit="4"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key5"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/pukEntry"
androidprv:digit="5"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key6"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
androidprv:textView="@+id/pukEntry"
androidprv:digit="6"
/>
</LinearLayout>
<LinearLayout
- android:layout_width="match_parent"
+ 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"
>
<com.android.keyguard.NumPadKey
android:id="@+id/key7"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/pukEntry"
androidprv:digit="7"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key8"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/pukEntry"
androidprv:digit="8"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key9"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
androidprv:textView="@+id/pukEntry"
androidprv:digit="9"
/>
</LinearLayout>
<LinearLayout
- android:layout_width="match_parent"
+ 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="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
android:contentDescription="@string/keyboardview_keycode_delete"
style="@style/NumPadKey.Delete"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key0"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_marginEnd="@dimen/num_pad_key_margin_end"
androidprv:textView="@+id/pukEntry"
androidprv:digit="0"
/>
<com.android.keyguard.NumPadButton
android:id="@+id/key_enter"
- android:layout_width="0px"
+ android:layout_width="@dimen/num_pad_key_width"
android:layout_height="match_parent"
- android:layout_weight="1"
style="@style/NumPadKey.Enter"
android:contentDescription="@string/keyboardview_keycode_enter"
/>
diff --git a/packages/SystemUI/res-keyguard/values-sw360dp/dimens.xml b/packages/SystemUI/res-keyguard/values-sw360dp/dimens.xml
new file mode 100644
index 0000000..be39030
--- /dev/null
+++ b/packages/SystemUI/res-keyguard/values-sw360dp/dimens.xml
@@ -0,0 +1,24 @@
+<?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>
+ <!-- Spacing around each button used for PIN view -->
+ <dimen name="num_pad_key_width">84dp</dimen>
+ <dimen name="num_pad_row_margin_bottom">12dp</dimen>
+ <dimen name="num_pad_key_margin_end">20dp</dimen>
+</resources>
diff --git a/packages/SystemUI/res-keyguard/values/dimens.xml b/packages/SystemUI/res-keyguard/values/dimens.xml
index 115a156..07bd2e6 100644
--- a/packages/SystemUI/res-keyguard/values/dimens.xml
+++ b/packages/SystemUI/res-keyguard/values/dimens.xml
@@ -38,7 +38,7 @@
<!-- Margin around the various security views -->
<dimen name="keyguard_security_view_top_margin">8dp</dimen>
- <dimen name="keyguard_security_view_lateral_margin">36dp</dimen>
+ <dimen name="keyguard_security_view_lateral_margin">20dp</dimen>
<dimen name="keyguard_eca_top_margin">18dp</dimen>
@@ -87,5 +87,7 @@
<dimen name="disappear_y_translation">-32dp</dimen>
<!-- Spacing around each button used for PIN view -->
- <dimen name="num_pad_key_margin">2dp</dimen>
+ <dimen name="num_pad_key_width">72dp</dimen>
+ <dimen name="num_pad_row_margin_bottom">6dp</dimen>
+ <dimen name="num_pad_key_margin_end">12dp</dimen>
</resources>
diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java b/packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java
index 14b9691..6cee4a4 100644
--- a/packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java
+++ b/packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java
@@ -24,7 +24,6 @@
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.RippleDrawable;
import android.view.ContextThemeWrapper;
-import android.view.ViewGroup;
import androidx.annotation.StyleRes;
@@ -41,7 +40,6 @@
private GradientDrawable mBackground;
private RippleDrawable mRipple;
private GradientDrawable mRippleMask;
- private int mMargin;
private int mNormalColor;
private int mHighlightColor;
private int mStyle;
@@ -55,8 +53,6 @@
reloadColors(context);
- mMargin = context.getResources().getDimensionPixelSize(R.dimen.num_pad_key_margin);
-
// Actual values will be updated later, usually during an onLayout() call
mAnimator = new AnimatorSet();
mExpandAnimator = ValueAnimator.ofFloat(0f, 1f);
@@ -82,10 +78,6 @@
mAnimator.playSequentially(mExpandAnimator, mContractAnimator);
}
- void updateMargin(ViewGroup.MarginLayoutParams lp) {
- lp.setMargins(mMargin, mMargin, mMargin, mMargin);
- }
-
void onLayout(int height) {
float startRadius = height / 2f;
float endRadius = height / 4f;
diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadButton.java b/packages/SystemUI/src/com/android/keyguard/NumPadButton.java
index 1635c49..b76499a 100644
--- a/packages/SystemUI/src/com/android/keyguard/NumPadButton.java
+++ b/packages/SystemUI/src/com/android/keyguard/NumPadButton.java
@@ -23,7 +23,6 @@
import android.util.AttributeSet;
import android.view.ContextThemeWrapper;
import android.view.MotionEvent;
-import android.view.ViewGroup;
import androidx.annotation.Nullable;
@@ -51,13 +50,6 @@
}
@Override
- public void setLayoutParams(ViewGroup.LayoutParams params) {
- if (mAnimator != null) mAnimator.updateMargin((ViewGroup.MarginLayoutParams) params);
-
- super.setLayoutParams(params);
- }
-
- @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
index 96fceee..89c1a7f 100644
--- a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
+++ b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
@@ -178,13 +178,6 @@
}
@Override
- public void setLayoutParams(ViewGroup.LayoutParams params) {
- if (mAnimator != null) mAnimator.updateMargin((ViewGroup.MarginLayoutParams) params);
-
- super.setLayoutParams(params);
- }
-
- @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
measureChildren(widthMeasureSpec, heightMeasureSpec);