OSDN Git Service

Address visual inconsistency in smart replies
authorMilo Sredkov <miloslav@google.com>
Thu, 12 Apr 2018 11:52:43 +0000 (12:52 +0100)
committerMilo Sredkov <miloslav@google.com>
Sat, 14 Apr 2018 19:39:08 +0000 (19:39 +0000)
Address the major style differences and make the smart reply buttons
fit better with the other notification UI elements.

This CL does not yet address all the isues but removes the most
obvious inconsistencies.

Screenshot before: https://screenshot.googleplex.com/90QVvxJmUJ3.png
Screenshot after: https://screenshot.googleplex.com/2C8cMQgTVBG.png

Bug: 73605520
Test: In Notify post a Messaging notification with Large chices

Change-Id: Ide285c21c7bf83e9f06ade6912fd13cb3e4b9024

packages/SystemUI/res/drawable/smart_reply_button_background.xml
packages/SystemUI/res/layout/smart_reply_button.xml
packages/SystemUI/res/layout/smart_reply_view.xml
packages/SystemUI/res/values/colors.xml
packages/SystemUI/res/values/dimens.xml
packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java

index c5ac67b..c464ba6 100644 (file)
 <ripple xmlns:android="http://schemas.android.com/apk/res/android"
         android:color="@color/notification_ripple_untinted_color">
     <item>
-        <shape android:shape="rectangle">
-            <!-- Use non-zero corner radius to work around b/73285195. The actual corner radius is
-                 set dynamically at runtime in SmartReplyView. -->
-            <corners android:radius="1dp"/>
-            <solid android:color="@color/smart_reply_button_background"/>
-        </shape>
+        <inset
+            android:insetLeft="0dp"
+            android:insetTop="7dp"
+            android:insetRight="0dp"
+            android:insetBottom="5dp">
+            <shape android:shape="rectangle">
+                <corners android:radius="8dp" />
+                <stroke android:width="1dp" android:color="@color/smart_reply_button_stroke" />
+                <solid android:color="@color/smart_reply_button_background"/>
+            </shape>
+        </inset>
     </item>
 </ripple>
index 3c6edcd..98e6e82 100644 (file)
@@ -18,7 +18,7 @@
 
 <!-- android:paddingHorizontal is set dynamically in SmartReplyView. -->
 <Button xmlns:android="http://schemas.android.com/apk/res/android"
-        style="@android:style/Widget.Material.Button.Borderless.Small"
+        style="@android:style/Widget.Material.Button"
         android:layout_width="wrap_content"
         android:layout_height="match_parent"
         android:minWidth="0dp"
@@ -26,9 +26,9 @@
         android:paddingVertical="@dimen/smart_reply_button_padding_vertical"
         android:background="@drawable/smart_reply_button_background"
         android:gravity="center"
-        android:fontFamily="sans-serif"
+        android:fontFamily="sans-serif-medium"
         android:textSize="@dimen/smart_reply_button_font_size"
         android:lineSpacingExtra="@dimen/smart_reply_button_line_spacing_extra"
         android:textColor="@color/smart_reply_button_text"
         android:textStyle="normal"
-        android:ellipsize="none"/>
\ No newline at end of file
+        android:ellipsize="none"/>
index 6f21787..9b2dd95 100644 (file)
@@ -23,8 +23,9 @@
     android:id="@+id/smart_reply_view"
     android:layout_height="wrap_content"
     android:layout_width="wrap_content"
+    android:layout_marginStart="12dp"
     systemui:spacing="@dimen/smart_reply_button_spacing"
     systemui:singleLineButtonPaddingHorizontal="@dimen/smart_reply_button_padding_horizontal_single_line"
     systemui:doubleLineButtonPaddingHorizontal="@dimen/smart_reply_button_padding_horizontal_double_line">
     <!-- smart_reply_button(s) will be added here. -->
-</com.android.systemui.statusbar.policy.SmartReplyView>
\ No newline at end of file
+</com.android.systemui.statusbar.policy.SmartReplyView>
index 3c1f995..fd25c40 100644 (file)
 
     <color name="zen_introduction">#ffffffff</color>
 
-    <color name="smart_reply_button_text">#de000000</color> <!-- 87% black -->
-    <color name="smart_reply_button_background">#fff2f2f2</color>
+    <color name="smart_reply_button_text">#5F6368</color>
+    <color name="smart_reply_button_background">#feffffff</color>
+    <color name="smart_reply_button_stroke">#ffdadce0</color>
 
     <!-- Fingerprint dialog colors -->
     <color name="fingerprint_dialog_bg_color">#ffffffff</color> <!-- 100% white -->
index e6694e9..1e55eb3 100644 (file)
     <!-- Smart reply button -->
     <dimen name="smart_reply_button_spacing">8dp</dimen>
     <dimen name="smart_reply_button_padding_vertical">10dp</dimen>
-    <dimen name="smart_reply_button_padding_horizontal_single_line">12dp</dimen>
+    <dimen name="smart_reply_button_padding_horizontal_single_line">16dp</dimen>
     <dimen name="smart_reply_button_padding_horizontal_double_line">16dp</dimen>
-    <dimen name="smart_reply_button_min_height">40dp</dimen>
+    <dimen name="smart_reply_button_min_height">32dp</dimen>
     <dimen name="smart_reply_button_font_size">14sp</dimen>
     <dimen name="smart_reply_button_line_spacing_extra">6sp</dimen> <!-- Total line height 20sp. -->
 
index 6d2f5ce..4d86ae9 100644 (file)
@@ -299,8 +299,8 @@ public class SmartReplyView extends ViewGroup {
         // We're done squeezing buttons, so we can clear the priority queue.
         mCandidateButtonQueueForSqueezing.clear();
 
-        // Finally, we need to update corner radius and re-measure some buttons.
-        updateCornerRadiusAndRemeasureButtonsIfNecessary(buttonPaddingHorizontal, maxChildHeight);
+        // Finally, we need to re-measure some buttons.
+        remeasureButtonsIfNecessary(buttonPaddingHorizontal, maxChildHeight);
 
         setMeasuredDimension(
                 resolveSize(Math.max(getSuggestedMinimumWidth(), measuredWidth), widthMeasureSpec),
@@ -412,9 +412,8 @@ public class SmartReplyView extends ViewGroup {
         }
     }
 
-    private void updateCornerRadiusAndRemeasureButtonsIfNecessary(
+    private void remeasureButtonsIfNecessary(
             int buttonPaddingHorizontal, int maxChildHeight) {
-        final float cornerRadius = ((float) maxChildHeight) / 2;
         final int maxChildHeightMeasure =
                 MeasureSpec.makeMeasureSpec(maxChildHeight, MeasureSpec.EXACTLY);
 
@@ -426,11 +425,6 @@ public class SmartReplyView extends ViewGroup {
                 continue;
             }
 
-            // Update corner radius.
-            GradientDrawable backgroundDrawable =
-                    (GradientDrawable) ((RippleDrawable) child.getBackground()).getDrawable(0);
-            backgroundDrawable.setCornerRadius(cornerRadius);
-
             boolean requiresNewMeasure = false;
             int newWidth = child.getMeasuredWidth();