Polish FingerprintDialog

Bug: 73818869

Test: dialog matches spec
Change-Id: Ibba456e656559ffbebf1bcae79480ce91772572f
diff --git a/packages/SystemUI/res/drawable/fingerprint_dialog_bg.xml b/packages/SystemUI/res/drawable/fingerprint_dialog_bg.xml
new file mode 100644
index 0000000..221f170
--- /dev/null
+++ b/packages/SystemUI/res/drawable/fingerprint_dialog_bg.xml
@@ -0,0 +1,26 @@
+<?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
+  -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <solid android:color="@color/fingerprint_dialog_bg_color" />
+    <corners android:radius="1dp"
+        android:topLeftRadius="@dimen/fingerprint_dialog_corner_size"
+        android:topRightRadius="@dimen/fingerprint_dialog_corner_size"
+        android:bottomLeftRadius="0dp"
+        android:bottomRightRadius="0dp"/>
+</shape>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/fingerprint_dialog.xml b/packages/SystemUI/res/layout/fingerprint_dialog.xml
index f02c0ba..1b47489 100644
--- a/packages/SystemUI/res/layout/fingerprint_dialog.xml
+++ b/packages/SystemUI/res/layout/fingerprint_dialog.xml
@@ -35,7 +35,7 @@
         android:layout_height="wrap_content"
         android:orientation="vertical"
         android:elevation="2dp"
-        android:background="@color/fingerprint_dialog_bg_color">
+        android:background="@drawable/fingerprint_dialog_bg">
 
         <TextView
             android:id="@+id/title"
@@ -45,7 +45,7 @@
             android:layout_marginEnd="24dp"
             android:layout_marginStart="24dp"
             android:layout_marginTop="24dp"
-            android:gravity="center"
+            android:gravity="@integer/fingerprint_dialog_text_gravity"
             android:textSize="20sp"
             android:maxLines="1"
             android:singleLine="true"
@@ -57,16 +57,16 @@
             android:id="@+id/subtitle"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginTop="12dp"
+            android:layout_marginTop="8dp"
             android:layout_marginStart="24dp"
             android:layout_marginEnd="24dp"
-            android:gravity="center_horizontal"
-            android:textSize="14sp"
+            android:gravity="@integer/fingerprint_dialog_text_gravity"
+            android:textSize="16sp"
             android:maxLines="1"
             android:singleLine="true"
             android:ellipsize="marquee"
             android:marqueeRepeatLimit="marquee_forever"
-            android:textColor="@color/fingerprint_dialog_text_light_color"/>
+            android:textColor="@color/fingerprint_dialog_text_dark_color"/>
 
         <TextView
             android:id="@+id/description"
@@ -74,7 +74,8 @@
             android:layout_height="wrap_content"
             android:layout_marginEnd="24dp"
             android:layout_marginStart="24dp"
-            android:paddingTop="24dp"
+            android:gravity="@integer/fingerprint_dialog_text_gravity"
+            android:paddingTop="8dp"
             android:textSize="16sp"
             android:maxLines="4"
             android:textColor="@color/fingerprint_dialog_text_dark_color"/>
@@ -84,7 +85,7 @@
             android:layout_width="@dimen/fingerprint_dialog_fp_icon_size"
             android:layout_height="@dimen/fingerprint_dialog_fp_icon_size"
             android:layout_gravity="center_horizontal"
-            android:layout_marginTop="32dp"
+            android:layout_marginTop="48dp"
             android:scaleType="fitXY"
             android:contentDescription="@string/accessibility_fingerprint_dialog_fingerprint_icon" />
 
@@ -106,7 +107,7 @@
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="72dip"
-            android:paddingTop="16dp"
+            android:paddingTop="24dp"
             android:layout_gravity="center_vertical"
             style="?android:attr/buttonBarStyle"
             android:orientation="horizontal"
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index e2a94df..5b038b1 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -160,12 +160,12 @@
     <color name="smart_reply_button_background">#fff2f2f2</color>
 
     <!-- Fingerprint dialog colors -->
-    <color name="fingerprint_dialog_bg_color">#f4ffffff</color> <!-- 96% white -->
-    <color name="fingerprint_dialog_text_dark_color">#ff212121</color>
-    <color name="fingerprint_dialog_text_light_color">#ff757575</color>
+    <color name="fingerprint_dialog_bg_color">#ffffffff</color> <!-- 100% white -->
+    <color name="fingerprint_dialog_text_dark_color">#dd000000</color> <!-- 87% black -->
+    <color name="fingerprint_dialog_text_light_color">#89000000</color> <!-- 54% black -->
     <color name="fingerprint_dialog_dim_color">#80000000</color> <!-- 50% black -->
-    <color name="fingerprint_dialog_error_message_color">#ffff5722</color>
-    <color name="fingerprint_dialog_fingerprint_color">#ff009688</color>
+    <color name="fingerprint_dialog_error_message_color">#ffd93025</color> <!-- google red 600 -->
+    <color name="fingerprint_dialog_fingerprint_color">#ff008577</color> <!-- google blue 600 -->
 
     <!-- Logout button -->
     <color name="logout_button_bg_color">#ccffffff</color>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 7b1a9e1..702b4e1 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -906,8 +906,9 @@
     <dimen name="smart_reply_button_line_spacing_extra">6sp</dimen> <!-- Total line height 20sp. -->
 
     <!-- Fingerprint Dialog values -->
-    <dimen name="fingerprint_dialog_fp_icon_size">60dp</dimen>
+    <dimen name="fingerprint_dialog_fp_icon_size">64dp</dimen>
     <dimen name="fingerprint_dialog_animation_translation_offset">350dp</dimen>
+    <dimen name="fingerprint_dialog_corner_size">2dp</dimen>
 
     <!-- Wireless Charging Animation values -->
     <dimen name="wireless_charging_dots_radius_start">0dp</dimen>
diff --git a/packages/SystemUI/res/values/integers.xml b/packages/SystemUI/res/values/integers.xml
new file mode 100644
index 0000000..8f23283
--- /dev/null
+++ b/packages/SystemUI/res/values/integers.xml
@@ -0,0 +1,19 @@
+<?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
+  -->
+<resources>
+    <integer name="fingerprint_dialog_text_gravity">8388611</integer> <!-- gravity start -->
+</resources>
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogImpl.java b/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogImpl.java
index 1d43b1d..4b15fbc 100644
--- a/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogImpl.java
@@ -180,8 +180,8 @@
             }
         }
         mReceiver = null;
-        mWindowManager.removeView(mDialogView);
         mDialogShowing = false;
+        mDialogView.startDismiss();
     }
 
     private void handleButtonNegative() {
diff --git a/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogView.java b/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogView.java
index e828b2c..37e1936 100644
--- a/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogView.java
+++ b/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogView.java
@@ -61,7 +61,7 @@
 
     private final IBinder mWindowToken = new Binder();
     private final Interpolator mLinearOutSlowIn;
-    private final Interpolator mFastOutLinearIn;
+    private final WindowManager mWindowManager;
     private final float mAnimationTranslationOffset;
     private final int mErrorTextColor;
     private final int mTextColor;
@@ -78,7 +78,7 @@
         super(context);
         mHandler = handler;
         mLinearOutSlowIn = Interpolators.LINEAR_OUT_SLOW_IN;
-        mFastOutLinearIn = Interpolators.FAST_OUT_LINEAR_IN;
+        mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
         mAnimationTranslationOffset = getResources()
                 .getDimension(R.dimen.fingerprint_dialog_animation_translation_offset);
         mErrorTextColor = Color.parseColor(
@@ -189,6 +189,34 @@
         });
     }
 
+    public void startDismiss() {
+        final Runnable endActionRunnable = new Runnable() {
+            @Override
+            public void run() {
+                mWindowManager.removeView(FingerprintDialogView.this);
+            }
+        };
+
+        postOnAnimation(new Runnable() {
+            @Override
+            public void run() {
+                mLayout.animate()
+                        .alpha(0f)
+                        .setDuration(ANIMATION_DURATION)
+                        .setInterpolator(mLinearOutSlowIn)
+                        .withLayer()
+                        .start();
+                mDialog.animate()
+                        .translationY(mAnimationTranslationOffset)
+                        .setDuration(ANIMATION_DURATION)
+                        .setInterpolator(mLinearOutSlowIn)
+                        .withLayer()
+                        .withEndAction(endActionRunnable)
+                        .start();
+            }
+        });
+    }
+
     public void setBundle(Bundle bundle) {
         mBundle = bundle;
     }