Data usage UI fixes; sweeps, combined history.

Fix sweep z-order so that limit are always above inspection range,
and draw shadows behind sweep labels.  Narrower margins for sweeps
with labels; push labels to keep from overlapping.

Generous touch targets on sweeps, and delegate touches to neighboring
sweep if nearer.  Refresh sweep layout during axis zoom, and don't
allow zoom below default minimum.  Let inspection sweeps move beyond
valid data ranges.  Draw less-frequent tick marks when working with
large axis ranges.

Remove Wi-Fi policies but continue showing historical data.  Write
NetworkPolicy if modified during read, and snapshot when async write
requested.

Handle combined UID histories for "Android OS."

Bug: 5191421, 5092579, 5225988, 5221101, 5221065, 5221005, 5150906, 5058025
Change-Id: Id51652e8a10bb90e1345f7a8af01bd70cb8ac677
This commit is contained in:
Jeff Sharkey
2011-08-27 17:09:43 -07:00
parent d66b61908d
commit 55d18a57e4
6 changed files with 381 additions and 160 deletions

View File

@@ -36,8 +36,6 @@ import com.android.settings.R;
* and screen coordinates.
*/
public class ChartView extends FrameLayout {
private static final String TAG = "ChartView";
// TODO: extend something that supports two-dimensional scrolling
private static final int SWEEP_GRAVITY = Gravity.TOP | Gravity.LEFT;
@@ -122,29 +120,39 @@ public class ChartView extends FrameLayout {
child.layout(childRect.left, childRect.top, childRect.right, childRect.bottom);
} else if (child instanceof ChartSweepView) {
// sweep is always placed along specific dimension
final ChartSweepView sweep = (ChartSweepView) child;
final Rect sweepMargins = sweep.getMargins();
if (sweep.getFollowAxis() == ChartSweepView.VERTICAL) {
parentRect.top += sweepMargins.top + (int) sweep.getPoint();
parentRect.bottom = parentRect.top;
parentRect.left += sweepMargins.left;
parentRect.right += sweepMargins.right;
Gravity.apply(SWEEP_GRAVITY, parentRect.width(), child.getMeasuredHeight(),
parentRect, childRect);
} else {
parentRect.left += sweepMargins.left + (int) sweep.getPoint();
parentRect.right = parentRect.left;
parentRect.top += sweepMargins.top;
parentRect.bottom += sweepMargins.bottom;
Gravity.apply(SWEEP_GRAVITY, child.getMeasuredWidth(), parentRect.height(),
parentRect, childRect);
}
layoutSweep((ChartSweepView) child, parentRect, childRect);
child.layout(childRect.left, childRect.top, childRect.right, childRect.bottom);
}
}
}
child.layout(childRect.left, childRect.top, childRect.right, childRect.bottom);
protected void layoutSweep(ChartSweepView sweep) {
final Rect parentRect = new Rect(mContent);
final Rect childRect = new Rect();
layoutSweep(sweep, parentRect, childRect);
sweep.layout(childRect.left, childRect.top, childRect.right, childRect.bottom);
}
protected void layoutSweep(ChartSweepView sweep, Rect parentRect, Rect childRect) {
final Rect sweepMargins = sweep.getMargins();
// sweep is always placed along specific dimension
if (sweep.getFollowAxis() == ChartSweepView.VERTICAL) {
parentRect.top += sweepMargins.top + (int) sweep.getPoint();
parentRect.bottom = parentRect.top;
parentRect.left += sweepMargins.left;
parentRect.right += sweepMargins.right;
Gravity.apply(SWEEP_GRAVITY, parentRect.width(), sweep.getMeasuredHeight(),
parentRect, childRect);
} else {
parentRect.left += sweepMargins.left + (int) sweep.getPoint();
parentRect.right = parentRect.left;
parentRect.top += sweepMargins.top;
parentRect.bottom += sweepMargins.bottom;
Gravity.apply(SWEEP_GRAVITY, sweep.getMeasuredWidth(), parentRect.height(),
parentRect, childRect);
}
}