Revert "Bouncer - New PIN animations"
This reverts commit 5a1c26ea2996ba383af99d90fcf3c241d6be816b.
Reason for revert: b/178412096
Bug: 178412096
Change-Id: Ifc1626f2d4948e5956f8cf3c9b1411787ae01a98
(cherry picked from commit 6b587715388a27e2313a9ff92f6460aec8e3a396)
diff --git a/packages/SystemUI/res-keyguard/drawable/ic_keyboard_tab_36dp.xml b/packages/SystemUI/res-keyguard/drawable/ic_keyboard_tab_36dp.xml
index b844515..21c9051 100644
--- a/packages/SystemUI/res-keyguard/drawable/ic_keyboard_tab_36dp.xml
+++ b/packages/SystemUI/res-keyguard/drawable/ic_keyboard_tab_36dp.xml
@@ -13,13 +13,8 @@
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
-<vector
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:height="36sp"
- android:viewportHeight="36"
- android:viewportWidth="36"
- android:width="36sp">
- <path android:fillColor="?android:attr/colorBackground"
- android:pathData="M17.59,13.41L21.17,17H7v2h14.17l-3.59,3.59L19,24l6,-6l-6,-6L17.59,
- 13.41zM26,12v12h2V12H26z"/>
-</vector>
+<vector android:height="36sp" android:viewportHeight="36"
+ android:viewportWidth="36" android:width="36sp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="?android:attr/colorAccent" android:pathData="M18,18m-18,0a18,18 0,1 1,36 0a18,18 0,1 1,-36 0"/>
+ <path android:fillColor="?android:attr/textColorPrimaryInverse" android:pathData="M17.59,13.41L21.17,17H7v2h14.17l-3.59,3.59L19,24l6,-6l-6,-6L17.59,13.41zM26,12v12h2V12H26z"/>
+</vector>
\ No newline at end of file
diff --git a/packages/SystemUI/res-keyguard/drawable/num_pad_key_background.xml b/packages/SystemUI/res-keyguard/drawable/num_pad_key_background.xml
deleted file mode 100644
index b7a9fafd..0000000
--- a/packages/SystemUI/res-keyguard/drawable/num_pad_key_background.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?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.
-*/
--->
-<shape
- xmlns:android="http://schemas.android.com/apk/res/android">
- <solid android:color="?android:attr/colorBackground" />
- <corners android:radius="10dp" />
-</shape>
diff --git a/packages/SystemUI/res-keyguard/drawable/pin_divider.xml b/packages/SystemUI/res-keyguard/drawable/pin_divider.xml
new file mode 100644
index 0000000..39104b5
--- /dev/null
+++ b/packages/SystemUI/res-keyguard/drawable/pin_divider.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2017 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
+ -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/pin_divider_color" />
+</shape>
\ No newline at end of file
diff --git a/packages/SystemUI/res-keyguard/drawable/ripple_drawable_pin.xml b/packages/SystemUI/res-keyguard/drawable/ripple_drawable_pin.xml
new file mode 100644
index 0000000..51c442a
--- /dev/null
+++ b/packages/SystemUI/res-keyguard/drawable/ripple_drawable_pin.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2018 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
+ -->
+
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="?android:attr/colorControlHighlight"
+ android:radius="40dp"/>
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_num_pad_key.xml b/packages/SystemUI/res-keyguard/layout/keyguard_num_pad_key.xml
index 411fea5..72591d4 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_num_pad_key.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_num_pad_key.xml
@@ -17,18 +17,15 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:id="@+id/digit_text"
- style="@style/Widget.TextView.NumPadKey.Digit"
+ style="@style/Widget.TextView.NumPadKey"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
- <!-- b/172360102: Setting visibility to gone for now, in order to see if there are many
- issues with removing the alpha characters. -->
<TextView
android:id="@+id/klondike_text"
style="@style/Widget.TextView.NumPadKey.Klondike"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:visibility="gone"
/>
</merge>
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml
index aa14645a..87c98d2 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml
@@ -24,6 +24,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
androidprv:layout_maxWidth="@dimen/keyguard_security_width"
+ androidprv:layout_maxHeight="@dimen/keyguard_security_max_height"
android:orientation="vertical"
>
<LinearLayout
@@ -33,34 +34,37 @@
android:orientation="vertical"
android:layout_weight="1"
android:layoutDirection="ltr"
- android:layout_marginBottom="8dp"
>
- <Space
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1"
- />
- <com.android.keyguard.AlphaOptimizedRelativeLayout
- android:id="@+id/row0"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingBottom="16dp"
- >
+ <com.android.keyguard.AlphaOptimizedRelativeLayout
+ android:id="@+id/row0"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:paddingBottom="16dp"
+ >
<com.android.keyguard.PasswordTextView
android:id="@+id/pinEntry"
android:layout_width="@dimen/keyguard_security_width"
- android:layout_height="@dimen/keyguard_password_height"
+ android:layout_height="match_parent"
style="@style/Widget.TextView.Password"
android:layout_centerHorizontal="true"
android:layout_marginRight="72dp"
androidprv:scaledTextSize="@integer/scaled_password_text_size"
android:contentDescription="@string/keyguard_accessibility_pin_area"
/>
+ <View
+ android:id="@+id/divider"
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:layout_alignParentBottom="true"
+ android:background="@drawable/pin_divider"
+ />
</com.android.keyguard.AlphaOptimizedRelativeLayout>
<LinearLayout
android:id="@+id/row1"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
+ android:layout_weight="1"
android:orientation="horizontal"
>
<com.android.keyguard.NumPadKey
@@ -91,7 +95,8 @@
<LinearLayout
android:id="@+id/row2"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
+ android:layout_weight="1"
android:orientation="horizontal"
>
<com.android.keyguard.NumPadKey
@@ -122,8 +127,9 @@
<LinearLayout
android:id="@+id/row3"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
android:orientation="horizontal"
+ android:layout_weight="1"
>
<com.android.keyguard.NumPadKey
android:id="@+id/key7"
@@ -153,16 +159,18 @@
<LinearLayout
android:id="@+id/row4"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
+ android:layout_weight="1"
android:orientation="horizontal"
>
- <com.android.keyguard.NumPadButton
+ <com.android.keyguard.AlphaOptimizedImageButton
android:id="@+id/delete_button"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
+ android:background="@drawable/ripple_drawable_pin"
android:contentDescription="@string/keyboardview_keycode_delete"
- style="@style/NumPadKey.Delete"
+ style="@style/Keyguard.ImageButton.NumPadDelete"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key0"
@@ -172,12 +180,13 @@
androidprv:textView="@+id/pinEntry"
androidprv:digit="0"
/>
- <com.android.keyguard.NumPadButton
+ <com.android.keyguard.AlphaOptimizedImageButton
android:id="@+id/key_enter"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
- style="@style/NumPadKey.Enter"
+ style="@style/Keyguard.ImageButton.NumPadEnter"
+ android:background="@drawable/ripple_drawable_pin"
android:contentDescription="@string/keyboardview_keycode_enter"
/>
</LinearLayout>
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 64ccefd..912d7bb 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml
@@ -25,14 +25,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
androidprv:layout_maxWidth="@dimen/keyguard_security_width"
+ androidprv:layout_maxHeight="@dimen/keyguard_security_max_height"
android:gravity="center_horizontal">
- <Space
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1"
- />
-
<ImageView
android:id="@+id/keyguard_sim"
android:layout_width="match_parent"
@@ -42,9 +37,10 @@
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
android:orientation="vertical"
android:gravity="center"
+ android:layout_weight="1"
android:layoutDirection="ltr"
>
<include layout="@layout/keyguard_esim_area"
@@ -56,23 +52,32 @@
<RelativeLayout
android:id="@+id/row0"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
+ android:layout_weight="1"
android:paddingBottom="16dp"
>
<com.android.keyguard.PasswordTextView
android:id="@+id/simPinEntry"
android:layout_width="@dimen/keyguard_security_width"
- android:layout_height="@dimen/keyguard_password_height"
+ android:layout_height="match_parent"
android:gravity="center"
android:layout_centerHorizontal="true"
android:layout_marginRight="72dp"
androidprv:scaledTextSize="@integer/scaled_password_text_size"
android:contentDescription="@string/keyguard_accessibility_sim_pin_area"
/>
+ <View
+ android:id="@+id/divider"
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:layout_alignParentBottom="true"
+ android:background="@drawable/pin_divider"
+ />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
+ android:layout_weight="1"
android:orientation="horizontal"
>
<com.android.keyguard.NumPadKey
@@ -102,7 +107,8 @@
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
+ android:layout_weight="1"
android:orientation="horizontal"
>
<com.android.keyguard.NumPadKey
@@ -132,8 +138,9 @@
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
android:orientation="horizontal"
+ android:layout_weight="1"
>
<com.android.keyguard.NumPadKey
android:id="@+id/key7"
@@ -162,16 +169,18 @@
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
+ android:layout_weight="1"
android:orientation="horizontal"
>
- <com.android.keyguard.NumPadButton
+ <com.android.keyguard.AlphaOptimizedImageButton
android:id="@+id/delete_button"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
+ android:background="@drawable/ripple_drawable_pin"
android:contentDescription="@string/keyboardview_keycode_delete"
- style="@style/NumPadKey.Delete"
+ style="@style/Keyguard.ImageButton.NumPadDelete"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key0"
@@ -181,12 +190,13 @@
androidprv:textView="@+id/simPinEntry"
androidprv:digit="0"
/>
- <com.android.keyguard.NumPadButton
+ <com.android.keyguard.AlphaOptimizedImageButton
android:id="@+id/key_enter"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
- style="@style/NumPadKey.Enter"
+ style="@style/Keyguard.ImageButton.NumPadEnter"
+ android:background="@drawable/ripple_drawable_pin"
android:contentDescription="@string/keyboardview_keycode_enter"
/>
</LinearLayout>
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 dc77bd3..81b4964 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml
@@ -26,14 +26,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
androidprv:layout_maxWidth="@dimen/keyguard_security_width"
+ androidprv:layout_maxHeight="@dimen/keyguard_security_max_height"
android:gravity="center_horizontal">
- <Space
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1"
- />
-
<ImageView
android:id="@+id/keyguard_sim"
android:layout_width="match_parent"
@@ -43,7 +38,7 @@
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
android:orientation="vertical"
android:gravity="center"
android:layout_weight="1"
@@ -58,23 +53,32 @@
<RelativeLayout
android:id="@+id/row0"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
+ android:layout_weight="1"
android:paddingBottom="16dp"
>
<com.android.keyguard.PasswordTextView
android:id="@+id/pukEntry"
android:layout_width="@dimen/keyguard_security_width"
- android:layout_height="@dimen/keyguard_password_height"
+ android:layout_height="match_parent"
android:gravity="center"
android:layout_centerHorizontal="true"
android:layout_marginRight="72dp"
androidprv:scaledTextSize="@integer/scaled_password_text_size"
android:contentDescription="@string/keyguard_accessibility_sim_puk_area"
/>
+ <View
+ android:id="@+id/divider"
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:layout_alignParentBottom="true"
+ android:background="@drawable/pin_divider"
+ />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
+ android:layout_weight="1"
android:orientation="horizontal"
>
<com.android.keyguard.NumPadKey
@@ -104,7 +108,8 @@
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
+ android:layout_weight="1"
android:orientation="horizontal"
>
<com.android.keyguard.NumPadKey
@@ -134,8 +139,9 @@
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
android:orientation="horizontal"
+ android:layout_weight="1"
>
<com.android.keyguard.NumPadKey
android:id="@+id/key7"
@@ -164,16 +170,18 @@
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
+ android:layout_weight="1"
android:orientation="horizontal"
>
- <com.android.keyguard.NumPadButton
+ <com.android.keyguard.AlphaOptimizedImageButton
android:id="@+id/delete_button"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
+ android:background="@drawable/ripple_drawable_pin"
android:contentDescription="@string/keyboardview_keycode_delete"
- style="@style/NumPadKey.Delete"
+ style="@style/Keyguard.ImageButton.NumPadDelete"
/>
<com.android.keyguard.NumPadKey
android:id="@+id/key0"
@@ -183,12 +191,13 @@
androidprv:textView="@+id/pukEntry"
androidprv:digit="0"
/>
- <com.android.keyguard.NumPadButton
+ <com.android.keyguard.AlphaOptimizedImageButton
android:id="@+id/key_enter"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
- style="@style/NumPadKey.Enter"
+ style="@style/Keyguard.ImageButton.NumPadEnter"
+ android:background="@drawable/ripple_drawable_pin"
android:contentDescription="@string/keyboardview_keycode_enter"
/>
</LinearLayout>
diff --git a/packages/SystemUI/res-keyguard/values/attrs.xml b/packages/SystemUI/res-keyguard/values/attrs.xml
index eb7a1f7..bfcc56c 100644
--- a/packages/SystemUI/res-keyguard/values/attrs.xml
+++ b/packages/SystemUI/res-keyguard/values/attrs.xml
@@ -40,8 +40,6 @@
<attr name="passwordStyle" format="reference" />
- <attr name="numPadKeyStyle" format="reference" />
-
<declare-styleable name="AnimatableClockView">
<attr name="dozeWeight" format="integer" />
<attr name="lockScreenWeight" format="integer" />
diff --git a/packages/SystemUI/res-keyguard/values/dimens.xml b/packages/SystemUI/res-keyguard/values/dimens.xml
index aa87107..f9389ce 100644
--- a/packages/SystemUI/res-keyguard/values/dimens.xml
+++ b/packages/SystemUI/res-keyguard/values/dimens.xml
@@ -33,9 +33,6 @@
(includes 2x keyguard_security_view_top_margin) -->
<dimen name="keyguard_security_max_height">450dp</dimen>
- <!-- pin/password field max height -->
- <dimen name="keyguard_password_height">80dp</dimen>
-
<!-- Margin around the various security views -->
<dimen name="keyguard_security_view_top_margin">8dp</dimen>
<dimen name="keyguard_security_view_lateral_margin">36dp</dimen>
@@ -84,7 +81,4 @@
<!-- The translation for disappearing security views after having solved them. -->
<dimen name="disappear_y_translation">-32dp</dimen>
-
- <!-- Spacing around each button used for PIN view -->
- <dimen name="num_pad_key_margin">2dp</dimen>
</resources>
diff --git a/packages/SystemUI/res-keyguard/values/styles.xml b/packages/SystemUI/res-keyguard/values/styles.xml
index 2e99dea..71a1cc2 100644
--- a/packages/SystemUI/res-keyguard/values/styles.xml
+++ b/packages/SystemUI/res-keyguard/values/styles.xml
@@ -30,13 +30,7 @@
<item name="android:paddingLeft">12dp</item>
<item name="android:paddingRight">12dp</item>
</style>
- <style name="NumPadKey" parent="Theme.SystemUI">
- <item name="android:colorControlNormal">?android:attr/colorBackground</item>
- <item name="android:colorControlHighlight">?android:attr/colorAccent</item>
- <item name="android:background">@drawable/num_pad_key_background</item>
- </style>
- <style name="Widget.TextView.NumPadKey.Digit"
- parent="@android:style/Widget.DeviceDefault.TextView">
+ <style name="Widget.TextView.NumPadKey" parent="@android:style/Widget.DeviceDefault.TextView">
<item name="android:singleLine">true</item>
<item name="android:gravity">center_horizontal|center_vertical</item>
<item name="android:background">@null</item>
@@ -44,25 +38,26 @@
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
<item name="android:paddingBottom">-16dp</item>
+ <item name="android:colorControlHighlight">?android:attr/textColorPrimary</item>
</style>
<style name="Widget.TextView.Password" parent="@android:style/Widget.TextView">
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
<item name="android:gravity">center</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
- <style name="NumPadKey.Delete">
+ <style name="Keyguard.ImageButton.NumPadDelete" parent="@android:style/Widget.DeviceDefault.ImageButton">
<item name="android:src">@drawable/ic_backspace_black_24dp</item>
+ <item name="android:paddingBottom">11sp</item>
<item name="android:tint">?android:attr/textColorSecondary</item>
<item name="android:tintMode">src_in</item>
+ <item name="android:src">@drawable/ic_backspace_black_24dp</item>
</style>
- <style name="NumPadKey.Enter">
- <item name="android:colorControlNormal">?android:attr/textColorSecondary</item>
- <item name="android:src">@drawable/ic_keyboard_tab_36dp</item>
+ <style name="Keyguard.ImageButton.NumPadEnter" parent="@android:style/Widget.DeviceDefault.ImageButton">
+ <item name="android:src">@drawable/ic_keyboard_tab_36dp</item>
+ <item name="android:paddingBottom">11sp</item>
</style>
- <style name="Widget.TextView.NumPadKey.Klondike"
- parent="@android:style/Widget.DeviceDefault.TextView">
+ <style name="Widget.TextView.NumPadKey.Klondike">
<item name="android:textSize">12sp</item>
- <item name="android:background">@null</item>
<item name="android:fontFamily">@*android:string/config_bodyFontFamily</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
<item name="android:paddingBottom">0dp</item>
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index db260ce..d706ec2 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -319,7 +319,6 @@
<item name="android:colorControlHighlight">@*android:color/primary_text_material_dark</item>
<item name="*android:lockPatternStyle">@style/LockPatternStyle</item>
<item name="passwordStyle">@style/PasswordTheme</item>
- <item name="numPadKeyStyle">@style/NumPadKey</item>
<item name="backgroundProtectedStyle">@style/BackgroundProtectedStyle</item>
<item name="android:homeAsUpIndicator">@drawable/ic_arrow_back</item>
<item name="shadowRadius">@dimen/keyguard_shadow_radius</item>
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java
index 6a6b964..4ddfccb2 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java
@@ -27,8 +27,10 @@
import android.content.res.ColorStateList;
import android.graphics.Rect;
import android.util.AttributeSet;
+import android.view.ContextThemeWrapper;
import android.view.KeyEvent;
import android.view.View;
+import android.widget.ImageButton;
import com.android.internal.widget.LockscreenCredential;
import com.android.settingslib.Utils;
@@ -40,9 +42,10 @@
public abstract class KeyguardPinBasedInputView extends KeyguardAbsKeyInputView {
protected PasswordTextView mPasswordEntry;
- private NumPadButton mOkButton;
- private NumPadButton mDeleteButton;
+ private View mOkButton;
+ private ImageButton mDeleteButton;
private NumPadKey[] mButtons = new NumPadKey[10];
+ private View mDivider;
public KeyguardPinBasedInputView(Context context) {
this(context, null);
@@ -149,6 +152,7 @@
mDeleteButton = findViewById(R.id.delete_button);
mDeleteButton.setVisibility(View.VISIBLE);
+ mDivider = findViewById(R.id.divider);
mButtons[0] = findViewById(R.id.key0);
mButtons[1] = findViewById(R.id.key1);
@@ -177,9 +181,12 @@
int deleteColor = Utils.getColorAttr(getContext(), android.R.attr.textColorSecondary)
.getDefaultColor();
mDeleteButton.setImageTintList(ColorStateList.valueOf(deleteColor));
+ mDivider.setBackground(getContext().getDrawable(R.drawable.pin_divider));
- mDeleteButton.reloadColors();
- mOkButton.reloadColors();
+ ContextThemeWrapper themedContext = new ContextThemeWrapper(mContext,
+ R.style.Widget_TextView_NumPadKey);
+ mDeleteButton.setBackground(themedContext.getDrawable(R.drawable.ripple_drawable_pin));
+ mOkButton.setBackground(themedContext.getDrawable(R.drawable.ripple_drawable_pin));
}
@Override
diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java b/packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java
deleted file mode 100644
index cdf9858..0000000
--- a/packages/SystemUI/src/com/android/keyguard/NumPadAnimator.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-package com.android.keyguard;
-
-import android.animation.ValueAnimator;
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.drawable.GradientDrawable;
-import android.view.ContextThemeWrapper;
-import android.view.ViewGroup;
-
-import androidx.annotation.StyleRes;
-
-import com.android.internal.graphics.ColorUtils;
-import com.android.systemui.Interpolators;
-import com.android.systemui.R;
-
-/**
- * Provides background color and radius animations for key pad buttons.
- */
-class NumPadAnimator {
- private ValueAnimator mAnimator;
- private GradientDrawable mBackground;
- private int mMargin;
- private int mNormalColor;
- private int mHighlightColor;
- private int mStyle;
-
- NumPadAnimator(Context context, final GradientDrawable background, @StyleRes int style) {
- mBackground = (GradientDrawable) background.mutate();
- mStyle = style;
-
- reloadColors(context);
-
- mMargin = context.getResources().getDimensionPixelSize(R.dimen.num_pad_key_margin);
-
- // Actual values will be updated later, usually during an onLayout() call
- mAnimator = ValueAnimator.ofFloat(0f);
- mAnimator.setDuration(250);
- mAnimator.setInterpolator(Interpolators.LINEAR);
- mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
- public void onAnimationUpdate(ValueAnimator anim) {
- mBackground.setCornerRadius((float) anim.getAnimatedValue());
- mBackground.setColor(ColorUtils.blendARGB(mHighlightColor, mNormalColor,
- anim.getAnimatedFraction()));
- }
- });
-
- }
-
- void updateMargin(ViewGroup.MarginLayoutParams lp) {
- lp.setMargins(mMargin, mMargin, mMargin, mMargin);
- }
-
- void onLayout(int height) {
- float startRadius = height / 10f;
- float endRadius = height / 2f;
- mBackground.setCornerRadius(endRadius);
- mAnimator.setFloatValues(startRadius, endRadius);
- }
-
- void start() {
- mAnimator.cancel();
- mAnimator.start();
- }
-
- /**
- * Reload colors from resources.
- **/
- void reloadColors(Context context) {
- int[] customAttrs = {android.R.attr.colorControlNormal,
- android.R.attr.colorControlHighlight};
-
- ContextThemeWrapper ctw = new ContextThemeWrapper(context, mStyle);
- TypedArray a = ctw.obtainStyledAttributes(customAttrs);
- mNormalColor = a.getColor(0, 0);
- mHighlightColor = a.getColor(1, 0);
- a.recycle();
-
- mBackground.setColor(mNormalColor);
- }
-}
-
diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadButton.java b/packages/SystemUI/src/com/android/keyguard/NumPadButton.java
deleted file mode 100644
index 3728106..0000000
--- a/packages/SystemUI/src/com/android/keyguard/NumPadButton.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-package com.android.keyguard;
-
-import android.content.Context;
-import android.graphics.drawable.GradientDrawable;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.view.ViewGroup;
-
-/**
- * Similar to the {@link NumPadKey}, but displays an image.
- */
-public class NumPadButton extends AlphaOptimizedImageButton {
-
- private final NumPadAnimator mAnimator;
-
- public NumPadButton(Context context, AttributeSet attrs) {
- super(context, attrs);
-
- mAnimator = new NumPadAnimator(context, (GradientDrawable) getBackground(),
- attrs.getStyleAttribute());
- }
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- mAnimator.updateMargin((ViewGroup.MarginLayoutParams) getLayoutParams());
-
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
-
- // Set width/height to the same value to ensure a smooth circle for the bg
- setMeasuredDimension(getMeasuredWidth(), getMeasuredWidth());
- }
-
- @Override
- protected void onLayout(boolean changed, int l, int t, int r, int b) {
- super.onLayout(changed, l, t, r, b);
-
- mAnimator.onLayout(b - t);
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent event) {
- mAnimator.start();
- return super.onTouchEvent(event);
- }
-
- /**
- * Reload colors from resources.
- **/
- public void reloadColors() {
- mAnimator.reloadColors(getContext());
- }
-}
diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
index 756d610..a518205 100644
--- a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
+++ b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
@@ -18,10 +18,11 @@
import android.content.Context;
import android.content.res.TypedArray;
-import android.graphics.drawable.GradientDrawable;
+import android.graphics.drawable.Drawable;
import android.os.PowerManager;
import android.os.SystemClock;
import android.util.AttributeSet;
+import android.view.ContextThemeWrapper;
import android.view.HapticFeedbackConstants;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -47,8 +48,6 @@
private int mTextViewResId;
private PasswordTextView mTextView;
- private final NumPadAnimator mAnimator;
-
private View.OnClickListener mListener = new View.OnClickListener() {
@Override
public void onClick(View thisView) {
@@ -74,7 +73,7 @@
}
public NumPadKey(Context context, AttributeSet attrs) {
- this(context, attrs, R.attr.numPadKeyStyle);
+ this(context, attrs, 0);
}
public NumPadKey(Context context, AttributeSet attrs, int defStyle) {
@@ -85,8 +84,7 @@
super(context, attrs, defStyle);
setFocusable(true);
- TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.NumPadKey, defStyle,
- contentResource);
+ TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.NumPadKey);
try {
mDigit = a.getInt(R.styleable.NumPadKey_digit, mDigit);
@@ -118,16 +116,20 @@
final int len = klondike.length();
if (len > 0) {
mKlondikeText.setText(klondike);
- } else if (mKlondikeText.getVisibility() != View.GONE) {
+ } else {
mKlondikeText.setVisibility(View.INVISIBLE);
}
}
}
+ a = context.obtainStyledAttributes(attrs, android.R.styleable.View);
+ if (!a.hasValueOrEmpty(android.R.styleable.View_background)) {
+ Drawable rippleDrawable = new ContextThemeWrapper(mContext,
+ R.style.Widget_TextView_NumPadKey).getDrawable(R.drawable.ripple_drawable_pin);
+ setBackground(rippleDrawable);
+ }
+ a.recycle();
setContentDescription(mDigitText.getText().toString());
-
- mAnimator = new NumPadAnimator(context, (GradientDrawable) getBackground(),
- R.style.NumPadKey);
}
/**
@@ -140,8 +142,9 @@
.getDefaultColor();
mDigitText.setTextColor(textColor);
mKlondikeText.setTextColor(klondikeColor);
-
- mAnimator.reloadColors(getContext());
+ Drawable rippleDrawable = new ContextThemeWrapper(mContext,
+ R.style.Widget_TextView_NumPadKey).getDrawable(R.drawable.ripple_drawable_pin);
+ setBackground(rippleDrawable);
}
@Override
@@ -149,26 +152,13 @@
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
doHapticKeyClick();
}
-
- mAnimator.start();
-
return super.onTouchEvent(event);
}
@Override
- public void setLayoutParams(ViewGroup.LayoutParams params) {
- mAnimator.updateMargin((ViewGroup.MarginLayoutParams) params);
-
- super.setLayoutParams(params);
- }
-
- @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
measureChildren(widthMeasureSpec, heightMeasureSpec);
-
- // Set width/height to the same value to ensure a smooth circle for the bg
- setMeasuredDimension(getMeasuredWidth(), getMeasuredWidth());
}
@Override
@@ -186,8 +176,6 @@
left = centerX - mKlondikeText.getMeasuredWidth() / 2;
mKlondikeText.layout(left, top, left + mKlondikeText.getMeasuredWidth(), bottom);
-
- mAnimator.onLayout(b - t);
}
@Override