diff options
| author | 2017-06-28 18:00:02 -0400 | |
|---|---|---|
| committer | 2017-06-28 18:00:02 -0400 | |
| commit | 2b8dac29eb838fad7a85632c269af9d62632934f (patch) | |
| tree | 24daf286d9fc86f74e044348c8d37aff5e5ad44d | |
| parent | b5e79ad0d3bd672d37e9b88b002e7ad91e358448 (diff) | |
| parent | 91870d1587486266fdace8a340cbc94e1973e354 (diff) | |
resolve merge conflicts of 91870d158748 to oc-dr1-dev
Test: mp sysuig; visual
Change-Id: Id329cd7f08667b29e8d430cff6576d8894cd9cf4
| -rw-r--r-- | packages/SystemUI/res/values/dimens.xml | 3 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/SignalDrawable.java | 35 |
2 files changed, 12 insertions, 26 deletions
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 93d2072e955c..4a1d953c3bfe 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -827,7 +827,4 @@ <!-- How far to inset the rounded edges --> <dimen name="stat_sys_mobile_signal_circle_inset">0.9dp</dimen> - <!-- Width of the hollow triangle for empty signal state --> - <dimen name="mobile_signal_empty_strokewidth">2dp</dimen> - </resources> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SignalDrawable.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SignalDrawable.java index deea521b7c2f..7a7efbdc6615 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SignalDrawable.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SignalDrawable.java @@ -100,12 +100,8 @@ public class SignalDrawable extends Drawable { // How far the circle defining the corners is inset from the edges private final float mAppliedCornerInset; - // The easiest way to understand this is as if we set Style.STROKE and draw the triangle, - // but that is only theoretically right. Instead, draw the triangle and clip out a smaller - // one inset by this amount. - private final float mEmptyStrokeWidth; private static final float INV_TAN = 1f / (float) Math.tan(Math.PI / 8f); - private final float mEmptyDiagInset; // == mEmptyStrokeWidth * INV_TAN + private static final float CUT_WIDTH_DP = 1f / 12f; // Where the top and left points of the triangle would be if not for rounding private final PointF mVirtualTop = new PointF(); @@ -145,11 +141,6 @@ public class SignalDrawable extends Drawable { Utils.getDefaultColor(context, R.color.light_mode_icon_color_dual_tone_fill); mIntrinsicSize = context.getResources().getDimensionPixelSize(R.dimen.signal_icon_size); - // mCutPath parameters - mEmptyStrokeWidth = context.getResources() - .getDimensionPixelSize(R.dimen.mobile_signal_empty_strokewidth); - mEmptyDiagInset = mEmptyStrokeWidth * INV_TAN; - mHandler = new Handler(); setDarkIntensity(0); @@ -326,22 +317,20 @@ public class SignalDrawable extends Drawable { (padding + cornerRadius + mAppliedCornerInset) - (INV_TAN * cornerRadius), height - padding); + final float cutWidth = CUT_WIDTH_DP * height; + final float cutDiagInset = cutWidth * INV_TAN; + // Cut out a smaller triangle from the center of mFullPath mCutPath.reset(); mCutPath.setFillType(FillType.WINDING); - mCutPath.moveTo(width - padding - mEmptyStrokeWidth, - height - padding - mEmptyStrokeWidth); - mCutPath.lineTo(width - padding - mEmptyStrokeWidth, - mVirtualTop.y + mEmptyDiagInset); - mCutPath.lineTo(mVirtualLeft.x + mEmptyDiagInset, - height - padding - mEmptyStrokeWidth); - mCutPath.lineTo(width - padding - mEmptyStrokeWidth, - height - padding - mEmptyStrokeWidth); - - // In empty state, draw the full path as the foreground paint - mForegroundPath.set(mFullPath); - mFullPath.reset(); - mForegroundPath.op(mCutPath, Path.Op.DIFFERENCE); + mCutPath.moveTo(width - padding - cutWidth, height - padding - cutWidth); + mCutPath.lineTo(width - padding - cutWidth, mVirtualTop.y + cutDiagInset); + mCutPath.lineTo(mVirtualLeft.x + cutDiagInset, height - padding - cutWidth); + mCutPath.lineTo(width - padding - cutWidth, height - padding - cutWidth); + + // Draw empty state as only background + mForegroundPath.reset(); + mFullPath.op(mCutPath, Path.Op.DIFFERENCE); } else if (mState == STATE_AIRPLANE) { // Airplane mode is slashed, full-signal mForegroundPath.set(mFullPath); |