Removing fill and stroke opacity
bug:16850076
attrs/public.xml update will be separated for build break friday.
Change-Id: I5863193d5fecd7e210bd6db5294868f1a70e0d2f
diff --git a/api/current.txt b/api/current.txt
index e48abe2..5710415 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -590,7 +590,6 @@
field public static final int fillBefore = 16843196; // 0x10101bc
field public static final int fillColor = 16843807; // 0x101041f
field public static final int fillEnabled = 16843343; // 0x101024f
- field public static final int fillOpacity = 16843806; // 0x101041e
field public static final int fillViewport = 16843130; // 0x101017a
field public static final int filter = 16843035; // 0x101011b
field public static final int filterTouchesWhenObscured = 16843460; // 0x10102c4
@@ -1190,7 +1189,6 @@
field public static final int strokeLineCap = 16843815; // 0x1010427
field public static final int strokeLineJoin = 16843816; // 0x1010428
field public static final int strokeMiterLimit = 16843817; // 0x1010429
- field public static final int strokeOpacity = 16843810; // 0x1010422
field public static final int strokeWidth = 16843811; // 0x1010423
field public static final int submitBackground = 16843914; // 0x101048a
field public static final int subtitle = 16843473; // 0x10102d1
diff --git a/core/res/res/drawable/ic_corp_icon_badge.xml b/core/res/res/drawable/ic_corp_icon_badge.xml
index d20c431..834ae68 100644
--- a/core/res/res/drawable/ic_corp_icon_badge.xml
+++ b/core/res/res/drawable/ic_corp_icon_badge.xml
@@ -20,13 +20,11 @@
android:viewportHeight="64.0">
<path
- android:fillColor="#FF000000"
- android:pathData="M49.062,50.0m-14.0,0.0a14.0,14.0 0.0,1.0 1.0,28.0 0.0a14.0,14.0 0.0,1.0 1.0,-28.0 0.0"
- android:fillOpacity="0.2"/>
+ android:fillColor="#33000000"
+ android:pathData="M49.062,50.0m-14.0,0.0a14.0,14.0 0.0,1.0 1.0,28.0 0.0a14.0,14.0 0.0,1.0 1.0,-28.0 0.0"/>
<path
- android:fillColor="#FF000000"
- android:pathData="M49.0,49.5m-14.0,0.0a14.0,14.0 0.0,1.0 1.0,28.0 0.0a14.0,14.0 0.0,1.0 1.0,-28.0 0.0"
- android:fillOpacity="0.2"/>
+ android:fillColor="#33000000"
+ android:pathData="M49.0,49.5m-14.0,0.0a14.0,14.0 0.0,1.0 1.0,28.0 0.0a14.0,14.0 0.0,1.0 1.0,-28.0 0.0"/>
<path
android:pathData="M49.0,49.0m-14.0,0.0a14.0,14.0 0.0,1.0 1.0,28.0 0.0a14.0,14.0 0.0,1.0 1.0,-28.0 0.0"
android:fillColor="#FF5722"/>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 771690e..736f1a9d2 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -5208,13 +5208,13 @@
<attr name="name" />
<!-- The width a path stroke -->
<attr name="strokeWidth" format="float" />
- <!-- The opacity of a path stroke -->
+ <!-- The opacity of a path stroke @hide-->
<attr name="strokeOpacity" format="float" />
<!-- The color to stroke the path if not defined implies no stroke-->
<attr name="strokeColor" format="color" />
<!-- The color to fill the path if not defined implies no fill-->
<attr name="fillColor" format="color" />
- <!-- The level of opacity of the filled area of the path -->
+ <!-- The level of opacity of the filled area of the path @hide-->
<attr name="fillOpacity" format="float" />
<!-- The specification of the operations that define the path -->
<attr name="pathData" format="string" />
diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java
index 813797f..2b5823e 100644
--- a/graphics/java/android/graphics/drawable/VectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/VectorDrawable.java
@@ -104,6 +104,8 @@
* <dt><code>android:translateY</code></dt>
* <dd>The amount of translation on the Y coordinate.
* This is defined in the viewport space.</dd>
+ * <dt><code>android:alpha</code></dt>
+ * <dd>The amount of transparency.</dd>
* </dl></dd>
* </dl>
*
@@ -117,15 +119,11 @@
* <dd>Defines path string. This is using exactly same format as "d" attribute
* in the SVG's path data. This is defined in the viewport space.</dd>
* <dt><code>android:fillColor</code></dt>
- * <dd>Defines the color to fill the path (none if not present).</dd>
+ * <dd>Defines the color to fill the path (black if not present).</dd>
* <dt><code>android:strokeColor</code></dt>
* <dd>Defines the color to draw the path outline (none if not present).</dd>
* <dt><code>android:strokeWidth</code></dt>
* <dd>The width a path stroke.</dd>
- * <dt><code>android:strokeOpacity</code></dt>
- * <dd>The opacity of a path stroke.</dd>
- * <dt><code>android:fillOpacity</code></dt>
- * <dd>The opacity to fill the path with.</dd>
* <dt><code>android:trimPathStart</code></dt>
* <dd>The fraction of the path to trim from the start, in the range from 0 to 1.</dd>
* <dt><code>android:trimPathEnd</code></dt>
@@ -1241,10 +1239,8 @@
int mStrokeColor = 0;
float mStrokeWidth = 0;
- float mStrokeOpacity = Float.NaN;
int mFillColor = Color.BLACK;
int mFillRule;
- float mFillOpacity = Float.NaN;
float mTrimPathStart = 0;
float mTrimPathEnd = 1;
float mTrimPathOffset = 0;
@@ -1263,10 +1259,8 @@
mStrokeColor = copy.mStrokeColor;
mStrokeWidth = copy.mStrokeWidth;
- mStrokeOpacity = copy.mStrokeOpacity;
mFillColor = copy.mFillColor;
mFillRule = copy.mFillRule;
- mFillOpacity = copy.mFillOpacity;
mTrimPathStart = copy.mTrimPathStart;
mTrimPathEnd = copy.mTrimPathEnd;
mTrimPathOffset = copy.mTrimPathOffset;
@@ -1327,8 +1321,6 @@
mFillColor = a.getColor(R.styleable.VectorDrawablePath_fillColor,
mFillColor);
- mFillOpacity = a.getFloat(R.styleable.VectorDrawablePath_fillOpacity,
- mFillOpacity);
mStrokeLineCap = getStrokeLineCap(a.getInt(
R.styleable.VectorDrawablePath_strokeLineCap, -1), mStrokeLineCap);
mStrokeLineJoin = getStrokeLineJoin(a.getInt(
@@ -1337,8 +1329,6 @@
R.styleable.VectorDrawablePath_strokeMiterLimit, mStrokeMiterlimit);
mStrokeColor = a.getColor(R.styleable.VectorDrawablePath_strokeColor,
mStrokeColor);
- mStrokeOpacity = a.getFloat(R.styleable.VectorDrawablePath_strokeOpacity,
- mStrokeOpacity);
mStrokeWidth = a.getFloat(R.styleable.VectorDrawablePath_strokeWidth,
mStrokeWidth);
mTrimPathEnd = a.getFloat(R.styleable.VectorDrawablePath_trimPathEnd,
@@ -1347,8 +1337,6 @@
R.styleable.VectorDrawablePath_trimPathOffset, mTrimPathOffset);
mTrimPathStart = a.getFloat(
R.styleable.VectorDrawablePath_trimPathStart, mTrimPathStart);
-
- updateColorAlphas();
}
@Override
@@ -1363,16 +1351,6 @@
a.recycle();
}
- private void updateColorAlphas() {
- if (!Float.isNaN(mFillOpacity)) {
- mFillColor = applyAlpha(mFillColor, mFillOpacity);
- }
-
- if (!Float.isNaN(mStrokeOpacity)) {
- mStrokeColor = applyAlpha(mStrokeColor, mStrokeOpacity);
- }
- }
-
/* Setters and Getters, used by animator from AnimatedVectorDrawable. */
@SuppressWarnings("unused")
int getStroke() {
@@ -1395,16 +1373,6 @@
}
@SuppressWarnings("unused")
- float getStrokeOpacity() {
- return mStrokeOpacity;
- }
-
- @SuppressWarnings("unused")
- void setStrokeOpacity(float strokeOpacity) {
- mStrokeOpacity = strokeOpacity;
- }
-
- @SuppressWarnings("unused")
int getFill() {
return mFillColor;
}
@@ -1415,16 +1383,6 @@
}
@SuppressWarnings("unused")
- float getFillOpacity() {
- return mFillOpacity;
- }
-
- @SuppressWarnings("unused")
- void setFillOpacity(float fillOpacity) {
- mFillOpacity = fillOpacity;
- }
-
- @SuppressWarnings("unused")
float getTrimPathStart() {
return mTrimPathStart;
}
diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable05.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable05.xml
index 5b1f6ab..bbf1a17 100644
--- a/tests/VectorDrawableTest/res/drawable/vector_drawable05.xml
+++ b/tests/VectorDrawableTest/res/drawable/vector_drawable05.xml
@@ -28,8 +28,7 @@
l-5.046875,0.0 0.0-1.0Z" />
<path
android:name="two"
- android:fillColor="#ffff00"
- android:fillOpacity="0"
+ android:fillColor="#00ffff00"
android:pathData="M 2.534375,9.6875l 4.140625,0.0 0.0,1.0-5.5625,0.0 0.0-1.0q 0.671875-0.6875 1.828125-1.859375
q 1.1718752-1.1875 1.4687502-1.53125 0.578125-0.625 0.796875-1.0625
q 0.234375-0.453125 0.234375-0.875 0.0-0.703125-0.5-1.140625
diff --git a/tests/VectorDrawableTest/res/drawable/vector_icon_schedule.xml b/tests/VectorDrawableTest/res/drawable/vector_icon_schedule.xml
index 8cabca8..1aad743 100644
--- a/tests/VectorDrawableTest/res/drawable/vector_icon_schedule.xml
+++ b/tests/VectorDrawableTest/res/drawable/vector_icon_schedule.xml
@@ -21,10 +21,10 @@
<group>
<path
- android:fillOpacity="0.9"
+ android:fillColor="#E6000000"
android:pathData="M11.994999,2.0C6.4679985,2.0 2.0,6.4780006 2.0,12.0s4.468,10.0 9.995,10.0S22.0,17.522 22.0,12.0S17.521,2.0 11.994999,2.0zM12.0,20.0c-4.42,0.0 -8.0,-3.582 -8.0,-8.0s3.58,-8.0 8.0,-8.0s8.0,3.582 8.0,8.0S16.419998,20.0 12.0,20.0z" />
<path
- android:fillOpacity="0.9"
+ android:fillColor="#E6000000"
android:pathData="M12.5,6.0l-1.5,0.0 0.0,7.0 5.3029995,3.1819992 0.75,-1.249999 -4.5529995,-2.7320004z" />
</group>