More data usage chart iteration, app details.

Moved app details back into single Fragment to support animations and
template tabs.  Show the network in background behind app details
chart series to match designs.

Clamping sweeps at axis boundaries.

Bug: 4813014, 4598460, 4818029
Change-Id: I72c0b21ee1d595e4da31d293ae0dab9e801041f3
diff --git a/res/drawable-hdpi/data_sweep_left_activated.9.png b/res/drawable-hdpi/data_sweep_left_activated.9.png
index e91ccf5..28efd35 100644
--- a/res/drawable-hdpi/data_sweep_left_activated.9.png
+++ b/res/drawable-hdpi/data_sweep_left_activated.9.png
Binary files differ
diff --git a/res/drawable-hdpi/data_sweep_left_default.9.png b/res/drawable-hdpi/data_sweep_left_default.9.png
index 76f33a5..4b6f2df 100644
--- a/res/drawable-hdpi/data_sweep_left_default.9.png
+++ b/res/drawable-hdpi/data_sweep_left_default.9.png
Binary files differ
diff --git a/res/drawable-hdpi/data_sweep_limit_activated.9.png b/res/drawable-hdpi/data_sweep_limit_activated.9.png
index 4744037..59de0d3 100644
--- a/res/drawable-hdpi/data_sweep_limit_activated.9.png
+++ b/res/drawable-hdpi/data_sweep_limit_activated.9.png
Binary files differ
diff --git a/res/drawable-hdpi/data_sweep_limit_default.9.png b/res/drawable-hdpi/data_sweep_limit_default.9.png
index dea3a0b..d7f3a88 100644
--- a/res/drawable-hdpi/data_sweep_limit_default.9.png
+++ b/res/drawable-hdpi/data_sweep_limit_default.9.png
Binary files differ
diff --git a/res/drawable-hdpi/data_sweep_right_activated.9.png b/res/drawable-hdpi/data_sweep_right_activated.9.png
index afb15d6..ccd7ff9 100644
--- a/res/drawable-hdpi/data_sweep_right_activated.9.png
+++ b/res/drawable-hdpi/data_sweep_right_activated.9.png
Binary files differ
diff --git a/res/drawable-hdpi/data_sweep_right_default.9.png b/res/drawable-hdpi/data_sweep_right_default.9.png
index 9d3808f..1179fde 100644
--- a/res/drawable-hdpi/data_sweep_right_default.9.png
+++ b/res/drawable-hdpi/data_sweep_right_default.9.png
Binary files differ
diff --git a/res/drawable-hdpi/data_sweep_warning_activated.9.png b/res/drawable-hdpi/data_sweep_warning_activated.9.png
index 81a7aa8..9ecd28b 100644
--- a/res/drawable-hdpi/data_sweep_warning_activated.9.png
+++ b/res/drawable-hdpi/data_sweep_warning_activated.9.png
Binary files differ
diff --git a/res/drawable-hdpi/data_sweep_warning_default.9.png b/res/drawable-hdpi/data_sweep_warning_default.9.png
index e2485fe..ec2b9df 100644
--- a/res/drawable-hdpi/data_sweep_warning_default.9.png
+++ b/res/drawable-hdpi/data_sweep_warning_default.9.png
Binary files differ
diff --git a/res/drawable-mdpi/data_sweep_left_activated.9.png b/res/drawable-mdpi/data_sweep_left_activated.9.png
index 39111d4..fc6764a 100644
--- a/res/drawable-mdpi/data_sweep_left_activated.9.png
+++ b/res/drawable-mdpi/data_sweep_left_activated.9.png
Binary files differ
diff --git a/res/drawable-mdpi/data_sweep_left_default.9.png b/res/drawable-mdpi/data_sweep_left_default.9.png
index 139ed1e..31343e7 100644
--- a/res/drawable-mdpi/data_sweep_left_default.9.png
+++ b/res/drawable-mdpi/data_sweep_left_default.9.png
Binary files differ
diff --git a/res/drawable-mdpi/data_sweep_limit_activated.9.png b/res/drawable-mdpi/data_sweep_limit_activated.9.png
index 64d539a..b01d5f0 100644
--- a/res/drawable-mdpi/data_sweep_limit_activated.9.png
+++ b/res/drawable-mdpi/data_sweep_limit_activated.9.png
Binary files differ
diff --git a/res/drawable-mdpi/data_sweep_limit_default.9.png b/res/drawable-mdpi/data_sweep_limit_default.9.png
index db41d66..a59649a 100644
--- a/res/drawable-mdpi/data_sweep_limit_default.9.png
+++ b/res/drawable-mdpi/data_sweep_limit_default.9.png
Binary files differ
diff --git a/res/drawable-mdpi/data_sweep_right_activated.9.png b/res/drawable-mdpi/data_sweep_right_activated.9.png
index 2fba366..5314538 100644
--- a/res/drawable-mdpi/data_sweep_right_activated.9.png
+++ b/res/drawable-mdpi/data_sweep_right_activated.9.png
Binary files differ
diff --git a/res/drawable-mdpi/data_sweep_right_default.9.png b/res/drawable-mdpi/data_sweep_right_default.9.png
index 533f165..cc3b586 100644
--- a/res/drawable-mdpi/data_sweep_right_default.9.png
+++ b/res/drawable-mdpi/data_sweep_right_default.9.png
Binary files differ
diff --git a/res/drawable-mdpi/data_sweep_warning_activated.9.png b/res/drawable-mdpi/data_sweep_warning_activated.9.png
index 6813526..ed44d4d 100644
--- a/res/drawable-mdpi/data_sweep_warning_activated.9.png
+++ b/res/drawable-mdpi/data_sweep_warning_activated.9.png
Binary files differ
diff --git a/res/drawable-mdpi/data_sweep_warning_default.9.png b/res/drawable-mdpi/data_sweep_warning_default.9.png
index 65ab32f..760ea18 100644
--- a/res/drawable-mdpi/data_sweep_warning_default.9.png
+++ b/res/drawable-mdpi/data_sweep_warning_default.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/data_sweep_left_activated.9.png b/res/drawable-xhdpi/data_sweep_left_activated.9.png
index 83883be..ff9631e 100644
--- a/res/drawable-xhdpi/data_sweep_left_activated.9.png
+++ b/res/drawable-xhdpi/data_sweep_left_activated.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/data_sweep_left_default.9.png b/res/drawable-xhdpi/data_sweep_left_default.9.png
index 968825b..2e0651c 100644
--- a/res/drawable-xhdpi/data_sweep_left_default.9.png
+++ b/res/drawable-xhdpi/data_sweep_left_default.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/data_sweep_limit_activated.9.png b/res/drawable-xhdpi/data_sweep_limit_activated.9.png
index de988ae..ae02388 100644
--- a/res/drawable-xhdpi/data_sweep_limit_activated.9.png
+++ b/res/drawable-xhdpi/data_sweep_limit_activated.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/data_sweep_limit_default.9.png b/res/drawable-xhdpi/data_sweep_limit_default.9.png
index 2c9b534..7391148 100644
--- a/res/drawable-xhdpi/data_sweep_limit_default.9.png
+++ b/res/drawable-xhdpi/data_sweep_limit_default.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/data_sweep_right_activated.9.png b/res/drawable-xhdpi/data_sweep_right_activated.9.png
index 25508b5..81c1a3c 100644
--- a/res/drawable-xhdpi/data_sweep_right_activated.9.png
+++ b/res/drawable-xhdpi/data_sweep_right_activated.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/data_sweep_right_default.9.png b/res/drawable-xhdpi/data_sweep_right_default.9.png
index 7363cd7..94a9f61 100644
--- a/res/drawable-xhdpi/data_sweep_right_default.9.png
+++ b/res/drawable-xhdpi/data_sweep_right_default.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/data_sweep_warning_activated.9.png b/res/drawable-xhdpi/data_sweep_warning_activated.9.png
index 2da464b..0a2d2b1 100644
--- a/res/drawable-xhdpi/data_sweep_warning_activated.9.png
+++ b/res/drawable-xhdpi/data_sweep_warning_activated.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/data_sweep_warning_default.9.png b/res/drawable-xhdpi/data_sweep_warning_default.9.png
index c7a7b29..d5f6044 100644
--- a/res/drawable-xhdpi/data_sweep_warning_default.9.png
+++ b/res/drawable-xhdpi/data_sweep_warning_default.9.png
Binary files differ
diff --git a/res/drawable/data_sweep_left.xml b/res/drawable/data_sweep_left.xml
index 739a74e..cb801a0 100644
--- a/res/drawable/data_sweep_left.xml
+++ b/res/drawable/data_sweep_left.xml
@@ -17,6 +17,6 @@
 <selector xmlns:android="http://schemas.android.com/apk/res/android"
     android:exitFadeDuration="@android:integer/config_mediumAnimTime">
 
-    <item android:state_activated="true" android:drawable="@drawable/data_sweep_left_activated" />
-    <item android:state_activated="false" android:drawable="@drawable/data_sweep_left_default" />
+    <item android:state_activated="true" android:state_enabled="true" android:drawable="@drawable/data_sweep_left_activated" />
+    <item android:drawable="@drawable/data_sweep_left_default" />
 </selector>
diff --git a/res/drawable/data_sweep_limit.xml b/res/drawable/data_sweep_limit.xml
index 29ecec8..378b0aa 100644
--- a/res/drawable/data_sweep_limit.xml
+++ b/res/drawable/data_sweep_limit.xml
@@ -17,6 +17,6 @@
 <selector xmlns:android="http://schemas.android.com/apk/res/android"
     android:exitFadeDuration="@android:integer/config_mediumAnimTime">
 
-    <item android:state_activated="true" android:drawable="@drawable/data_sweep_limit_activated" />
-    <item android:state_activated="false" android:drawable="@drawable/data_sweep_limit_default" />
+    <item android:state_activated="true" android:state_enabled="true" android:drawable="@drawable/data_sweep_limit_activated" />
+    <item android:drawable="@drawable/data_sweep_limit_default" />
 </selector>
diff --git a/res/drawable/data_sweep_right.xml b/res/drawable/data_sweep_right.xml
index 1a11469..a75a1b2 100644
--- a/res/drawable/data_sweep_right.xml
+++ b/res/drawable/data_sweep_right.xml
@@ -17,6 +17,6 @@
 <selector xmlns:android="http://schemas.android.com/apk/res/android"
     android:exitFadeDuration="@android:integer/config_mediumAnimTime">
 
-    <item android:state_activated="true" android:drawable="@drawable/data_sweep_right_activated" />
-    <item android:state_activated="false" android:drawable="@drawable/data_sweep_right_default" />
+    <item android:state_activated="true" android:state_enabled="true" android:drawable="@drawable/data_sweep_right_activated" />
+    <item android:drawable="@drawable/data_sweep_right_default" />
 </selector>
diff --git a/res/drawable/data_sweep_warning.xml b/res/drawable/data_sweep_warning.xml
index 5cafe06..001d0c5 100644
--- a/res/drawable/data_sweep_warning.xml
+++ b/res/drawable/data_sweep_warning.xml
@@ -17,6 +17,6 @@
 <selector xmlns:android="http://schemas.android.com/apk/res/android"
     android:exitFadeDuration="@android:integer/config_mediumAnimTime">
 
-    <item android:state_activated="true" android:drawable="@drawable/data_sweep_warning_activated" />
-    <item android:state_activated="false" android:drawable="@drawable/data_sweep_warning_default" />
+    <item android:state_activated="true" android:state_enabled="true" android:drawable="@drawable/data_sweep_warning_activated" />
+    <item android:drawable="@drawable/data_sweep_warning_default" />
 </selector>
diff --git a/res/layout/data_usage_chart.xml b/res/layout/data_usage_chart.xml
index 5fd640f..199a38e 100644
--- a/res/layout/data_usage_chart.xml
+++ b/res/layout/data_usage_chart.xml
@@ -17,6 +17,7 @@
 <com.android.settings.widget.DataUsageChartView
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+    android:id="@+id/chart"
     android:layout_width="match_parent"
     android:layout_height="220dip"
     android:padding="16dip">
@@ -40,11 +41,19 @@
         settings:fillColor="#c050ade5"
         settings:fillColorSecondary="#88566abc" />
 
+    <com.android.settings.widget.ChartNetworkSeriesView
+        android:id="@+id/detail_series"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_gravity="left|bottom"
+        settings:strokeColor="#d88d3a"
+        settings:fillColor="#c0ba7f3e"
+        settings:fillColorSecondary="#0000" />
+
     <com.android.settings.widget.ChartSweepView
         android:id="@+id/sweep_left"
         android:layout_width="wrap_content"
         android:layout_height="match_parent"
-        android:layout_gravity="center_horizontal"
         settings:sweepDrawable="@drawable/data_sweep_left"
         settings:followAxis="horizontal"
         settings:showLabel="false" />
@@ -53,7 +62,6 @@
         android:id="@+id/sweep_right"
         android:layout_width="wrap_content"
         android:layout_height="match_parent"
-        android:layout_gravity="center_horizontal"
         settings:sweepDrawable="@drawable/data_sweep_right"
         settings:followAxis="horizontal"
         settings:showLabel="false" />
@@ -62,7 +70,6 @@
         android:id="@+id/sweep_limit"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_gravity="center_vertical"
         settings:sweepDrawable="@drawable/data_sweep_limit"
         settings:followAxis="vertical"
         settings:showLabel="true" />
@@ -71,7 +78,6 @@
         android:id="@+id/sweep_warning"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_gravity="center_vertical"
         settings:sweepDrawable="@drawable/data_sweep_warning"
         settings:followAxis="vertical"
         settings:showLabel="true" />
diff --git a/res/layout/data_usage_detail.xml b/res/layout/data_usage_detail.xml
index 9415b3f..2c8e490 100644
--- a/res/layout/data_usage_detail.xml
+++ b/res/layout/data_usage_detail.xml
@@ -14,43 +14,35 @@
      limitations under the License.
 -->
 
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/app_detail"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
-    <LinearLayout
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <TextView
+        android:id="@+id/app_title"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:orientation="vertical">
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="16dip" />
 
-        <FrameLayout
-            android:id="@+id/chart_container"
-            android:layout_width="match_parent"
-            android:layout_height="233dip" />
+    <TextView
+        android:id="@+id/app_subtitle"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="16dip" />
 
-        <TextView
-            android:id="@android:id/title"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginLeft="16dip" />
+    <Button
+        android:id="@+id/app_settings"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_margin="16dip"
+        android:text="@string/data_usage_app_settings" />
 
-        <TextView
-            android:id="@android:id/text1"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginLeft="16dip" />
+    <LinearLayout
+        android:id="@+id/app_switches"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical" />
 
-        <Button
-            android:id="@+id/data_usage_app_settings"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_margin="16dip"
-            android:text="@string/data_usage_app_settings" />
-
-        <LinearLayout
-            android:id="@+id/switches"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="vertical" />
-
-    </LinearLayout>
-</ScrollView>
+</LinearLayout>
diff --git a/res/layout/data_usage_header.xml b/res/layout/data_usage_header.xml
index 8e6f054..3f4ca5b 100644
--- a/res/layout/data_usage_header.xml
+++ b/res/layout/data_usage_header.xml
@@ -20,7 +20,7 @@
     android:orientation="vertical">
 
     <LinearLayout
-        android:id="@+id/switches"
+        android:id="@+id/network_switches"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="vertical"
@@ -48,4 +48,7 @@
 
     </LinearLayout>
 
+    <include layout="@layout/data_usage_chart" />
+    <include layout="@layout/data_usage_detail" />
+
 </LinearLayout>