summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Laird <evanlaird@google.com>2017-06-28 14:27:47 -0400
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-06-29 04:39:09 +0000
commit3f100d0173c439ab98ffb5825c709bbbc29eb100 (patch)
tree24e655f33e12123a68317a1da53616ffc7fe064a
parent8668daa75cde6a91bbce72f45fd78014815334a3 (diff)
downloadbase-3f100d0173c439ab98ffb5825c709bbbc29eb100.tar.gz
Fix empty signal line thickness / color in status bar
Parameterize the line thickness to the height of the drawable. Also draw the empty state as background signal instead of foreground. Test: visual Change-Id: I39a7ef3164b784008e3dba5284b7fe83e4666607 Fixes: 63097113 (cherry picked from commit 718b4753f58f5019a8b622f0ef29483065f3cca6)
-rw-r--r--packages/SystemUI/res/values/dimens.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/SignalDrawable.java35
2 files changed, 14 insertions, 24 deletions
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index f66a09e04192..4245b1183e08 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -776,7 +776,4 @@
<dimen name="qs_gutter_height">6dp</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 983a79615304..1c34b7de2d4d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SignalDrawable.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SignalDrawable.java
@@ -85,12 +85,8 @@ public class SignalDrawable extends Drawable {
{-1.9f / VIEWPORT, -1.9f / VIEWPORT},
};
- // 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;
private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Paint mForegroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
@@ -126,11 +122,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);
}
@@ -262,20 +253,22 @@ public class SignalDrawable extends Drawable {
}
if (mState == STATE_EMPTY) {
+ 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, padding + mEmptyDiagInset);
- mCutPath.lineTo(padding + 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, padding + cutDiagInset);
+ mCutPath.lineTo(padding + 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);