Merge "New, inkier EdgeEffect visual style"
diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml
index 56c0e10..f045da4 100644
--- a/packages/SystemUI/res/layout/status_bar_expanded.xml
+++ b/packages/SystemUI/res/layout/status_bar_expanded.xml
@@ -50,9 +50,8 @@
         />
 
     <com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer
+        style="@style/NotificationsQuickSettings"
         android:id="@+id/notification_container_parent"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
         android:clipToPadding="false"
         android:clipChildren="false">
 
@@ -89,13 +88,7 @@
 
     </com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer>
 
-
-    <include layout="@layout/status_bar_expanded_header"
-        android:layout_width="match_parent"
-        android:layout_height="@dimen/status_bar_header_height"
-        android:layout_marginLeft="@dimen/notification_side_padding"
-        android:layout_marginRight="@dimen/notification_side_padding"
-        />
+    <include layout="@layout/status_bar_expanded_header" />
 
     <include
         layout="@layout/keyguard_bottom_area"
diff --git a/packages/SystemUI/res/layout/status_bar_expanded_header.xml b/packages/SystemUI/res/layout/status_bar_expanded_header.xml
index c9da221..7fc8eb8 100644
--- a/packages/SystemUI/res/layout/status_bar_expanded_header.xml
+++ b/packages/SystemUI/res/layout/status_bar_expanded_header.xml
@@ -20,10 +20,10 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
     android:id="@+id/header"
-    android:layout_width="match_parent"
+    style="@style/StatusBarHeader"
     android:layout_height="@dimen/status_bar_header_height"
-    android:orientation="horizontal"
-    android:gravity="center_vertical"
+    android:paddingStart="@dimen/notification_side_padding"
+    android:paddingEnd="@dimen/notification_side_padding"
     android:baselineAligned="false"
     android:elevation="10dp"
     >
@@ -38,10 +38,12 @@
     <RelativeLayout
         android:id="@+id/datetime"
         android:layout_width="wrap_content"
-        android:layout_height="match_parent"
+        android:layout_height="wrap_content"
         android:layout_gravity="start"
-        android:paddingStart="8dp"
-        android:paddingEnd="8dp"
+        android:paddingTop="16dp"
+        android:paddingBottom="16dp"
+        android:paddingStart="16dp"
+        android:paddingEnd="16dp"
         android:background="@drawable/ic_notify_button_bg"
         android:enabled="false"
         >
@@ -49,10 +51,9 @@
             android:id="@+id/clock"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginEnd="8dp"
             android:singleLine="true"
             android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock"
-            android:layout_centerVertical="true"
+            systemui:amPmStyle="normal"
             />
 
         <com.android.systemui.statusbar.policy.DateView android:id="@+id/date"
@@ -60,8 +61,7 @@
             android:layout_height="wrap_content"
             android:singleLine="true"
             android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date"
-            android:layout_toEndOf="@id/clock"
-            android:layout_alignBaseline="@id/clock"
+            android:layout_below="@id/clock"
             />
     </RelativeLayout>
 
diff --git a/packages/SystemUI/res/layout/super_status_bar.xml b/packages/SystemUI/res/layout/super_status_bar.xml
index f7cd37c..26616cd 100644
--- a/packages/SystemUI/res/layout/super_status_bar.xml
+++ b/packages/SystemUI/res/layout/super_status_bar.xml
@@ -35,7 +35,8 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent" >
         <include layout="@layout/status_bar_expanded"
-            style="@style/StatusBarExpanded"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
             android:visibility="gone" />
     </com.android.systemui.statusbar.phone.PanelHolder>
 
diff --git a/packages/SystemUI/res/values-sw600dp/styles.xml b/packages/SystemUI/res/values-sw600dp/styles.xml
index 1ea9442..d4a99866 100644
--- a/packages/SystemUI/res/values-sw600dp/styles.xml
+++ b/packages/SystemUI/res/values-sw600dp/styles.xml
@@ -19,9 +19,14 @@
         <item name="android:layout_width">480dp</item>
     </style>
 
-    <style name="StatusBarExpanded">
+    <style name="NotificationsQuickSettings">
         <item name="android:layout_width">@dimen/notification_panel_width</item>
         <item name="android:layout_height">match_parent</item>
-        <item name="android:layout_gravity">start|top</item>
+        <item name="android:layout_gravity">top|center_horizontal</item>
+    </style>
+
+    <style name="StatusBarHeader">
+        <item name="android:layout_width">@dimen/notification_panel_width</item>
+        <item name="android:layout_gravity">center_horizontal</item>
     </style>
 </resources>
diff --git a/packages/SystemUI/res/values/attrs.xml b/packages/SystemUI/res/values/attrs.xml
index f5674d2..8fd1206 100644
--- a/packages/SystemUI/res/values/attrs.xml
+++ b/packages/SystemUI/res/values/attrs.xml
@@ -51,6 +51,13 @@
             <enum name="end" value="1" />
         </attr>
     </declare-styleable>
+    <declare-styleable name="Clock">
+        <attr name="amPmStyle" format="enum">
+            <enum name="normal" value="0" />
+            <enum name="small" value="1" />
+            <enum name="gone" value="2" />
+        </attr>
+    </declare-styleable>
     <attr name="orientation">
         <enum name="horizontal" value="0" />
         <enum name="vertical" value="1" />
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 6608c5d..ebd2daa 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -69,8 +69,7 @@
     <style name="TextAppearance.StatusBar.Expanded" parent="@*android:style/TextAppearance.StatusBar" />
 
     <style name="TextAppearance.StatusBar.Expanded.Clock">
-        <item name="android:textSize">32dp</item>
-        <item name="android:fontFamily">sans-serif-light</item>
+        <item name="android:textSize">18dp</item>
         <item name="android:textStyle">normal</item>
         <item name="android:textColor">#ffffff</item>
     </style>
@@ -78,8 +77,7 @@
     <style name="TextAppearance.StatusBar.Expanded.Date">
         <item name="android:textSize">12dp</item>
         <item name="android:textStyle">normal</item>
-        <item name="android:textColor">#cccccc</item>
-        <item name="android:textAllCaps">true</item>
+        <item name="android:textColor">#afb3b6</item>
     </style>
 
     <style name="TextAppearance.StatusBar.Expanded.Network" parent="@style/TextAppearance.StatusBar.Expanded.Date">
@@ -171,10 +169,12 @@
 
     <style name="systemui_theme" parent="@android:style/Theme.DeviceDefault" />
 
-    <style name="StatusBarExpanded">
+    <style name="NotificationsQuickSettings">
         <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">match_parent</item>
-        <item name="android:layout_gravity">start|top</item>
     </style>
 
+    <style name="StatusBarHeader">
+        <item name="android:layout_width">match_parent</item>
+    </style>
 </resources>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
index b8c5374..1cbef7e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
@@ -37,11 +37,15 @@
     private View mDateTime;
     private View mKeyguardCarrierText;
     private MultiUserSwitch mMultiUserSwitch;
+    private View mDate;
 
     private int mCollapsedHeight;
     private int mExpandedHeight;
     private int mKeyguardHeight;
 
+    private int mKeyguardWidth = ViewGroup.LayoutParams.MATCH_PARENT;
+    private int mNormalWidth;
+
     private boolean mKeyguardShowing;
 
     public StatusBarHeaderView(Context context, AttributeSet attrs) {
@@ -56,6 +60,7 @@
         mDateTime = findViewById(R.id.datetime);
         mKeyguardCarrierText = findViewById(R.id.keyguard_carrier_text);
         mMultiUserSwitch = (MultiUserSwitch) findViewById(R.id.multi_user_switch);
+        mDate = findViewById(R.id.date);
         loadDimens();
     }
 
@@ -65,6 +70,7 @@
                 R.dimen.status_bar_header_height_expanded);
         mKeyguardHeight = getResources().getDimensionPixelSize(
                 R.dimen.status_bar_header_height_keyguard);
+        mNormalWidth = getLayoutParams().width;
     }
 
     public int getCollapsedHeight() {
@@ -78,6 +84,7 @@
     public void setExpanded(boolean expanded) {
         mExpanded = expanded;
         updateHeights();
+        updateVisibilities();
     }
 
     private void updateHeights() {
@@ -107,6 +114,22 @@
         }
     }
 
+    private void updateWidth() {
+        int width = mKeyguardShowing ? mKeyguardWidth : mNormalWidth;
+        ViewGroup.LayoutParams lp = getLayoutParams();
+        if (width != lp.width) {
+            lp.width = width;
+            setLayoutParams(lp);
+        }
+    }
+
+    private void updateVisibilities() {
+        mBackground.setVisibility(mKeyguardShowing ? View.INVISIBLE : View.VISIBLE);
+        mDateTime.setVisibility(mKeyguardShowing ? View.INVISIBLE : View.VISIBLE);
+        mKeyguardCarrierText.setVisibility(mKeyguardShowing ? View.VISIBLE : View.GONE);
+        mDate.setVisibility(mExpanded ? View.VISIBLE : View.GONE);
+    }
+
     public void setExpansion(float height) {
         if (height < mCollapsedHeight) {
             height = mCollapsedHeight;
@@ -131,15 +154,14 @@
 
     public void setKeyguardShowing(boolean keyguardShowing) {
         mKeyguardShowing = keyguardShowing;
-        mBackground.setVisibility(keyguardShowing ? View.INVISIBLE : View.VISIBLE);
-        mDateTime.setVisibility(keyguardShowing ? View.INVISIBLE : View.VISIBLE);
-        mKeyguardCarrierText.setVisibility(keyguardShowing ? View.VISIBLE : View.GONE);
         if (keyguardShowing) {
             setZ(0);
         } else {
             setTranslationZ(0);
         }
         updateHeights();
+        updateWidth();
+        updateVisibilities();
     }
 
     public void setUserInfoController(UserInfoController userInfoController) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
index 8ced1c9..55a0bba 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
@@ -20,6 +20,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.res.TypedArray;
 import android.os.Bundle;
 import android.text.Spannable;
 import android.text.SpannableStringBuilder;
@@ -30,6 +31,7 @@
 import android.widget.TextView;
 
 import com.android.systemui.DemoMode;
+import com.android.systemui.R;
 
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
@@ -52,7 +54,7 @@
     private static final int AM_PM_STYLE_SMALL   = 1;
     private static final int AM_PM_STYLE_GONE    = 2;
 
-    private static final int AM_PM_STYLE = AM_PM_STYLE_GONE;
+    private final int mAmPmStyle;
 
     public Clock(Context context) {
         this(context, null);
@@ -64,6 +66,15 @@
 
     public Clock(Context context, AttributeSet attrs, int defStyle) {
         super(context, attrs, defStyle);
+        TypedArray a = context.getTheme().obtainStyledAttributes(
+                attrs,
+                R.styleable.Clock,
+                0, 0);
+        try {
+            mAmPmStyle = a.getInt(R.styleable.Clock_amPmStyle, AM_PM_STYLE_GONE);
+        } finally {
+            a.recycle();
+        }
     }
 
     @Override
@@ -145,7 +156,7 @@
              * add dummy characters around it to let us find it again after
              * formatting and change its size.
              */
-            if (AM_PM_STYLE != AM_PM_STYLE_NORMAL) {
+            if (mAmPmStyle != AM_PM_STYLE_NORMAL) {
                 int a = -1;
                 boolean quoted = false;
                 for (int i = 0; i < format.length(); i++) {
@@ -177,15 +188,15 @@
         }
         String result = sdf.format(mCalendar.getTime());
 
-        if (AM_PM_STYLE != AM_PM_STYLE_NORMAL) {
+        if (mAmPmStyle != AM_PM_STYLE_NORMAL) {
             int magic1 = result.indexOf(MAGIC1);
             int magic2 = result.indexOf(MAGIC2);
             if (magic1 >= 0 && magic2 > magic1) {
                 SpannableStringBuilder formatted = new SpannableStringBuilder(result);
-                if (AM_PM_STYLE == AM_PM_STYLE_GONE) {
+                if (mAmPmStyle == AM_PM_STYLE_GONE) {
                     formatted.delete(magic1, magic2+1);
                 } else {
-                    if (AM_PM_STYLE == AM_PM_STYLE_SMALL) {
+                    if (mAmPmStyle == AM_PM_STYLE_SMALL) {
                         CharacterStyle style = new RelativeSizeSpan(0.7f);
                         formatted.setSpan(style, magic1, magic2,
                                           Spannable.SPAN_EXCLUSIVE_INCLUSIVE);