Merge "resolve merge conflicts of 91870d1587 to oc-dr1-dev" into oc-dr1-dev

am: 423022e8ab

Change-Id: I5f81cfde196fc801c4141c35e708d8f27032c621
This commit is contained in:
Evan Laird
2017-06-29 02:12:02 +00:00
committed by android-build-merger
2 changed files with 11 additions and 25 deletions

View File

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

View File

@@ -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);
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);
// In empty state, draw the full path as the foreground paint
mForegroundPath.set(mFullPath);
mFullPath.reset();
mForegroundPath.op(mCutPath, Path.Op.DIFFERENCE);
// 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);