Merge "Re-style stopwatch notification to match that of timer." into ub-deskclock-charm
diff --git a/res/drawable-v21/horizontal_divider.xml b/res/drawable-v21/horizontal_divider.xml
new file mode 100644
index 0000000..7db71f3
--- /dev/null
+++ b/res/drawable-v21/horizontal_divider.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+<inset xmlns:android="http://schemas.android.com/apk/res/android"
+    android:insetLeft="@dimen/notification_icon_size">
+     <shape>
+         <size android:height="1dip" />
+         <solid android:color="@color/notification_divider" />
+     </shape>
+</inset>
\ No newline at end of file
diff --git a/res/drawable-v21/ic_lap_24dp.xml b/res/drawable-v21/ic_lap_24dp.xml
index 82f035f..25b0e50 100644
--- a/res/drawable-v21/ic_lap_24dp.xml
+++ b/res/drawable-v21/ic_lap_24dp.xml
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <bitmap xmlns:android="http://schemas.android.com/apk/res/android"
     android:src="@drawable/ic_lap_white_24dp"
-    android:tint="@color/black" />
+    android:tint="@color/black_54p" />
diff --git a/res/drawable-v21/ic_sw_reset_24dp.xml b/res/drawable-v21/ic_sw_reset_24dp.xml
new file mode 100644
index 0000000..b88c04f
--- /dev/null
+++ b/res/drawable-v21/ic_sw_reset_24dp.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+    android:src="@drawable/ic_reset_white_24dp"
+    android:tint="@color/black_54p" />
diff --git a/res/drawable-v21/ic_sw_start_24dp.xml b/res/drawable-v21/ic_sw_start_24dp.xml
new file mode 100644
index 0000000..ebf3083
--- /dev/null
+++ b/res/drawable-v21/ic_sw_start_24dp.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+    android:src="@drawable/ic_start_white_24dp"
+    android:tint="@color/black_54p" />
diff --git a/res/drawable-v21/ic_sw_stop_24dp.xml b/res/drawable-v21/ic_sw_stop_24dp.xml
new file mode 100644
index 0000000..e3e3431
--- /dev/null
+++ b/res/drawable-v21/ic_sw_stop_24dp.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+    android:src="@drawable/ic_stop_white_24dp"
+    android:tint="@color/black_54p" />
diff --git a/res/drawable/ic_sw_reset_24dp.xml b/res/drawable/ic_sw_reset_24dp.xml
new file mode 100644
index 0000000..3a301cd
--- /dev/null
+++ b/res/drawable/ic_sw_reset_24dp.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+    android:src="@drawable/ic_reset_white_24dp" />
diff --git a/res/drawable/ic_sw_start_24dp.xml b/res/drawable/ic_sw_start_24dp.xml
new file mode 100644
index 0000000..cb5afbc
--- /dev/null
+++ b/res/drawable/ic_sw_start_24dp.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+    android:src="@drawable/ic_start_white_24dp" />
diff --git a/res/drawable/ic_sw_stop_24dp.xml b/res/drawable/ic_sw_stop_24dp.xml
new file mode 100644
index 0000000..02a2cf1
--- /dev/null
+++ b/res/drawable/ic_sw_stop_24dp.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+    android:src="@drawable/ic_stop_white_24dp" />
diff --git a/res/layout-v21/stopwatch_notif_expanded.xml b/res/layout-v21/stopwatch_notif_expanded.xml
new file mode 100644
index 0000000..ae694b3
--- /dev/null
+++ b/res/layout-v21/stopwatch_notif_expanded.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2015 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:divider="@drawable/horizontal_divider"
+    android:orientation="vertical"
+    android:showDividers="middle">
+
+    <FrameLayout
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/swn_expanded_hitspace"
+        android:layout_width="match_parent"
+        android:layout_height="64dp"
+        android:background="@drawable/notification_background">
+
+        <include layout="@layout/stopwatch_notification_icon" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_gravity="fill_vertical"
+            android:layout_marginStart="@dimen/notification_icon_size"
+            android:gravity="center"
+            android:minHeight="@dimen/notification_icon_size"
+            android:orientation="vertical"
+            android:paddingBottom="2dp"
+            android:paddingEnd="8dp"
+            android:paddingTop="2dp">
+
+            <LinearLayout
+                android:id="@+id/line1"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <Chronometer
+                    android:id="@+id/swn_expanded_chronometer"
+                    android:layout_width="0dip"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:singleLine="true"
+                    android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title" />
+            </LinearLayout>
+
+            <TextView
+                android:id="@+id/swn_expanded_laps"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:ellipsize="marquee"
+                android:fadingEdge="horizontal"
+                android:singleLine="true"
+                android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
+                android:visibility="gone" />
+        </LinearLayout>
+    </FrameLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/notification_icon_size"
+        android:divider="@drawable/divider"
+        android:orientation="horizontal" >
+
+        <TextView
+            android:id="@+id/swn_left_button"
+            android:layout_width="0dp"
+            android:layout_height="48dp"
+            android:layout_weight="1"
+            android:background="@drawable/notification_background"
+            android:drawablePadding="8dp"
+            android:ellipsize="end"
+            android:gravity="start|center_vertical"
+            android:singleLine="true"
+            android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Action" />
+
+        <TextView
+            android:id="@+id/swn_right_button"
+            android:layout_width="0dp"
+            android:layout_height="48dp"
+            android:layout_weight="1"
+            android:background="@drawable/notification_background"
+            android:drawablePadding="8dp"
+            android:ellipsize="end"
+            android:gravity="start|center_vertical"
+            android:singleLine="true"
+            android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Action" />
+    </LinearLayout>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/res/values-v21/styles.xml b/res/values-v21/styles.xml
index a8e79f3..f9f0763 100644
--- a/res/values-v21/styles.xml
+++ b/res/values-v21/styles.xml
@@ -33,12 +33,20 @@
     </style>
 
     <!-- Custom notification content styles -->
+    <!-- copied TextAppearance.Material.Button -->
+    <style name="TextAppearance.StatusBar.EventContent.Action">
+        <item name="android:textSize">14sp</item>
+        <item name="android:fontFamily">sans-serif-medium</item>
+        <item name="android:textAllCaps">true</item>
+        <item name="android:textColor">@color/black_54p</item>
+    </style>
+
     <style name="TextAppearance.StatusBar.EventContent">
-        <item name="android:textSize">@dimen/notification_text_size</item>
+        <item name="android:textSize">14sp</item>
         <item name="android:textColor">@color/black_54p</item>
     </style>
     <style name="TextAppearance.StatusBar.EventContent.Title">
-        <item name="android:textSize">@dimen/notification_title_text_size</item>
+        <item name="android:textSize">16sp</item>
         <item name="android:textColor">@color/black_87p</item>
     </style>
 
diff --git a/src/com/android/deskclock/stopwatch/StopwatchService.java b/src/com/android/deskclock/stopwatch/StopwatchService.java
index 1abeb86..1ee387c 100644
--- a/src/com/android/deskclock/stopwatch/StopwatchService.java
+++ b/src/com/android/deskclock/stopwatch/StopwatchService.java
@@ -191,27 +191,27 @@
                 setImageViewResource(R.id.notification_icon, R.drawable.stat_notify_stopwatch);
 
         if (clockRunning) {
-            // Left button: lap
+            // Right button: lap
             remoteViewsExpanded.setTextViewText(
-                    R.id.swn_left_button, getResources().getText(R.string.sw_lap_button));
-            Intent leftButtonIntent = new Intent(context, StopwatchService.class);
-            leftButtonIntent.setAction(HandleDeskClockApiCalls.ACTION_LAP_STOPWATCH);
-            remoteViewsExpanded.setOnClickPendingIntent(R.id.swn_left_button,
-                    PendingIntent.getService(context, 0, leftButtonIntent, 0));
-            remoteViewsExpanded.
-                    setTextViewCompoundDrawablesRelative(R.id.swn_left_button,
-                            R.drawable.ic_lap_24dp, 0, 0, 0);
-
-            // Right button: stop clock
-            remoteViewsExpanded.setTextViewText(
-                    R.id.swn_right_button, getResources().getText(R.string.sw_stop_button));
+                    R.id.swn_right_button, getResources().getText(R.string.sw_lap_button));
             Intent rightButtonIntent = new Intent(context, StopwatchService.class);
-            rightButtonIntent.setAction(HandleDeskClockApiCalls.ACTION_STOP_STOPWATCH);
+            rightButtonIntent.setAction(HandleDeskClockApiCalls.ACTION_LAP_STOPWATCH);
             remoteViewsExpanded.setOnClickPendingIntent(R.id.swn_right_button,
                     PendingIntent.getService(context, 0, rightButtonIntent, 0));
             remoteViewsExpanded.
                     setTextViewCompoundDrawablesRelative(R.id.swn_right_button,
-                            R.drawable.ic_stop_24dp, 0, 0, 0);
+                            R.drawable.ic_lap_24dp, 0, 0, 0);
+
+            // Left button: stop clock
+            remoteViewsExpanded.setTextViewText(
+                    R.id.swn_left_button, getResources().getText(R.string.sw_stop_button));
+            Intent leftButtonIntent = new Intent(context, StopwatchService.class);
+            leftButtonIntent.setAction(HandleDeskClockApiCalls.ACTION_STOP_STOPWATCH);
+            remoteViewsExpanded.setOnClickPendingIntent(R.id.swn_left_button,
+                    PendingIntent.getService(context, 0, leftButtonIntent, 0));
+            remoteViewsExpanded.
+                    setTextViewCompoundDrawablesRelative(R.id.swn_left_button,
+                            R.drawable.ic_sw_stop_24dp, 0, 0, 0);
 
             // Show the laps if applicable.
             if (numLaps > 0) {
@@ -226,27 +226,27 @@
                 remoteViewsExpanded.setViewVisibility(R.id.swn_expanded_laps, View.GONE);
             }
         } else {
-            // Left button: reset clock
+            // Right button: reset clock
             remoteViewsExpanded.setTextViewText(
-                    R.id.swn_left_button, getResources().getText(R.string.sw_reset_button));
-            Intent leftButtonIntent = new Intent(context, StopwatchService.class);
-            leftButtonIntent.setAction(Stopwatches.RESET_AND_LAUNCH_STOPWATCH);
-            remoteViewsExpanded.setOnClickPendingIntent(R.id.swn_left_button,
-                    PendingIntent.getService(context, 0, leftButtonIntent, 0));
-            remoteViewsExpanded.
-                    setTextViewCompoundDrawablesRelative(R.id.swn_left_button,
-                            R.drawable.ic_reset_24dp, 0, 0, 0);
-
-            // Right button: start clock
-            remoteViewsExpanded.setTextViewText(
-                    R.id.swn_right_button, getResources().getText(R.string.sw_start_button));
+                    R.id.swn_right_button, getResources().getText(R.string.sw_reset_button));
             Intent rightButtonIntent = new Intent(context, StopwatchService.class);
-            rightButtonIntent.setAction(HandleDeskClockApiCalls.ACTION_START_STOPWATCH);
+            rightButtonIntent.setAction(Stopwatches.RESET_AND_LAUNCH_STOPWATCH);
             remoteViewsExpanded.setOnClickPendingIntent(R.id.swn_right_button,
                     PendingIntent.getService(context, 0, rightButtonIntent, 0));
             remoteViewsExpanded.
                     setTextViewCompoundDrawablesRelative(R.id.swn_right_button,
-                            R.drawable.ic_start_24dp, 0, 0, 0);
+                            R.drawable.ic_sw_reset_24dp, 0, 0, 0);
+
+            // Left button: start clock
+            remoteViewsExpanded.setTextViewText(
+                    R.id.swn_left_button, getResources().getText(R.string.sw_start_button));
+            Intent leftButtonIntent = new Intent(context, StopwatchService.class);
+            leftButtonIntent.setAction(HandleDeskClockApiCalls.ACTION_START_STOPWATCH);
+            remoteViewsExpanded.setOnClickPendingIntent(R.id.swn_left_button,
+                    PendingIntent.getService(context, 0, leftButtonIntent, 0));
+            remoteViewsExpanded.
+                    setTextViewCompoundDrawablesRelative(R.id.swn_left_button,
+                            R.drawable.ic_sw_start_24dp, 0, 0, 0);
 
             // Show stopped string.
             remoteViewsCollapsed.