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
This commit is contained in:
Jeff Sharkey
2011-07-26 19:30:26 -07:00
parent 271ec8a8f8
commit d360e5efaa
8 changed files with 242 additions and 111 deletions

View File

@@ -50,20 +50,6 @@
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"
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"
@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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" />