From 7cbb8708b9737ec461ba692dffb499caadc95917 Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Tue, 16 Mar 2021 09:00:31 -0400 Subject: [PATCH] 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 --- .../res-keyguard/layout/keyguard_pin_view.xml | 59 +++++++++--------- .../layout/keyguard_sim_pin_view.xml | 59 +++++++++--------- .../layout/keyguard_sim_puk_view.xml | 60 ++++++++++--------- .../res-keyguard/values-sw360dp/dimens.xml | 24 ++++++++ .../SystemUI/res-keyguard/values/dimens.xml | 6 +- .../com/android/keyguard/NumPadAnimator.java | 8 --- .../com/android/keyguard/NumPadButton.java | 8 --- .../src/com/android/keyguard/NumPadKey.java | 7 --- 8 files changed, 122 insertions(+), 109 deletions(-) create mode 100644 packages/SystemUI/res-keyguard/values-sw360dp/dimens.xml diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml index 6ae759c66bea0..50ffbc802a7d0 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 @@ 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 f709424a7d12d..297c20ef8d6d6 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 @@ /> 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 2f9fed610f1db..388919e6d81cd 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 @@ /> 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 0000000000000..be39030451f4c --- /dev/null +++ b/packages/SystemUI/res-keyguard/values-sw360dp/dimens.xml @@ -0,0 +1,24 @@ + + + + + 84dp + 12dp + 20dp + diff --git a/packages/SystemUI/res-keyguard/values/dimens.xml b/packages/SystemUI/res-keyguard/values/dimens.xml index 115a156b65e71..07bd2e6f05055 100644 --- a/packages/SystemUI/res-keyguard/values/dimens.xml +++ b/packages/SystemUI/res-keyguard/values/dimens.xml @@ -38,7 +38,7 @@ 8dp - 36dp + 20dp 18dp @@ -87,5 +87,7 @@ -32dp - 2dp + 72dp + 6dp + 12dp diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java b/packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java index 14b96913ea49a..6cee4a4d4ad76 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.GradientDrawable; 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 @@ class NumPadAnimator { 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 @@ class NumPadAnimator { 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 @@ class NumPadAnimator { 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 1635c49b56683..b76499a39ff8f 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.graphics.drawable.VectorDrawable; import android.util.AttributeSet; import android.view.ContextThemeWrapper; import android.view.MotionEvent; -import android.view.ViewGroup; import androidx.annotation.Nullable; @@ -50,13 +49,6 @@ public class NumPadButton extends AlphaOptimizedImageButton { } } - @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 96fceeeb83976..89c1a7fe21caf 100644 --- a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java +++ b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java @@ -177,13 +177,6 @@ public class NumPadKey extends ViewGroup { return super.onTouchEvent(event); } - @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);