Data usage fit and finish.
Show time range and data summary based on current sweep selection for
both network and app details. Fix animations by opting-out of parent
hierarchy animation, since it fights with ListView.
Switch to using NPMS "restrict background" instead of overloading
setBackgroundDataSetting(), and hide app background checkbox when
global background is restricted.
Limit sweeps to valid historical data, and activate sweeps on touch
instead of requiring separate tap. Fix z-order and avoid animating
sweeps. Align all elements along vertical edge, and fix item layout
to handle long app title.
Bug: 4979025, 5058107, 5038590, 5079887, 5058108, 5058026, 5037381
Change-Id: Ib45b61ff2a62303f47aa3f47f88d2e688fe4d076
diff --git a/res/layout/data_usage_chart.xml b/res/layout/data_usage_chart.xml
index a942bb3..3409d64 100644
--- a/res/layout/data_usage_chart.xml
+++ b/res/layout/data_usage_chart.xml
@@ -51,20 +51,6 @@
settings:fillColorSecondary="#0000" />
<com.android.settings.widget.ChartSweepView
- android:id="@+id/sweep_left"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- settings:sweepDrawable="@drawable/data_sweep_left"
- settings:followAxis="horizontal" />
-
- <com.android.settings.widget.ChartSweepView
- android:id="@+id/sweep_right"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- settings:sweepDrawable="@drawable/data_sweep_right"
- settings:followAxis="horizontal" />
-
- <com.android.settings.widget.ChartSweepView
android:id="@+id/sweep_warning"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -84,4 +70,18 @@
settings:labelTemplate="@string/data_usage_sweep_limit"
settings:labelColor="#c01a2c" />
+ <com.android.settings.widget.ChartSweepView
+ android:id="@+id/sweep_left"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ settings:sweepDrawable="@drawable/data_sweep_left"
+ settings:followAxis="horizontal" />
+
+ <com.android.settings.widget.ChartSweepView
+ android:id="@+id/sweep_right"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ settings:sweepDrawable="@drawable/data_sweep_right"
+ settings:followAxis="horizontal" />
+
</com.android.settings.widget.DataUsageChartView>
diff --git a/res/layout/data_usage_cycles.xml b/res/layout/data_usage_cycles.xml
new file mode 100644
index 0000000..225fb4b
--- /dev/null
+++ b/res/layout/data_usage_cycles.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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:id="@+id/cycles"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:paddingLeft="16dip"
+ android:paddingRight="16dip">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:text="@string/data_usage_cycle" />
+
+ <Spinner
+ android:id="@+id/cycles_spinner"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" />
+
+</LinearLayout>
diff --git a/res/layout/data_usage_header.xml b/res/layout/data_usage_header.xml
index 547d85d..52f56c1 100644
--- a/res/layout/data_usage_header.xml
+++ b/res/layout/data_usage_header.xml
@@ -32,28 +32,19 @@
android:divider="?android:attr/listDivider" />
</FrameLayout>
- <LinearLayout
+ <include layout="@layout/data_usage_cycles" />
+ <include layout="@layout/data_usage_chart" />
+
+ <TextView
+ android:id="@+id/usage_summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal"
android:paddingLeft="16dip"
- android:paddingRight="16dip">
+ android:paddingRight="16dip"
+ android:paddingTop="8dip"
+ android:paddingBottom="8dip"
+ android:textAppearance="?android:attr/textAppearanceSmall" />
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:text="@string/data_usage_cycle" />
-
- <Spinner
- android:id="@+id/cycles"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1" />
-
- </LinearLayout>
-
- <include layout="@layout/data_usage_chart" />
<include layout="@layout/data_usage_detail" />
</LinearLayout>
diff --git a/res/layout/data_usage_item.xml b/res/layout/data_usage_item.xml
index d709753..36f8b4d 100644
--- a/res/layout/data_usage_item.xml
+++ b/res/layout/data_usage_item.xml
@@ -17,20 +17,22 @@
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:padding="8dip"
+ android:paddingLeft="16dip"
+ android:paddingRight="16dip"
+ android:paddingTop="8dip"
+ android:paddingBottom="8dip"
android:columnCount="2">
- <!-- TODO: consider using canShrink -->
<TextView
android:id="@android:id/title"
+ android:layout_width="0dip"
+ android:layout_gravity="fill_horizontal"
android:singleLine="true"
android:ellipsize="marquee"
- android:layout_columnFlexibility="canStretch"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@android:id/summary"
- android:layout_gravity="right"
android:layout_marginLeft="8dip"
android:textAppearance="?android:attr/textAppearanceSmall" />