diff options
| author | 2021-07-16 15:30:34 +0000 | |
|---|---|---|
| committer | 2021-07-16 15:30:34 +0000 | |
| commit | e850823da0be66f8ecff60eb01dfdd3b0134a9d0 (patch) | |
| tree | 5c466885cb74a93abbf8490dc0e245894eee7f85 | |
| parent | 8cacd78125ee2482ef570b5fb3c9e844d43062e7 (diff) | |
| parent | 6a2d17d453618adffbbe9a39d7f516657fd0c1b6 (diff) | |
Merge "Use '!' instead of 'x' in signal drawable" into sc-dev
| -rw-r--r-- | core/res/res/values/config.xml | 12 | ||||
| -rw-r--r-- | core/res/res/values/symbols.xml | 2 | ||||
| -rw-r--r-- | packages/SettingsLib/src/com/android/settingslib/graph/SignalDrawable.java | 27 |
3 files changed, 21 insertions, 20 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 6d40216adb43..db43b5b31e7e 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -4408,14 +4408,14 @@ M9,10l-2,0l0,-2l-2,0l0,2l-2,0l0,2l2,0l0,2l2,0l0,-2l2,0z </string> - <!-- X path for SignalDrawable as defined on a 24x24 canvas. --> - <string name="config_signalXPath" translatable="false"> - M22,16.41L20.59,15l-2.09,2.09L16.41,15L15,16.41l2.09,2.09L15,20.59L16.41,22l2.09-2.08L20.59,22L22,20.59l-2.08-2.09 L22,16.41z + <!-- Attribution path for SignalDrawable as defined on a 24x24 canvas. --> + <string name="config_signalAttributionPath" translatable="false"> + M20,10h2v8h-2z M20,20h2v2h-2z </string> <!-- config_signalCutout{Height,Width}Fraction define fraction of the 24x24 canvas that - should be cut out to display config_signalXPath.--> - <item name="config_signalCutoutWidthFraction" format="float" type="dimen">11</item> - <item name="config_signalCutoutHeightFraction" format="float" type="dimen">11</item> + should be cut out to display config_signalAttributionPath. --> + <item name="config_signalCutoutWidthFraction" format="float" type="dimen">7</item> + <item name="config_signalCutoutHeightFraction" format="float" type="dimen">17</item> <!-- A dual tone battery meter draws the perimeter path twice - once to define the shape and a second time clipped to the fill level to indicate charge --> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 40555fdaaa45..adb046e76c88 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3369,7 +3369,7 @@ <java-symbol type="string" name="config_batterymeterBoltPath" /> <java-symbol type="string" name="config_batterymeterPowersavePath" /> <java-symbol type="bool" name="config_batterymeterDualTone" /> - <java-symbol type="string" name="config_signalXPath" /> + <java-symbol type="string" name="config_signalAttributionPath" /> <java-symbol type="dimen" name="config_signalCutoutWidthFraction" /> <java-symbol type="dimen" name="config_signalCutoutHeightFraction" /> diff --git a/packages/SettingsLib/src/com/android/settingslib/graph/SignalDrawable.java b/packages/SettingsLib/src/com/android/settingslib/graph/SignalDrawable.java index 3b41fa99d6c4..4d0804e1bbb7 100644 --- a/packages/SettingsLib/src/com/android/settingslib/graph/SignalDrawable.java +++ b/packages/SettingsLib/src/com/android/settingslib/graph/SignalDrawable.java @@ -72,9 +72,9 @@ public class SignalDrawable extends DrawableWrapper { private final int mLightModeFillColor; private final Path mCutoutPath = new Path(); private final Path mForegroundPath = new Path(); - private final Path mXPath = new Path(); - private final Matrix mXScaleMatrix = new Matrix(); - private final Path mScaledXPath = new Path(); + private final Path mAttributionPath = new Path(); + private final Matrix mAttributionScaleMatrix = new Matrix(); + private final Path mScaledAttributionPath = new Path(); private final Handler mHandler; private final float mCutoutWidthFraction; private final float mCutoutHeightFraction; @@ -85,10 +85,10 @@ public class SignalDrawable extends DrawableWrapper { public SignalDrawable(Context context) { super(context.getDrawable(com.android.internal.R.drawable.ic_signal_cellular)); - final String xPathString = context.getString( - com.android.internal.R.string.config_signalXPath); - mXPath.set(PathParser.createPathFromPathData(xPathString)); - updateScaledXPath(); + final String attributionPathString = context.getString( + com.android.internal.R.string.config_signalAttributionPath); + mAttributionPath.set(PathParser.createPathFromPathData(attributionPathString)); + updateScaledAttributionPath(); mCutoutWidthFraction = context.getResources().getFloat( com.android.internal.R.dimen.config_signalCutoutWidthFraction); mCutoutHeightFraction = context.getResources().getFloat( @@ -104,13 +104,14 @@ public class SignalDrawable extends DrawableWrapper { setDarkIntensity(0); } - private void updateScaledXPath() { + private void updateScaledAttributionPath() { if (getBounds().isEmpty()) { - mXScaleMatrix.setScale(1f, 1f); + mAttributionScaleMatrix.setScale(1f, 1f); } else { - mXScaleMatrix.setScale(getBounds().width() / VIEWPORT, getBounds().height() / VIEWPORT); + mAttributionScaleMatrix.setScale( + getBounds().width() / VIEWPORT, getBounds().height() / VIEWPORT); } - mXPath.transform(mXScaleMatrix, mScaledXPath); + mAttributionPath.transform(mAttributionScaleMatrix, mScaledAttributionPath); } @Override @@ -177,7 +178,7 @@ public class SignalDrawable extends DrawableWrapper { @Override protected void onBoundsChange(Rect bounds) { super.onBoundsChange(bounds); - updateScaledXPath(); + updateScaledAttributionPath(); invalidateSelf(); } @@ -221,7 +222,7 @@ public class SignalDrawable extends DrawableWrapper { mCutoutPath.rLineTo(cutX, 0); mCutoutPath.rLineTo(0, cutY); canvas.drawPath(mCutoutPath, mTransparentPaint); - canvas.drawPath(mScaledXPath, mForegroundPaint); + canvas.drawPath(mScaledAttributionPath, mForegroundPaint); } if (isRtl) { canvas.restore(); |