Data usage strings, sweep touches, fixes.

Change strings around limiting background data.  Move limit/warning
sweeps above inspection sweeps, and teach about additional neighbors
on different axis.

Guard against DialogFragment.show(), fix pie chart to draw edges, and
remove data usage from battery UI.

Bug: 5341374, 5337650, 5337385, 5319465, 5236335
Change-Id: Iea8c2a2ab405b645d85abe34a0178d4b8874cdd5
This commit is contained in:
Jeff Sharkey
2011-09-25 18:22:48 -07:00
parent 2407efcf42
commit 461842a8c0
7 changed files with 174 additions and 98 deletions

View File

@@ -101,6 +101,8 @@ public class ChartSweepView extends View {
private float mTrackingStart;
private MotionEvent mTracking;
private ChartSweepView[] mNeighbors = new ChartSweepView[0];
public ChartSweepView(Context context) {
this(context, null);
}
@@ -149,6 +151,10 @@ public class ChartSweepView extends View {
mAxis = Preconditions.checkNotNull(axis, "missing axis");
}
public void setNeighbors(ChartSweepView... neighbors) {
mNeighbors = neighbors;
}
public int getFollowAxis() {
return mFollowAxis;
}
@@ -381,18 +387,16 @@ public class ChartSweepView extends View {
* {@link ChartSweepView} compared to ourselves.
*/
public boolean isTouchCloserTo(MotionEvent eventInParent, ChartSweepView another) {
if (another == null) return false;
final float selfDist = getTouchDistanceFromTarget(eventInParent);
final float anotherDist = another.getTouchDistanceFromTarget(eventInParent);
return anotherDist < selfDist;
}
private float getTouchDistanceFromTarget(MotionEvent eventInParent) {
if (mFollowAxis == HORIZONTAL) {
final float selfDist = Math.abs(eventInParent.getX() - (getX() + getTargetInset()));
final float anotherDist = Math.abs(
eventInParent.getX() - (another.getX() + another.getTargetInset()));
return anotherDist < selfDist;
return Math.abs(eventInParent.getX() - (getX() + getTargetInset()));
} else {
final float selfDist = Math.abs(eventInParent.getY() - (getY() + getTargetInset()));
final float anotherDist = Math.abs(
eventInParent.getY() - (another.getY() + another.getTargetInset()));
return anotherDist < selfDist;
return Math.abs(eventInParent.getY() - (getY() + getTargetInset()));
}
}
@@ -421,9 +425,10 @@ public class ChartSweepView extends View {
eventInParent.offsetLocation(getLeft(), getTop());
// ignore event when closer to a neighbor
if (isTouchCloserTo(eventInParent, mValidAfterDynamic)
|| isTouchCloserTo(eventInParent, mValidBeforeDynamic)) {
return false;
for (ChartSweepView neighbor : mNeighbors) {
if (isTouchCloserTo(eventInParent, neighbor)) {
return false;
}
}
if (acceptDrag) {